home < aerospace engineering < latex-howto>

Creating PDFs with LaTeX

Creating goodlooking PDFs with LaTeX

Required software

First of all, you'll want to have a complete distribution of LaTeX on your computer. Some links to LaTeX-distributions which are usable:
OSLinkRemarks
Debian GNU/LinuxteTeX for debian Just do an apt-get install tetex-base and you're up and running
Mac OS XTeXGSInstaller.app Since Mac OS X has native support for pdf's, you'll want to use pdfs only, and not bother with dvi.
Other Linuxes?Get a teTeX-based packages for your distribution
WindowsMiKTeXI have no hands-on experience with this distribution, but it is recommended
*BSD?Probably a teTeX or livetex lives somewhere in the ports.

Problem 0: what to run

If you think you need to create dvi-files and then convert these to pdfs manually, think again. Use pdflatex, which should be included in every distribution mentioned above.

Problem 1: fonts

One of the problems often encountered in online pdf-files created with pdflatex is

Now.. how to create nice-looking pdfs? The key element to this is using the package pslatex. This will make your documents use fonts which Acrobat Reader is able to render correctly on screen. However, doing this makes your dvi's look ugly. Simple work-around: copy-paste the following piece into your preamble:

\newif\ifpdf
\ifx\pdfoutput\undefined
  \pdffalse
  \usepackage[colorlinks=false]{hyperref}
\else
  \pdfoutput=1
  \pdftrue
  \usepackage[pdftex,colorlinks=true,urlcolor=blue,linkcolor=blue]{hyperref}
  \pdfcompresslevel=9
  \usepackage{pslatex}
\fi

This also includes the package 'hyperref' into your document, which then generates links in your document where links can be placed, for example, to footnotes, endnotes, in-text references, from your TOC, etc. Quite useful.

Pictures

Another problem is you might want to use output from matlab, gnuplot and/or other formats in your documents. Don't export anything to a bitmap-based format if you're using vector-based data (such as graphs, autocad-drawings, visio-diagrams, etc.). Find out if your software can export to pdf directly, or encapsulated postscript (eps), or ps. If necessary, when running under windows, you can install a postscript printer driver and then choose the 'print to file' option. All unix-like platform should be printing to postscript anyway, or you're running a severely brain-damaged unix.

Once you have postscript pictures, convert them to pdf-pictures, using ps2pdf, eps2pdf, pstopdf, or how these programs are called in your environment. Now you can include them hassle-free in your documents using the graphicx package:

\begin{figure}[b]
\includegraphics[width=3cm]{naamvanfilezonderextensie}
\label{picrefplaatje}
\caption{Een mooi plaatje}
\end{figure}

Easy!

Problem 3: Page headers look ugly

Yes, the default latex pageheaders look ugly and are somewhat sucky in general (however, this is a matter of taste of course). Read the excellent documentation on the fancyhdr package, and use it.

Problem 4: Section headers look ugly

Also something which has to do with taste - in any case, I don't like the way most headers look, so I have (some variation of) the following code in the preamble of most of my documents:

\makeatletter
\def\section{\@startsection {section}{1}{\z@}{3.0ex plus 1ex minus
.8ex}{2ex plus 1ex minus .6ex}{\sf\Large}}
\def\subsection{\@startsection {subsection}{2}{\z@}{2.0ex plus 1ex minus
.4ex}{1.5ex plus 1ex minus .4ex}{\sf\large}}
\makeatother
More information to come here on request - time to sleep for me though ;)
home < aerospace engineering < latex-howto>
©2002 C.J. Spaans - Last modified: 07/09/2002 01:01:35 by Jasper Spaans (NEW PGP key ID: 8B150CF8)