Latex

From Aicip
Jump to: navigation, search

First, check the Tex FAQ for possible answers Then, there is the catalogue that show most useful packages: http://www.ctan.org/tex-archive/help/Catalogue/bytopic.html

Installation

  • If you run some flavor of Linux, the latex package should already be included. Do a search through whatever the package management software (e.g., synaptic on Ubuntu).
  • On Windows, you can get MiKTex and WinEdt.
  • On Mac, you can get TexShop
  • For a nice cross-platform editor, I would go for Eclipse, along with this much improved Latex plugin Texlipse

Layout

  • Use fancyhdr for adding header and footer information.


  • change figure placement behavior
 \renewcommand{\topfraction}{0.85}
 \renewcommand{\textfraction}{0.1}

Formatting

Customize item label
 \usepackage{enumerate}
 \begin{enumerate}[A-1]
   \item ...
 \end{enumerate}

And now the itemized list will be label with A-1, A-2, A-3 ...etc.


Common packages (using Times as default)
\usepackage{setspace}
\usepackage{mathptm}
\usepackage{fancyvrb}
\usepackage{url}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage[body={6.5in, 9.0in},left=1.0in, nohead]{geometry}
\fvset{fontsize=\small}
Put watermark text such as draft

you can use draftwatermark, which works well with pdflatex, while the traditional way of using draftcopy does not.

 \usepackage{draftwatermark}
 \SetWatermarkScale{0.5}

The second line here is to scale down the draft size in half. I think the default size is a bit intrusive on the viewing.

Strike through text
 \usepackage{ulem}
 \sout{will do my best}
Include verbatim text
 \usepackage{verbatim}
 \verbatiminput{/home/my/wonderful.c}

Graph


Misc

Doing word count
 detex [filename] | wc -w

Emacs and Latex

This section describes some tips and tricks for using Emacs with Latex. First, AucTeX is a nice package to have. With Ubuntu, it is available from universe; With Mac OS, you can get it here.

  • Preview
    • generate preview at the point: C-c C-p C-p