1.4. Common macros and environments

Table of Contents

1.4.1. Subsections
1.4.2. Lists
1.4.3. Columns
1.4.4. Tables
1.4.5. Figures
1.4.6. Type properties
1.4.7. Math
1.4.8. Positioning and formatting

1.4.1. Subsections

To add a subsection:

% sections/overview.tex

% Overview of the technique...

\subsection{Schemas}
\label{subsec:schemas}

% Subsection text...

To add a subsubsection:

% sections/overview.tex

% Overview of the technique...

\subsection{Schemas}
\label{subsec:schemas}

% Overview of schemas...

\subsubsection{GXL Schemas}
\label{subsubsec:gxl-schemas}

% GXL schemas...

1.4.2. Lists

To add an ordered list:

\begin{enumerate}
   \item First item
   \item Second item
\end{enumerate}

To add an unordered list:

\begin{itemize}
   \item First item
   \item Second item
\end{itemize}

To add a description list:

\begin{description}
   \item[first] A definition for the first item.
   \item[second] A definition for the second item.
\end{description}

1.4.3. Columns

Using the tabbing environment:

\begin{tabbing}
if \= condition is true \\
   \> then  \= do something,
   \>       \> do another something; \\
   \> else  \> do something else. \\
endif 
\end{tabbing}

Using the tabular environment:

\begin{tabular}{|l|c|c|}
   \hline
   {Row 1,Col1} & {Row1,Col2} & {Row1,Col3} \\
   \hline
   {Row 2,Col1} & {Row2,Col2} & {Row2,Col3} \\
   \cline{2-3}
   {Row 3,Col1} & {Row3,Col2} & {Row3,Col3} \\
   \hline
\end{tabular}

Using the tabular environment with multicolumns:

\begin{tabular}{|l|c|c|}
   \hline
   {Row 1,Col1} & {Row1,Col2} & {Row1,Col3} \\
   \hline
   {Row 2,Col1} & \multicolumn{2}{c}{Row2,Col2-3} \\
   \cline{2-3}
   {Row 3,Col1} & {Row3,Col2} & {Row3,Col3} \\
   \hline
\end{tabular}

1.4.4. Tables

Using the table environment:

{\protect
   \begin{table}[t]
      % Table body
      \caption{Caption title. {\it The caption text.}}
      \label{tab:schema}
   \end{table}
}

Including a tabular environment:

{\protect
   \begin{table}[t]
      \centering
      \footnotesize
      \begin{tabular}{|l|c|c|}
         \hline
         {Row 1,Col1} & {Row1,Col2} & {Row1,Col3} \\
         \hline
         {Row 2,Col1} & {Row2,Col2} & {Row2,Col3} \\
         \cline{2-3}
         {Row 3,Col1} & {Row3,Col2} & {Row3,Col3} \\
         \hline
      \end{tabular}
      \caption{Caption title. {\it The caption text.}}
      \label{tab:schema}
   \end{table}
}

1.4.5. Figures

Using the figure environment:

\begin{figure}[t]
   % Body of figure
\caption{Caption title. {\it The caption text.}}
\label{fig:schema}
\end{figure}

Including an image:

\ifx\pdfoutput\undefined
  \usepackage[dvips]{graphicx}
  \usepackage[dvips,dvipsnames]{color}
\else
  \usepackage[pdftex]{graphicx}
  \usepackage[pdftex,dvipsnames]{color}
\fi
% ...
\begin{figure*}[t]
\centerline{\includegraphics[width=0.8\textwidth]{figures/schema}}
\caption{Caption title. {\it The caption text.}}
\label{fig:schema}
\end{figure*}
Note that in a two column document, `figure' defines a one column figure, and `figure*' defines a two column figure.

1.4.6. Type properties

  • Selected styles
    • \bf - bold
    • \sf - sans serif
    • \sc - small caps
    • \tt - typewriter
  • Selected sizes
    • \tiny
    • \normalsize
    • \large
    • \Large
    • \LARGE

1.4.7. Math

  • The math environment can be invoked in any of three ways:
    • \(...\)
    • $...$
    • \begin{math} ... \end{math}
  • The displaymath environment, \[...\], produces an unnumbered formula.
  • The equation environment produces a numbered formula.

Example math text:

Given a class $C$ with methods $M_{1},M_{2},\dots,M_{n}$, weighted
with cyclomatic complexity $c_{1},c_{2},\dots,c_{n}$, respectively, the metric
is computed as \[WMC(C) = \sum_{i=1}^{n} c_{i}\]
% ...
Given a class $C$ with a set of base classes $BC$, the metric is computed as
\[DIT(C) = \left\{ \begin{array}{ll}
                     0 & \mbox{if $|BC| = 0$} \\
                     max(\{DIT(B_{i}): B_{i} \in BC\})+1 & \mbox{if $|BC| > 0$}
                   \end{array}
           \right.\]

See wikibooks.org for more detail.

1.4.8. Positioning and formatting

  • Positioning floats:
    h
    Here: at the current position in the text. (Not possible for double-column figures and tables in two-column format.)
    t
    Top: at the top of the text
    b
    Bottom: at the bottom of the text (Not possible for double-column figures and tables in two-column format.)
    p
    Page of floats: on a separate page containing only figures and tables
  • Newlines are inserted with `//'.
  • New pages (columns in twocolumn) are created with `\newpage'.
  • Vertical space may be added:
    \vspace{5mm}
    
  • Vertical space may be removed:
    \vspace{-2.5mm}
    
  • Horizontal space may also be added/removed:
    \hspace{3.5mm}