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

Wednesday, May 23, 2012

How to use multiple .bib files

Bibtex files are countaining references. In some cases we would like to use multiple .bib files, these we can simple enumerate in the  \bibliography command
as

\bibliography{file1,file2}
where file1.bib and file2.bib contain the references

Monday, May 21, 2012

How to write different cases in equations

Many times we need to write different cases like      
a= {0.6 if t <= 100
      {0.9 it t > 100
The easiest, and most elegant way to do this is to use \case command, as
 $a = \begin{cases}
     0.6, & \textnormal{if } t\le100 \\
     0.9 & \textnormal{if } t>100
\end{cases}$

Thursday, May 17, 2012

How to write sum in the equations

The easiest way to write a sum of an expression (i=[1 .. n]) in equations is
$\sum_{i=1}^n expression$
Note that in inline code this will put lower and upper bound next to the sum sign, not over and under. To  display lower and upper bound under and over the sum sign use the \displaystyle command before the sum.

To specify directly that the upper and lower bound are over and under the sum symbol, simply write
$\sum\limits_{i=1}^n expression$

Wednesday, May 16, 2012

How to write fraction

I usually use the \frac command as

$x = \frac{numerator}{denominator}$

This will render numerator over the denominator, alternatively in inline codes \dfrac can be used instead from the amsmath package with the same syntax.

How to write mathematical symbols

A fairly good description about the topic can be found here:
http://amath.colorado.edu/documentation/LaTeX/Symbols.pdf

Write normal (gaussian) distribution in LaTeX

To imply that a random variable v is distributed according to the normal distribution with mean m and covariance sigma^2 write

\usepackage{amssymb}

$v \sim \mathcal{N} (m,\sigma^2)$

note that the package amssymb is needed in order to use \mathcal

Friday, May 4, 2012

Collaborative editing

My first guess for collaborative editing was googledocs with latexlab as described here.
But this in my opinion has serious privacy issues.

Some other ideas are text tracking systems, like svn or git as back-end. A collection of possible methods can be found here.

However this topic is still unresolved.

Update: there are two main alternatives for online collaborative editing:
  • Sharelatex
  •  Overleaf

Thursday, April 12, 2012

How to place figures / images inside a table

Figures and images can be placed within tables, but even into other environments, or without environment. A good description is available here:

http://texblog.org/2008/02/04/placing-graphicsimages-inside-a-table/

Thank you J. !

Tuesday, April 10, 2012

How to use subtitle in an article

Make use of the \subtitle command, to do this use scrartcl document class,
and if you want the same fonts as at the article class,
also set them accordingly with \setkomafont
 
\documentclass{scrartcl}
\setkomafont{disposition}{\normalfont\bfseries}

\begin{document}

\title{(Title)}
\subtitle{(Subtitle)}
\author{(Author)}
\maketitle
\end{document}

Friday, March 30, 2012

How to embed fonts in your document

Sometimes you need font types embedded into your document, here is a good solution:

http://mohamednabeel.blogspot.pt/2009/10/fixing-font-not-embedded-issue-to-pass.html

Since I personally use kile to edit LaTeX documents, I process normally to create the .dvi, and then I use the commands

> dvips -Ppdf -G0 -tA4 file.dvi

> ps2pdf -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress file.ps file.pdf

Monday, March 26, 2012

How to link webpages from latex

Use the hyperref package as:
 
\documentclass{article}
\usepackage{hyperref}
\begin{document}

Here's a link to \href{http://webpage.com}{text}.

\end{document}
 
See at http://www.johndcook.com/blog/2008/11/24/link-to-web-pages-from-latex-pdf/
 or
 http://en.wikibooks.org/wiki/LaTeX/Hyperlinks

How to create matrices

Generally the easiest way is:
$
  L = \left[
    \begin{array}{cc}
       x & y \\
       z & w
    \end{array} \right]
$
A good reference about the topic can be found here:

http://www.rizauddin.com/2009/05/how-to-create-a-matrix-in-latex/

An even easier way to do this is to use pmatrix as
$
  \begin{pmatrix}
     x & y \\
     z &  w
  \end{pmatrix}
$
 However this latter will always put the matrix inside round  parenthesis.