Created at:

Modified at:

My LaTeX notes

Since I am not a heavy user of the LaTeX typesetting system, I decided to write down tips for myself, because I use it only once in a while. I frequently forget important things about that and, although I have a set of bookmarks related to LaTeX, they are spread so I cannot find them when I want. To avoid using a search engine for every feature of LaTeX I need, here comes these notes.



Using the figure environment

In order to use figures, first by including the graphicx package::


Them by using the figure environment::

        \caption{Caption comes here}

It is interesting to point out the [width.5paperwidth] parameter, that sets the picture width to half of page width.

Figures in different chapters have the same number

In the default class of LaTeX, pictures are numbered 1.1, 1.2 for chapter 1; 2.1, 2.2 for chapter 2 and so on. ABNT uses just one number (the second one), so you may have figure 1 in chapter 1 and figure 1 in another chapter! This is confusing, but easily fixable, with the chngcntr package. Include it first::


Then, tell it to count figures outside of chapter division (I use to include this line just after begin{document}::


Tex Frequently Asked Questions -- question label "running-nos"

General tips

Remove a number of a page

To remove a number from a page, just use the thispagestyle{empty} command.


Cross-references are one of the most powerful features of LaTeX in my opinion. See this figure example::

    Here some sh code at figure \ref{fig:sh-code}:

      \caption{sh code}
        echo "bla";

Important commands here are:

LaTeX/Labels and Cross-referencing - Wikibooks, open books for an open world

LaTeX Tricks: Figures

"Small" verbatims


begin{verbatim} .. end{verbatim} is used for text blocks. If you want to put a small verbatim text inside a paragraph, just use::

    \verb|my verbatim text|

See that, any character can be a verb delimiter, like pipe in the last example. Another example using plus::

    \verb+my verbatim text+

For more information, see this__.


The listings package --------------------


I recently discovered that there is the listings package that would allow you to list program's source code and color them according to their syntax. To use the package, just::


Use the lstset{} command to configure listing options and just use it that way::

                      caption={Description of a VHDL code},

LaTeX/Source Code Listings - Wikibooks, open books for an open world

"Fields" (underscores) to be written on after printing


You may want create some underscored fields so allowing readers of the document write on it like a date field (____/__/__). A single underscore in LaTeX is ugly, so we create a new command, called xline{}::


The xline{} draws a stylish line 0.5 cm width. Try it by yourself.