paulgorman.org

Typesetting with LaTeX

TeX is a typesetting system. Text files with the file extension '.tex' can be processed to produce a variety of nicely presented output formats including PDF and HTML. TeX is the typesetting system, LaTeX is a higher-level set of macros that comprise a lot of what you'll want to use when manually formatting a document. Compile the source file 'mydoc.tex' like: > latex mydoc. That generates a bunch of files, including a DVI. For PDF output, run: > pdflatex mydoc. Various options exist to output HTML from LaTeX, including tth and latex2html.

A good introductory guide to LaTeX can be found by googling "the not so short introduction to latex". Also, this page has good information. Font samples are found at the LaTeX Font Catalogue. Here's a sample document:

% This a single line comment \documentclass[12pt,twocolumn,twoside]{book} % Documentclass could be article, report, or letter. % An article is similar to a book, but doesn't have % chapters and is single-sided by default. \pagestyle{headings} \linespread{1.3} % Leading multiplier \setcounter{secnumdepth}{-1} % Don't number sections \usepackage{xcolor,graphicx} \usepackage[bookmarks,colorlinks,linkcolor=blue,pdftex]{hyperref} % If you need any boxed text: \usepackage{framed} \usepackage[bottom]{footmisc} % Keeps footnotes at bottom \setlength{\footnotesep}{0.4cm} % Space between footnotes \setlength{\skip\footins}{0.8cm} % Space above footnotes \interfootnotelinepenalty=10000 % Keep footnotes on same page % Don't add huge vertical whitespaces: \raggedbottom \begin{document} \title{\bf My Book} \author{Paul Gorman} \date{\today} \frontmatter \maketitle \tableofcontents \mainmatter \part{Part The First} \chapter{My First Chapter} \begin{center}\includegraphics{img/my_image.png}\end{center} This is the first paragraph of my first chapter. I want to make sure that \verb#this bit is printer verbatim# and not interpreted by LaTeX. Any character can serve as the delimiter except for a space. Larger blocks of verbatim text would be specified like: \begin{verbatim} Some text here. \end{verbatm} \noindent This second paragraph will not be indented. If I'm talking about \TeX\ or \LaTeX, those escapes will pretty print them. Special characters like dollar signs, ampersands, and percentage sighs should be escaped: \$, \%, \&, \#, \{, etc. You can force a line break with \newline, and this will be on a new line. To force a page break use \newpage. It's easy to add footnotes like so.\footnote{My footnote text here.} \marginpar{You can also have margin notes like this.} \begin{framed} This is boxed text. Framed also can be 'shaded', 'snugshade', or 'leftbar'. \end{framed} \section{This is a section of a chapter} Text can be \underline{underlined} or emph{emphasized}. The font characteristics can also be changed to \textit{make it italic}, \texttt{make it typewriter/monospaced}, \textsf{make it sans-serif}, \textbf{or bold faced}. This text {\tiny can} {\small be} {\normalsize a} {\large variety} {\Large of} {\LARGE different} {\huge sizes}. \subsection{A subsection of the section} Note that there can also be subsubsections, paragraphs, and subparagraphs. \begin{quote} This is a short block quote. There is also a "quotation" block, which differs from "quote" in that it indents paragraphs. There's also a "verse" one for poetry, which preserves line breaks and so forth. \end{quote} With the hyperref package in use, you can include clickable hyperlinks like \href{http://google.com}{Google}. \include{include/chapter-x} % Note that the '.tex' is implied. \part{Part The Second} To include images/graphics, choose either to include only Postscript images (.ps, .eps) or only non-Postscript images (.pdf, .png, .jpg, .gif). If you're final output will be a PDF (made with pdflatex), you should use non-Postscript images. Be sure to include '\usepackage{graphicx}' after the documentclass declaration. \includegraphics{mypic.pdf} % Don't include actual image, draft outline box only: \includegraphics[draft]{anotherpic.png} \include{include/chapter-y} \include{include/chapter-z} \end{document}