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

Monday, October 22, 2012

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.