Davis Advanced RF Technologies Lab

Home | People-Openings | Teaching | Research-Publications | Outreach | Facilities | Resources | Blog |

News

» [10 Apr 2019] » Dr. Xiaomeng Gao receives the Best Young Professional Paper Award at WAMICON2019
» [01 Feb 2019] » DART Lab to Advance to Phase 3 of the DARPA SPAR Program
» [23 May 2018] » Songjie Defended his PhD Degree
» [20 Jan 2018] » DART Lab to Advance to Phase 2 of the DARPA SPAR Program
» [07 Mar 2017] » DART Lab Awarded NSF STTR Phase II Project on Developing a Radar-based Wearable Heart Health Monitoring Device
» [08 Nov 2016] » DART Lab to Participate in DARPA SPAR program

email | GitHub

Refer to the Wikipedia entry for basic information on LaTeX. Some great introductory tutorials on LaTeX include The Not So Short Introduction to LaTeX2e by Tobi Oetiker and the LATEX Tutorials – A PRIMER by the Indian Tex User Group. The LaTeX Wikibook is also a great start point. Intermediate level users may find “Guide to LaTeX: Tools and Techniques for Computer Typesetting” by Helmut Kopka and Patrick W. Daly useful. For users of all levels, the LaTeX Stack Exchange site is always a great resource.

LaTeX editors

Our group has been using ShareLaTeX, which has now merged with Overleaf, for collaboratively editing LaTeX documents. Compared to a local installation of LaTeX, ShareLaTeX (Overleaf) is not as fast and there is usually noticeable delays in generating the output file. However, its collaboration features, such as shared editing, commenting, and track changes, makes ShareLaTeX a great tool for drafting documents together with a group of people. Being an online tool, it also saves the trouble of installing the LaTeX distribution and ensures that everyone is working with the same setup.

When documents have to be edited locally, we use Texstudio as the editor and TeX Live as the distribution.

LaTeX Templates

Perhaps the best way to get started in LaTeX is to use a template.

When you are submitting an academic manuscript, be sure to check the conference or journal website for their designated templates.

Document Structure

Creating an empty page

Source: http://nw360.blogspot.com/2007/10/creat-empty-page-in-latex.html

It is necessary to use a trick when creating an empty page in Latex. The following code does the job:

\newpage
\thispagestyle{empty}
\mbox{}

The major part is \mbox{}, which ensures the existence of an empty page.

The usage of \thispagestyle is \thispagestyle{option}. The option can be:

Width, Length, Height, Indentation, and Margin

Source: TexExchange:

There are no hard-and-fast rules, but here’s a short list of guidelines:

Creating equal margins on all sides

Equal margins on all sides of a page can be easily created by using the geometry package.

\usepackage[margin=1in]{geometry}

Paragraph indentation

Put a \noindent before a paragraph to remove the indentation of that paragraph. If you want to remove indentations for all paragraphs, you can put the following in the preamble of the tex file.

\setlength\parindent{0pt}

Text

Numbers and Units

In general there should be a space between a number and it’s corresponding unit. This space is shorter than a typical space between words. In LaTeX, this can be implement by “number\,unit”. Sometimes it is also acceptable to use “number~unit”. The “~” creates a typical space, which is longer than the “\,”.

A better alternative is to use the siunitx package. The manual of the package can be found here

%formatting numbers
\num{12345,67890}               %comma represents the decimal point; siunitx also adds the proper spacing for tens and hundreds of thousands
\num{1+-2i}                     %complex numbers
\num{.3e45}                     %with exponentials
\num{1.654 x 2.34 x 3.430}  %multiplication sign

%angles
\ang{10}
\ang{12.3}
\ang{4,5}
\ang{1;2;3}                 %arc format: degree;minute;sec
\ang{;;1} \\

% units
\si{kg.m.s^{-1}}
\si{\kilogram\metre\per\second}
\si{\degreeCelsius}             %degree Celsius

%numbers and units
\SI{100}{\micro\metre}

%list and range
\numlist{10;20;30}
\SIlist{0.13;0.67;0.80}{\milli\metre}
\numrange{10}{20}
\SIrange{0.13}{0.67}{\milli\metre}      %\meter can also be used.

Line spacing in enumerate and itemize environment

Use the enumitem package. The manual for the package can be found here

\begin{enumerate}[itemsep=-2mm]
    \item xxx
    \item xxx
\end{enumerate}

Custom label in enumerate and itemize environment

Again, use the enumitem package. There are several options to choose from: \alph, \Alph, \arabic, \roman, and \Roman*.

\begin{enumerate}[label=\alph* )]

In-line list

Use the enumerate* and itemize* environments in the enumitem package. The inline option needs to be enabled in the enumitem package.

\usepackage[inline]{enumitem}

Indentation in enumerate environment

Source

\newcommand{\indentitem}{\setlength\itemindent{25pt}}

\begin{enumerate}
\item This item is not indented
{\indentitem \item This item is indented}
\item This item is not indented
{\indentitem \item This item is indented}
{\indentitem \item This item is indented}
\item This item is not indented
\end{enumerate}

Hyphen, En Dash, Em Dash, …

-              %Hypen: refer to http://owl.english.purdue.edu/owl/resource/576/01/
--             % En Dash: for indicating a closed range of values, e.g. 1987-1992, or a relationship, e.g. "Score: 96-100"
---            % Em Dash: used to separate or shift thoughts midstream through a sentence

For more information on the use of hyphen, en dash, and em dash, refer to http://thegrammargang.blogspot.com/2012/07/dash-it-all-whats-point-of-hypen-help.html

Strike through text

Striking through texts using a horizontal line can be achieved by using the soul package.

\usepackage{soul}
...
\st{text to strike through}

Math

Upright bold symbols

By default, the \mathbf command does not generate upright bold font for Greek alphabets, which are often used to denote matrices. Use the bm package for this purpose.

\usepackage{bm}
...
$\bm{\Phi}$

Center-aligned equations

Use the gather environment (included in the amsmath package) to generate a set of equations that are center aligned.

Using multiple [ ] can generate center aligned equations without equation numbers.

Tables

Multi-page Tables

Use package longtable. Here is one example.

Adding notes to table

Use the threeparttable package. Below is an example. Source: http://tex.stackexchange.com/questions/12676/add-notes-under-the-table

\begin{table}
  \begin{threeparttable}
    \caption{Sample ANOVA table}
     \begin{tabular}{lllll}
      \toprule
        Stubhead & \( df \) & \( f \) & \( \eta \) & \( p \) \tnote{$\dagger$} \\
      \midrule
        & \multicolumn{4}{c}{Spanning text} \\
        Row 1 & 1 & 0.67 & 0.55 & 0.41 \\
        Row 2 & 2 & 0.02 & 0.01 & 0.39 \\
        Row 3 & 3 & 0.15 & 0.33 & 0.34 \\
        Row 4 & 4 & 1.00 & 0.76 & 0.54 \\
      \bottomrule
    \end{tabular}
    \begin{tablenotes}
      \small                    %optional
      \item [$\dagger$] This is where authors provide additional information about
      the data, including whatever notes are needed.
    \end{tablenotes}
  \end{threeparttable}
\end{table}

Figures

Inserting Figures

The following code works both for LaTeX and pdfLaTeX for inserting figures.

\begin{figure}[t]
    \centering
        \includegraphics{FigureFileName}
        \caption{Caption}
        \label{fig:label}
\end{figure}

Note that an extension for the figure file name is not specified. When using pdfLaTeX, save the file with extension .pdf; when using LaTeX, save the file with extension .eps.

Also it is very important that the \label command be placed immediately after the \caption command. Otherwise the \ref command would reference the last reference-able object, which is often the section label or the previous figure. Putting the \label command consistently before the \caption can be a dangerous practice that may completely disrupt your figure references.

Changing Font Size in Caption

Use the caption package.

\usepackage[font={small,it}]{caption}           % font size can be "large, small, footnotesize, scriptsize,etc"

Wrap Text Around Figures

Use the wrapfig package.

\begin{wrapfigure}{r}{2.4in}            %"r" indicates right aligned. It is also important that the width be set to the actual width of the figure
   \begin{center}
     \includegraphics{figure}
   \end{center}
   \caption{Caption.}
\end{wrapfigure}

Adjusting the space around figures/floats

Direct application of the wrapfigure environment often results in excessive white space above the figures. The following trick can be used to adjust the spacing.

\begingroup
\setlength\intextsep{-3pt}

\begin{wrapfigure}{r}{3.2 in}            %"r" indicates right aligned
   \begin{center}
     \includegraphics{trends}
   \end{center}
   \caption{The trend and projection of chip-to-chip communication data
   bandwidth and the number of pins over the time. Data from D. Huang, IEEE HSD
   Workshop, Santa Fe, 2011~\cite{huang2011}}
   \label{fig:trends}
\end{wrapfigure}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\endgroup

Note that the group includes the wrapped figure and some texts. The text must exceed the vertical span of the figure, otherwise the following paragraph will intrude into the figure.

Side-by-side Figures

\begin{figure}
\centering
\begin{minipage}{.5\textwidth}          %alternatively, this could be //\minipage{0.5\textwidth}//
    \centering
    \includegraphics[width=.85\linewidth]{figure1}
    \captionof{figure}{Caption 1.}
    \label{fig:1l}
\end{minipage}                          %alternatively, this could be //\endminipage//
\hfill                                      % distribute the two minipages evenly. This has the effect of creating a small gap between the figures if set properly.
\begin{minipage}{.5\textwidth}          %[IMPORTANT]: there shouldn't be a blank line between the two //minipage// environments
    \centering
    \includegraphics[width=.8\linewidth]{figure2}
    \captionof{figure}{Caption 2.}
    \label{fig:2}
\end{minipage}
\end{figure}

Figure in tables

We can insert figures in tables (see example below, from http://texblog.org/2008/02/04/placing-graphicsimages-inside-a-table/), however the figures placed in tables won't get numbered and won't appear in the automatically generated list of figures.

\begin{table}[ht]
    \caption{A table arranging images}
    \centering
    \begin{tabular}{cc}
        \includegraphics[scale=1]{graphic1} &   \includegraphics[scale=1]{graphic2}\\
        \newline
        \includegraphics[scale=1]{graphic3}&\includegraphics[scale=1]{graphic4}\\
    \end{tabular}
    \label{tab:gt}
\end{table}

Bibliography

Hiding references

The \nobibliography{bibfile} command allows you to generate citations via Bibtex without creating a “References” section at the end of your document. This command is enabled by the bibentry package.

Useful references on LaTeX

Math into LaTeX The Comprehensive LATEX Symbol List