Wednesday, July 31, 2013

How to cite section of a paper or chapter a book

For section of a book you can add reference of type @inbook to bibtex, but for my purposes it is usually easier to cite using
\cite[section~1.1]{foo}
 this way you can for instance cite several parts / sections / chapters from the same book or paper.

Thursday, June 20, 2013

Makefile for LaTeX

Sometimes it is very useful to have standardized ways to compile documents. I use vim to edit LaTeX source, and I was looking for makefile for LaTeX for a while, when I found this project:

http://code.google.com/p/latex-makefile/downloads/detail?name=latex-makefile-2.2.0.tar.gz

Simply copy the Makefile in the directory on your linux system and type

$make
 Works perfectly for me for creating the pdf from the surce.

Monday, June 17, 2013

How to write citations on the right side on beamer

Sometimes when you cite (repeat) entire parts or figures of cited work in presentation it is advisable to write a citation on the right bottom corner  of the slide. This can be done as:
 \begin{flushright}
    \cite{mypaper}
\end{flushright}

How to make two colums horisontally on LaTeX beamer slides

The easiest way to do this is to use \column as

 \begin{columns}[cc]
 \column{0.5\textwidth}
    some content ...
 \column{0.5\textwidth}
    some more content
\end {columns}

Tuesday, April 30, 2013

How to convert all eps files to pdf in a directory

If you just want to convert a single file, you can use epstopdf <file>
as described here

Sometimes I need to convert all the eps files to pdf, for instance because I use latexpdf and I have all the images in eps. Here is a short linux bash script that does the job.


#/usr/bin/bash
for file in *.eps
do
  epstopdf $file
done

This I have in a script file in the path. Don't forget to install the ghostscript package to be able to use epstopdf command.

Or another solution is using the find command:

 $ find . -name "*.eps" -exec epstopdf {} \;

as described in  http://www.linuxquestions.org/questions/linux-newbie-8/using-multiple-epstopdf-command-854618/

Monday, April 1, 2013

How to write the set of real numbers

For an n dimensional vector I use
$\mathbb{R}^n$
Do not forget to include the amssymb or amsfonts package
Similarly \mathbb{Z} for integer, \mathbb{N} for natural and \mathbb{C} for complex and so on...

Sunday, March 31, 2013

Monday, March 18, 2013

Writing macros, defining new commands

New commands can be defined as 

\newcommand{\newtag}{your new command}
 If you would like to pass arguments to the command it is possible as
\newcommand{\newtag}[1]{your new command, your argument is {#1}}

How to change background color of enumeration

See the answer here:
http://www.latex-community.org/forum/viewtopic.php?f=44&t=13447&p=50828

Fractions in latex

The easiest way to write fractions in an equation is to use the \frac command as
\frac{a}{b}

Tuesday, March 5, 2013

Write transpose of a matrix

Transpose of a matrix (switching rows with columns), I like to write with "T" in exponent, where the exponent is not italic, like 
$A^{\rm T}$

Thursday, February 28, 2013

How to write tilde and backslash in Latex

Here is a good description about the topic:

http://tex.stackexchange.com/questions/9363/how-does-one-insert-a-backslash-or-a-tilde-into-latex