Tuesday, January 21, 2014

How to change fonts in beamer equations

For a long time it was really annoying that the default fonts for the beamer template is just not right. I wanted to have the default fonts back for the equations, that look the same as in articles. Then I found this:

http://tex.stackexchange.com/questions/41572/setting-math-fonts-in-beamer

The solution that was working best for me was:
\usefonttheme[onlymath]{serif}

Monday, December 16, 2013

how to write naiive

na\"\i ve

 Works for me

How to number several equations with one number

\begin{eqnarray} 
 \begin{array}{rl}
    &x = foo \\
    & y = bar
 \end{array}
\end{eqnarray}
 I sometimes get that I should not use eqnarray that extensive, but it works for me.
Another solutions with equation and aligned environments here.

Tuesday, October 15, 2013

diff LaTeX documents

This is a great stuff to diff latex docs:

http://www.ctan.org/tex-archive/support/latexdiff

you might also be able to install it for your ubuntu for instance using

$ sudo aptitude install latexdiff

Usage:

$ latexdiff old.tex new.tex > diff.tex

This will create a new file called diff.tex, which is a valid LaTeX document countaining the difference between the two, if old.tex and new.tex were also valid LaTeX docs, and you can proceed diff.tex as you normally would creating eps, pdf, html, etc ...

If you don't want to or can't install the tool, it's available online here:
http://3142.nl/latex-diff/

If you are using version control like svn or cvs, you might consider using the latexdiff-vc command, that actually makes the diff from the version in the version control. More resources about this you can find at the links below:

http://kwtrnka.wordpress.com/2010/11/28/latexdiff-version-control/  

http://www.jwe.cc/2012/02/workflow-with-subversion-and-latex/ 

For example I use

 $ latexdiff-vc --svn -r <oldversion> --pdf <mylatex.tex>
in order to generate pdf diff in one step

Tuesday, August 27, 2013

How to convert latex to M$ office / openoffice readeable

The easiest and best solution I found so far to do this (under linux) is the method on
http://ubuntuforums.org/archive/index.php/t-1033441.html
Using htlatex

latex foo.tex
latex foo.tex
latex foo.tex
htlatex foo.tex
 This then will create a relatively good looking html, that can be read under soffice for instance and convert to doc / docx, etc...
This converts the equations to figures, and the layout could be better, but it works fine.

Another option is to use the  tex2rtf package
http://www.ctan.org/pkg/tex2rtf
This one generates an .rtf file, but the result on my files were not that good, and the equations were a disaster, and can not handle eps figures (pslatex)...

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...