Monday, October 22, 2012

how to use landscape document mode

 \usepackage[landscape]{geometry}
\documentclass[landscape,twocolumn,letterpaper]{article}
 some more hints at
http://texblog.org/2007/11/10/landscape-in-latex/ 

Wednesday, October 10, 2012

How to put two figures next to each other

Use the minipage command, and the epsfig package e.g.

\begin{figure}[h]
  \hfill
  \begin{minipage}[t]{.45\textwidth}
    \begin{center}  
      \epsfig{file=figure1.eps, scale=0.5}
      \caption{figure 1}
      \label{fig-tc}
    \end{center}
  \end{minipage}
  \hfill
  \begin{minipage}[t]{.45\textwidth}
    \begin{center}  
      \epsfig{file=figure2.eps, scale=0.5}
      \caption{figure 2}
      \label{fig-tc}
    \end{center}
  \end{minipage}
  \hfill
\end{figure}

This, and other possible ways to put figures next to each other can be found here:
http://www.cse.iitd.ernet.in/~bagchi/latex-tips.html

Tuesday, October 2, 2012

How to write new line in LaTeX

Many LaTeX user (as myself in the past) think that the form of new line is to write
\\
Well, it works, bit it is actually not new line, but starting a new paragraph
The correct notation for new line (but not new paragraph) is
\\*

A more detailed description with many other possibilities to write new line new paragraph, new page is available at
http://www.personal.ceu.hu/tex/breaking.htm#newline

Monday, August 6, 2012

Avoid eqnarray

Some say, you should avoid eqnarray in multiline equations. There are several reasons why and how to do that, see here:
http://tug.org/pracjourn/2006-4/madsen/madsen.pdf

I personally used eqnarray a lot, and never had problems with that till now, when it just generated too much empty space before and after the equations, so I simply switched to array.

Monday, July 30, 2012

Thursday, July 19, 2012

How to force no indentation at the beginning of a new section

Use the \noindent command at the beginning of the section. This will force the first line to have no indentation at all.

Tuesday, July 3, 2012

Include figures from a separate directory

It is often a good idea to have the figures separated into a folder. This can be done using the \graphicspath command as


\graphicspath{{./mypics/}}
after the includes.
This will tell the compiler to look up the figures from the mypics directory in the document root. Don't forget to include the graphicx (or similar) package.

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$

Thursday, May 31, 2012

How to write integral from minus infinity to plus infinity in LaTeX

Lower and higher limits to integrals can be set as
$ \int^{+\infty}_{-\infty} x \, dx $

How to write argmax and argmin

$ \operatorname{arg\,max}_a f(a) \operatorname*{arg\,max}_b f(b)$

Note that the first version is more for inline code, while the second is rather for equation. Naturally, arg min is written analogously. Don't forget to use the amsmath package

For more info see
http://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics