LaTeX useful Tips/Tricks
In my previous post I discussed a “small” but, I would say “complet” template to start your document. If you want to include also movies in your pdf documents, then this post can help you. If you need a good program for bibliographic management check this post.
Below I will post a lot of tips, tricks and useful stuff which helps me when I am using LaTeX, for details check the documentation of coresponding package name, or Google .
Customize your header and footer
1 2 3 4 5 6 7 | \pagestyle{fancy} \lhead{} % \chead{} \rhead{\leftmark} % \lfoot{} % \cfoot{} % \rfoot{} |
More packages
1 2 3 4 5 6 7 8 | \usepackage{latexsym} % use \Box, \Join \usepackage{setspace} \usepackage{subfigure} % include subfigures \usepackage{amsmath} % equation % table of contents, list of figures \usepackage[titles,subfigure]{tocloft} \usepackage{lastpage} % total page count \usepackage{makeidx} % create index |
Old Makefile which I used, you can modify it for your needs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | dvi: poster.tex latex poster.tex bib: bibtex poster view: kdvi poster.dvi ps: dvips poster.dvi -o poster.ps pdf: ps2pdf poster.ps poster.pdf mp: psnup -9 -l -d2 poster.ps multpage.ps a4: psresize -H118.9cm -W91.4cm -pa4 poster.ps a4.ps ps2pdf a4.ps poster_a4.pdf .PHONY: clean clean: @echo Cleaning... $(RM) *.log *.aux *.dvi *.bbl *.blg *~ @echo Cleaning... done |
Indexes and Glossaries
1 2 3 | % first include the makeidx command in the preamble \usepackage{makeidx} \makeindex |
To index something, use the command:
1 | \index{Index Entry} |
When the document has been processed through LaTeX, it will create a .idx file. You will then need to run the .idx file through the makeindex program:
1 | makeindex filename |
No file extension for the name. The program will look for the .idx file and will output a .ind file. This file is used by the command:
1 | \printindex |
Glossaries simply use the commands:
1 2 | \makeglossary (used in the preamble, like the \makeindex command) \glossary (used for the particular entries, like the \index command) |
Include/Rotate/Reflect images
1 2 3 4 5 6 7 8 9 10 11 | \includegraphics{image.png} \includegraphics[angle=45]{image.png} \includegraphics*[viewport=30 30 120 120]{image.png} \includegraphics[scale=0.25]{image.png} \includegraphics[width=5in,height=1in]{image.png} % no explicit size for image \includegraphics[width=0.88\hsize]{image.png} % horizontally reflect a image \reflectbox{\includegraphics{myimage.png}} % strange text behaviour \scalebox{2}{\rotatebox{60}{\reflectbox{Check this text!}}} |
Complet environment with two images left-right
1 2 3 4 5 6 7 | \begin{figure}[htbp] \centering \includegraphics[width=0.8\hsize]{image}\\ \includegraphics[width=0.8\hsize]{image} \caption{image caption} \label{fig:mylabel} \end{figure} |
1 2 3 4 5 | \begin{figure*}[t] \centerline{\includegraphics[width=0.8\textwidth]{figures/image}} \caption{Caption title. {\it Caption text.}} \label{fig:image} \end{figure*} |
Labeling sections in the document
1 2 3 4 5 | \section{Introduction} \label{sec:intro} ..... % reference to section \ref{sec:intro} |
Adding external files to the document
1 2 3 | \section{Introduction} \label{sec:intro} \input{sections/intro} |
Math
1 2 3 4 | \[...\] % produces an unnumbered formula \(...\) $...$ \begin{math} ... \end{math} |
Type properties
1 2 3 4 5 6 7 8 9 | \bf % bold \sf % sans serif \sc % small caps \tt % typewriter \tiny \normalsize \large \Large \LARGE |
Lists
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | \begin{enumerate} \item First item \item Second item \end{enumerate} % \begin{itemize} \item First item \item Second item \end{itemize} % \begin{description} \item[first] A definition for the first item. \item[second] A definition for the second item. \end{description} |
Columns
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | \begin{tabbing} text \= some text \\ \> text \= text, \> \> text; \\ \> text \> text. \\ endif \end{tabbing} % \begin{tabular}{|l|c|c|} \hline {Row 1,Col1} & {Row1,Col2} & {Row1,Col3} \\ \hline {Row 2,Col1} & {Row2,Col2} & {Row2,Col3} \\ \cline{2-3} {Row 3,Col1} & {Row3,Col2} & {Row3,Col3} \\ \hline \end{tabular} % \begin{tabular}{|l|c|c|} \hline {Row 1,Col1} & {Row1,Col2} & {Row1,Col3} \\ \hline {Row 2,Col1} & \multicolumn{2}{c}{Row2,Col2-3} \\ \cline{2-3} {Row 3,Col1} & {Row3,Col2} & {Row3,Col3} \\ \hline \end{tabular} |
Tables
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | {\protect \begin{table}[t] % Table body \caption{Caption title. {\it The caption text.}} \label{tab:schema} \end{table} } % {\protect \begin{table}[t] \centering \footnotesize \begin{tabular}{|l|c|c|} \hline {Row 1,Col1} & {Row1,Col2} & {Row1,Col3} \\ \hline {Row 2,Col1} & {Row2,Col2} & {Row2,Col3} \\ \cline{2-3} {Row 3,Col1} & {Row3,Col2} & {Row3,Col3} \\ \hline \end{tabular} \caption{Caption title. {\it The caption text.}} \label{tab:schema} \end{table} } |
References:
- LaTeX Project WebSite
- LaTeX on Wikipedia
- Latex Makefile by Google
- Makefile: Rubber
- The TeX Catalogue Online has a very comprehensive list of all the LaTeX packages out there
- Latex Tutorial
- Header and Footer in LaTeX – Explained
- Latex Explained
- Installing and Using LaTeX Packages
- Noeckel: Computer Notes (LaTeX and useful stuff)
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.














Thank you. This is a very well prepared and helpful summary.