A DBD sample chapter as an introduction into LaTeX

This should help people getting started in LateX with the most commonly used commands and blocks, a good references is the LaTeX Wikibooks, which can be found on
http://en.wikibooks.org/wiki/LaTeX.

Philosophy: Why is LaTeX so different than Word ?

In the LaTeX the author is  and supposed to focus on content and logical structure of the document. The page layout, fonts, colors, etc. are handled by the layout class which is provided by the LaTeX system. This means the author doesn't need to worry about these things and can just write content. Hence also the layout possibilities for The backside is, that the LaTeX file needs to be compiled first, before one can have a look at the final document.

But especially in large documents, the strict separation between content and layout has many advantages

Some Basics

LaTeX Commands start with a \ and have usually the following structure

 \command{parameter}[options]

LaTeX is very often using begin-end blocks to structure logical elements. These are referred to as environments.

\begin{somepart}
\end{somepart}

Structuring documents

\chapter{A sample Chapter}
\section {Introduction}
\subsection {List of systems}
\subsubsection{List of subsystems}
\paragraph{List of subsubsystems}

These commands can be used to structure chapters into sections, subsections, paragraphs etc. The numbering is automatically taken care of by LateX
More details can be found here

Lists and enumerations

\section{Lists and enumerations}
An example for a bullet list
\begin {itemize}
\item Item 1
\item Item 2
\end {itemize}
and for a numbered list
\begin {enumerate}
\item Item 1
\item Item 2
\end {enumerate}

A common element are bulleted and numbered lists, for which the code is shown above. The output looks like the following:


Labels and cross-references

Any position in a text can be marked using

\label{mark}

Common are references and labels for chapters, sections, tables and figures

\chapter{Sample Costing Guidelines\label{sid:chapter_sample_costing}}
as can be seen in Chapter~\ref{sid:chapter_sample_costing}

(warning) Please consult the FAQ (https://confluence.slac.stanford.edu/display/ilc/Editors+FAQ#EditorsFAQ-WhatisthenamingconventionforLaTeX\labels) on naming conventions for labels in the DBD

Tables

A LaTeX table environment has the following structure:

\begin{table}
\caption{\label{sid:chapter_sample_table1} This is a sample table for a document}
\begin{center}
\begin{tabular}{|l|r|c|} \hline
Name & Size & Status \\ \hline
adeu9Iez & 1020 & ok \\
OV2Ieboh & 1291 & not ok\\
xeeC6Thi & 1636 & ok\\ \hline
\end{tabular}
\end{center}
\end{table}

It starts with a \begin{table} environment then the \caption takes care of putting in the table caption, the label sets a mark, so it can be referred to in the following text using \ref

The \begin{center} centers the actual table environment \begin{tabular}.
The  {|l|r|c|}  tells LaTeX to make a table with three columns, aligned left right and centered and \hline draws a horizontal line

Individual columns are separated with \& and are ended with a double-slash

The output is shown below:

Tables can almost be infinitely complex, hence this chapter is a recommended read.

Figures

Figures work pretty much the same as tables

\begin{figure}
\includegraphics{image.pdf}
\caption{\label{sid:chapter_sample_figure1} This is a sample figure for a document}
\end{figure}

the actual image is include with the \includegraphics command. It has some useful options to scale an image

  • [scale=0.8] will scale the picture by a factor of 0.8
  • [width=0.5\textwidth]will make the picture width to be 80 % of the total text width

there are preferrable to giving absolute sizes

  • [width=10cm]
  • [height= 3in]

So including a figure looks like:

\begin{figure}
\includegraphics[width=0.6\textwidth]{image2.pdf}
\caption{\label{sid:chapter_sample_figure2} This is a second sample figure for a document}
\end{figure}

Details can be found here

Note:

  • If the Figure file isn't available, LaTeX will complain but usually continue building. It is important to specify the path of the file location relative to the build directory.
  • Concerning file formats, check the FAQ

Special Characters

Seehttp://en.wikibooks.org/wiki/LaTeX/Accents with a whole summary of Accents and special characters

Citations

will be handled using BibTeX, hence it needs some additional steps. In the LaTeX document you refer to the article book, etc.with

 \cite{Aaltonen:2011rt}

however in the central bibliography file (common for everyone} you have to add a piece giving all the information for your document

 @article{Aaltonen:2011rt,
      author         = "Aaltonen, T. and others",
      title          = "{Search for Standard Model Higgs Boson Production in
                        Association with a $W$ Boson Using a Matrix Element
                        Technique at CDF in $p\bar{p}$ Collisions at $\sqrt{s} =
                        1.96$ TeV}",
      collaboration  = "CDF Collaboration",
      journal        = "Phys.Rev.",
      volume         = "D85",
      pages          = "072001",
      year           = "2012",
      eprint         = "1112.4358",
      archivePrefix  = "arXiv",
      primaryClass   = "hep-ex",
      reportNumber   = "FERMILAB-PUB-11-664-E",
      SLACcitation   = "%%CITATION = ARXIV:1112.4358;%%",
}

BibTeX will the generated the references centrally for the entire document. For the DBD, just send the information to the references maestro who'll insert it into the central database and the just refer to it with \cite. Everything else will be taken care of by the build script.
Spires/Inspire has already an automatic tool to generate BibTeX entries.

  • No labels