LaTeX Tip of the Day – LaTeX logo

January 29th, 2009

On the web, we write LaTeX (lay-tech) with that goofy (and cumbersome) capitalization to distinguish it from regular old latex (lay-tecs), even though google makes no distinction. The proper way to represent LaTeX in a LaTeX document is with the command \LaTeX (make sure you use the goofy capitalization and the beginning slash), which produces:



This isn’t strictly required, but it makes things look more professional.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon

Typesetting , ,

LaTeX Tip of the Day – dashes

January 26th, 2009

There are four dashes commonly used in type:

A minus sign is used in math expressions:$3-2=1$



An em-dash is the same width as the point size of font, and it’s what you usually want for punctuation, produced with – - – (three hyphens, no spaces):



An en-dash is half the width of an em-dash, is used for ranges of things, and is produced with – - (two hyphens, no spaces):



Last, the hyphen. This is what everyone using word processors gets when they want the other three (and it’s what the key on your keyboard produces). A hyphen is used to join words, and is produced with -:



Learn more at Wikipedia.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon

Typesetting ,

LaTeX Tip of the Day – \text{}

January 23rd, 2009

In math mode, to get roman text (not italicized), use the command text{}. This is useful for units, which should always be set in a roman font:



The \text{} command is also useful (actually necessary) for sub- and superscripts which are whole words or abbreviations:

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon

Typesetting , ,

Quick LaTeX reference

November 16th, 2008

Sometimes it’s nice to have an easily accessible reference for the most-used features in the LaTeX typesetting system. Here are a few examples I’ve had to use most often.

LaTeX Code

Result

Notes

{\tiny tiny text} Enclose all the text you want at this size in brackets, or switch back to the default size manually
{\scriptsize scriptsize text}  
{\small small text}  
{\normalsize normalsize text} Default
{\large large text}  
{\Large Large text} Note the capitalization
{\LARGE LARGE text}  
{\huge huge text}  
{\Huge Huge}  
\`a \'a \H a \^a \v a \c a \.a \d a \= a \b a \~ a \t aa  
\AA\,\AE~\OE\quad\O\\ \aa\,\ae~\oe\quad\o This shows off some of the whitespaces in LaTeX – \, ~ and \quad
\textrm{Roman} Default
\emph{Emphasized}  
\textbf{Boldface}  
\textsf{Sans serif}  
\textsc{Small Caps}  
\texttt{Typewriter}  
\begin{itemize}\item First item \item Second item \begin{itemize} \item Subitem \end{itemize}\end{itemize} You can nest lists up to 4 deep
\begin{enumerate}\item First item \item Second item \begin{enumerate} \item Subitem \end{enumerate}\end{enumerate} You can nest lists up to 4 deep
\begin{tabular}{l | c r} \hline \hline a & b & c \\ $d^n$ & e\'e\"e & ff ffi \\ \hline \end{tabular} The arguments to \begin{tabular} are l for left alignment, | (capital \) for a vertical line, c for center alignment, and r for right alignment. The command \hline makes a horizontal line. \\ ends the current row and begins the next (this command also begins a new line in regular text), and & separates cells within each row.

Math Mode

   
\sqrt[n]{a^2+b^2} Optional arguments go in square brackets
\int_0^\infty \cos x\,dx sine, cosine and other special functions have a special call
\sum_{m=-\infty}^\infty \frac{\alpha^m}{m!} If you need more than one character in a super- or subscript, or any other environment, enclose it in brackets
\alpha \beta \gamma \delta \epsilon \theta \phi \pi \omega \\ A B \Gamma \Delta E \Theta \Phi \Pi \Omega Some uppercase greek letters are the same as roman uppercase letters – they don’t get a special command
\hbar \pm \hat x \sim\vec x \leq \dot x \gg \ddot x \\ \Box \cdot (\nabla \times \vec B) \rightarrow 180^\circ  
\left\langle \frac{1}{2}\right\} \cdot \left[ \prod_g^\infty \left(b_2\right)\right. The \left and \right commands make brackets that scale with the height of what's between them. Note the slash before curly brackets, and that a period makes a blank bracket. For angle brackets, use \langle and \rangle instead of < and >

To enter math mode, enclose the statement between dollar signs:

The Pythagorean theorem,$\c=sqrt{a^2+b^2}$,is wonderful.

for example, produces the following:
$$\text{The Pythagorean theorem, }c=\sqrt{a^2+b^2}\text{, is wonderful}$$

If you want the math to be typeset on its own line, enclose it within

\[...\]  or $$...$$

For example,

The Pythagorean theorem, \[c=\sqrt{a^2+b^2},\] is wonderful. 

produces the following:

The equation is now center aligned in the document, and has whitespace around it to set it apart from the text.

The above is by no means comprehensive. For more depth, see the following:

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon

Typesetting ,