Typesetting with LaTeX

(20??, updated 2018)

UPDATE: pdflatex has some limitation, including problems with Unicode input. lualatex is the future. LuaTeX supports Unicode input, uses system font (e.g., TTF or OTF), and offers scripting in Lua. Although LuaTeX works with the familiar LaTeX macro language, it also supports the new ConTeXt macro language.

TeX is a typesetting system. Text files with the file extension ‘.tex’, written in a special markup language, can be processed to produce nicely formatted PDF’s. TeX is the typesetting system, LaTeX is a higher-level set of macros that comprise a lot of what we’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.

Here’s a sample document:

% This a single line comment
% 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. 

\linespread{1.3} % Leading multiplier
\setcounter{secnumdepth}{-1} % Don't number sections


% If you need any boxed text:

\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:


\title{\bf My Book}
\author{Paul Gorman}



\part{Part The First}

\chapter{My First Chapter}


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:

Some text here.

\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 

\marginpar{You can also have margin notes like this.}

This is boxed text. Framed also can be 'shaded', 'snugshade', 
or 'leftbar'.

\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 

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.

With the hyperref package in use, you can include clickable 
hyperlinks like \href{}{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

% Don't include actual image, draft outline box only:




Here’s a similar document in the ConTeXt macro language.


This is the first paragraph.

This  is
verbatim  \ConTeXt.



The first chapter


The second chapter.

\item  First  item.
\item  Second  item.

\input include/chapter-y