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

How to write Ordo for complexity in latex

Ordo (or the big-O notation) is used to describe computational complexity, in technical writing. I found the best way to write it is 
$\mathcal{O}(x^2 + ...)$

How to use .tiff figures in MATLAB

Well, I was digging deep, and this issue does not seem to be solved :(
The best thing to do is to use png, pdf or eps instead.
When using linux the imagemagick package can be used for example as

$ convert myfile.tif myfile.pdf

Multirow and multicolumn tables

Joining rows and columns  in LaTeX tables is really easy using the multirow package. For details see

http://en.wikibooks.org/wiki/LaTeX/Tables


http://www.andrewjpage.com/index.php?/archives/43-Multirow-and-multicolumn-spanning-with-latex-tables.html

Thursday, January 31, 2013

Writing signature in latex documents

Some documents need to be signed by hand, leaving an empty line for the signature and writing the name underneath here is  the solution that worked for me:

First define a new command at the beginning of your document as
\newcommand{\signature}[2][5cm]{
  \begin{tabular}
  {@{}p{#1}@{}}
    \hrule \\[0.05cm]
    \centering{#2}
  \end{tabular}
}

Then use it at the end of the document for instance as

 \flushright\noindent \signature{Firstname Lastname}



Tuesday, December 11, 2012

How to use reference (cross-links) by their names

There are many ways to do this, see e.g. here:
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=nameref

The way that works for me is the nameref command from within hyperref package. One possible usage is:
\section*{foo}
\label{sec:foo}
...
\nameref{sec:foo}

Monday, December 10, 2012

How to create an empty page in your document

Sometimes we need empty pages in our document, the easiest way to do this is:
\newpage
\mbox{}
\newpage

Also if different style to the empty page is needed the following code is working:
\newpage
\thispagestyle{empty}
\mbox{}
\newpage

 Source: http://nw360.blogspot.pt/2007/10/creat-empty-page-in-latex.html