Thursday, June 28, 2012

Write comments in LaTeX

Normally comment is written in LaTeX with '%'. This rather suggested for short, one line comments, because the effect is only valid till the end of the line. If you would like to comment an entire block, it's more convenient to use the verbatim package as

\usepackage{verbatim}
 ...

\begin{comment}
  ...
  commented text
  ...
\end{comment}

Friday, June 22, 2012

How to refer to sections

Use \label to add label to a section and \ref to refer to it.

\section{Greetings}
\label{sec:greetings}
 
Hello!
 
\section{Referencing}
 
I greeted in section~\ref{sec:greetings}.
 see http://en.wikibooks.org/wiki/LaTeX/Labels_and_Cross-referencing for more detils

Thursday, June 21, 2012

How to make references to equations

To have correct references of the same form to the equations use the \autoref{} command from within the hyperref package. This will also creat hyperlinks within the document into the referred equations.

Tuesday, June 19, 2012

How to leave open parenthesis in equations

If you use \left( and \right) the syntax checker will not allow you not to close (or not to open) the parenthesis. To get your LaTeX code correct you have to use \left. or \right. to have it closed.

This is useful for instance when you want to add new lines with parenthesis open or write cases like 
$\left\{
   \begin{array}{l c l}
      x &\rightarrow& y \\
      z &\rightarrow& w
    \end{array}

\right.$

Monday, June 18, 2012

Sunday, June 17, 2012

Vertical spaces in equations

This might not be the most sophisticated way to do this, but it works:
simply escape the spaces using \ (backslash)
$x_{k+1}\ =\ x_k+w_k$