Welcome to the TeXnik website (under construction) Miscellaneous Tips |
|||||||||||||||||
|
addcontentsline - command |
Barcode | Border around each Page | circle with a letter in it | Classfiles | Color config file | Current Time | C++ - Symbol | Dashed underline | Define a new Environment | DNA-Sequences | Dotted underline | Double columnseprule | Draft Option | Drawing Math functions | Empty page | Environment | Environment in an environment (amsmath) | epigraph-package | First Letter bold | First Word in other fontsize | Graphics config file | Harpoon-Symbol | hrulefill | Information about the (La)TeX System | jobname | LaTeX Length | LaTeX System | LaTeX Length | Mathcommands in textmode | Motto on chapter-pages | \newenvironment |
Overbracket | Overwriting Images | Overwriting Text | Package options | Parameters in Environments | Parsing filename | Path-setting | Picture on chapter-page | Plot Math functions | pstricks package | \raisebox Command | \renewcommand{...} | Spanish Language | Side by Side Example | Tally Symbol | TeX System | Time | Timestamp | twocolumn mode | Underbracket | underscore | Width of an Image | xleft/rightharpoon-Symbol | xypic and babel | Empty pageAn empty page with a correct header and footer:\newpage\null\newpageWithout header and footer, but correct page counting: \newpage \begingroup \thispagestyle{empty}% oder \pagestyle{empty} \null \endgroup \newpageA "real" empty page, without influencing the counter: \shipout\null Modifying hrulefillIt is easy to modify the position and the width of the rule.\makeatletter \def\hrulefill{\leavevmode\leaders\hrule\@height-3pt\@depth7pt\hfill\kern\z@} \makeatother Parsing filenamePass options to a package
Stripping a prefix/suffix from a string
\newenvironment Put the code for a new environment into Layout->Preamble \newenvironment{name}{% code for \begin{name}% }{% code for \end{name}% }Using a parbox or a minipage requires some special code, f.ex.: \makeatletter \newenvironment{myEnv}{% \begin{lrbox}{\@tempboxa}% % put here additional stuff \begin{minipage}{\columnwidth}% % put here additional stuff }{% \end{minipage}% \end{lrbox}% \usebox{\@tempboxa}% } \makeatotherIn your text use it in the usual way: \begin{myEnv}any stuff \end{myEnv}
Side by Side ExampleThe packagefancybox contains an environment for a "side by side example", which
means on the left the code and on the right the output. This works well, but doesn't support
umlauts or another special character. Here is a solution with package listings .
\raisebox - command
xypic and babel The xy-package redefines the catcode for " which causes problems with babel. So still use it in the following way: \shorthandoff{"} % xypic stuff \shorthandon{"}
addcontentsline - commandIf you want to add more than one line to one of the toc/lot/... use \addcontentsline{toc}{section}{% line 1\hspace*{\fill}\endgraf line 2% }For the addtocontents -command see also here Information about the installed (La)TeX System If you need some information about your local TeX system try the following commands to get information about teTeX, TeX Directory Structure and pathsettings: voss@shania:/tmp> texdoc TETEXDOC (creates and opens a pdf document) voss@shania:/tmp> texdoc tds (creates and opens a pdf document) voss@shania:/tmp> less `kpsewhich texmf.cnf` (opens the configuration file) voss@shania:/tmp> kpsewhich '-expand-var=$HOMETEXMF' /usr/local/texlive/texmf-local voss@shania:/tmp> kpsewhich '-expand-var=$HOMETEXMF' /usr/local/texlive/texmf-local voss@shania:/tmp> kpsewhich -expand-var=\$TEXMF {!!/home/voss/.texlive2005/texmf-config,!!/home/voss/.texlive2005/texmf-var,/home/voss/texmf,!!/usr/local/texlive/2005/texmf-config,!!/usr/local/texlive/2005/texmf-var,!!/usr/local/texlive/2005/texmf,!!/usr/local/texlive/2005/../texmf-local,!!/usr/local/texlive/2005/texmf-dist} voss@shania:/tmp> kpsewhich -expand-var=\$TEXINPUTS :/home/voss/.TeX:/usr/share/doc/.TeX:/usr/doc/.TeXThe last one prints the root of the TeX tree.
This one tells you where LaTeX search for tex or bib files
kpsepath .Command Characters / Underscore In LaTeX the characters $ % { } & # _ ^ are command characters and
have to be escaped when you want to use them as normal characters:
\$ \% \{ \} \& \# \_ \^otherwise you'll get an error at the LaTeX run.
For the underscore there exists a special package underscore.sty. If you want to pass for
example a filename with a underscore to another macro, then do it in the following way:
C++ - Symbol\makeatletter \DeclareRobustCommand{\Cpp} {\valign{\vfil\hbox{##}\vfil\cr \textsf{C\kern-.1em}\cr $\hbox{\fontsize{\sf@size}{0}\textbf{+\kern-0.05em+}}$\cr}% } \makeatother
Parameter in an EnvironmentIf you want to use a parameter in the closing part of an environment, than first define a dummy command. For example:\newenvironment{mytable}[2]{% \begin{table}% \newcommand{\mytablecaption}{% \caption{#1}% \label{#2}% }% \centering \begin{tabular}{lll}% }{% \end{tabular}% \mytablecaption \end{table}% }
Width of an Image in latex preamble \newsavebox{\Imagebox} \newcommand{\image}[2]{ \centering \savebox{\Imagebox}{\includegraphics{#1}}% \usebox{\Imagebox}\par\noindent \parbox[t]{\wd\Imagebox}{\#2}% }Now you are able to place an image in a parbox with the right width.
Path for files in latex preamble for files \def\input@path{{yourInputPathForTheFiles/}} For the graphi files you can define: \graphicspath{{../home/voss/TEST/}}but remember:
draft-Option In some cases it makes sense when LaTeX shows problematic formatting with vertical margin rules and the graphics as empty rectangles in the dvi-output. In this case choose the option draft for the documentclass.If you want to use this option for own commands like notes, than you can use this option and output some notes only when the draft option is set. The following example shows this for the arcticle class: \newcommand{\myNote}[1]{% \@ifclasswith{article}{draft}{% \marginpar{#1}}{}% }The draft-option is passed to all other used packages. If you only want to mark the overfull lines then you can write \setlength{\overfullrule}{5pt}instead of using the draft-option with all other effects.
Overwriting text Use package soul.sty or try the following commands. Overwriting like is possible with command \myOverwrite{demo}{xxxxx}, which is defined in LaTeX-preamble \newcommand\myOverwrite[2]{\makebox[0cm][l]{#1}#2\ }You can also define your own math-symbols: \myOverwrite{$\parallel$}{$\slash$} \myOverwrite{\raisebox{0.15ex}{o}}{$\slash$}
circle with letter in it \newcommand\kreis[1]{\ensuremath{\mathbin{\settowidth{\dimen7}{\mbox{$\bigcirc$}}% \makebox[0pt][l]{$\bigcirc$}\makebox[\dimen7]{#1}}}}\kreis{u} prints a circle with an u in it.
Mathcommands in textmode If you are tired of writing some math-commands in mathmode, while they can't be written in textmode, like $\delta$, you can redefine these commands: \usepackage{xspace} %for a better layout \let\origdelta\delta \renewcommand{\delta}{\ensuremath{\origdelta}\xspace}Now you can write only \delta, LaTeX uses it by default as a math-command like: \delta and $delta$ is exactly the same ...
BarcodeSee also the PSTricks package pst-barcode.
|