LaTeX Tips

From TonyWiki
Jump to navigation Jump to search

This is a compilation in progress of handy LaTeX shortcuts and packages.

Including stuff

Inline PDF File

Sometimes you need to inline PDF files in a TeX document. Previously, I did this by just compiling and running pdfunite (from the Linux Tips page), or converting to PNG and adding a figure. There is a better way to include PDF files in a tex file.

Use the pdfpages packages to be able to include PDF files like you do images. In your header, add


Where you want to include the PDF file, you can use the following snipped


You may need to experiment with the width. With my file, I had to use width=1.3\textwidth, since my PDF file included it's own margin as well, which was being added to the margins of the LaTex file. You can also include a single page by giving a page number such as with pages=1 instead of pages=- which includes all pages. Finally, file.pdf is the filename.

Get symbol names

This is super useful to get the names of math icons where you know the shape but not the name. Draw the symbol on this site and it will tell you that the command is:


Remove indents

LaTeX indents paragraphs by default. Sometimes this is annoying. You can avoid indenting a given paragraph by starting it with


If you wish to disable indents on the whole documents, you can make a macro defined in the heading as follows:


Line spacing

You can easily set and change between line spacing using the setspacing package.


Then, at any point, you can change the spacing using


etc to change between the different options.

Alternatively, you can use \linespread{2.0} but changing between double/single spacing with the setspace stuff is more convenient.