---++ Commands Latex allows to simplify things which are used often. It's a decision of style how often you will use this things. Very often they make it harder to read the code of the document (especially after a break of some month or for other person which see it the first time). On the other hand they make it easier to create a consistent layout. All this commands are defined before the \begin{document} statement. It's also a good idea to export them to an own file an import them with \input{comdef.tex} Here some tips and examples * If Latex fails by some hyphenation you can explain them to Latex. =\hyphenation{syllable-syllable}= * Often used words can be replaced by short ones. eg: =\newcommand{\IOLU}{International organized latex users\xspace}=. Inside the text you need only to write =\IOLU= instead of the whole thing. The =\xspace= at the end needs the package =xspace(\usepackage{xspace})= and handles the problems with space at the end of =\IOLU=. Don't define hundred of shorts in this style. Your text won't be readable. Another advantage is the uniform formating of all occurrence of them. (=\newcommand{\brand}{\textit{brand}\xspace}=). * For an identical figure style use a command like this: <br/> =\newcommand{\myFig}[5][\columnwidth]{ <br/> \begin{figure}[htbp]\begin{center} <br/> \includegraphics[width=#1]{#2} <br/> \caption{#3} <br/> \label{img:#5} <br/> \small{\textit{#4}} <br/> \end{center}\end{figure} <br/> }= <br/> It uses 5 arguments, where the first one is optional: Width of the figure (default: column-width), name of the file, title, caption and reference name (where img: is added by default, to prevent duplicated names). <br/> Example =\myFig[5cm]{psfile.ps}{Overview}{This picture show everything}{everything}= or without a given width =\myFig{psfile.ps}{Overview}{This picture show everything}{everything}= If you define also =\newcommand{\fig}[1]{Figure \ref{img:#1}}= you can refer the picture just by using =\fig{everything}= (In the text figure 6 will appear as example). <br/> The advantage of this two commands is that you can change the layout of all pictures just by changing the command definition. * A little bit more complicate is newenvironment but it allows also more complicate things, because you may embed whole text passage. <br/> ={\newenvironment{myTab}[3][] <br/> {\begin{table}[#1]\begin{center}\caption{#2}\label{tab:#3}\vspace{3mm}} <br/> {\end{center}\end{table} <br/> }= <br/> Defines a environment for tables. The arguments are position (optional), title and reference name ( with an additional tab: <br/> =\begin{myTab}{the results of my work}{reswork}= <br/> Caption of the table, the table itself ... <br/> =\end{myTab}= -- Main.JoergMaeder - 20 Dec 2010
View