Thursday, April 12, 2007

Latex note: more on making EPS graphs from MS Office

Please see my previous article about how to generate an eps chart from from MS Excel.

You can also insert Word pictures into eps. The mechanism is the same as Excel. First, make an empty word document or page to draw the vector graphs. Then print the page, using general eps printer. Lastly, modify the page bounding box of the eps file so that it fits the graph.

There is one thing to notice though: the coordinate counts from bottom left to top right! If the four numbers represent top left and bottom right, the picture will still show in latex document, but it will be sqeezed together with text because the size is below zero!

Latex note: use minipage to align a figure of text to center, while keeping text aligned to left

Sometimes we need to align text with multiple lines to the center of page.

\begin{figure}[t]
\centering
this is first line \\
\hspace*{0.5cm} this is second line \\
this is third line \\
this is fourth line
\caption{caption}
\label{l}
\end{figure}

The above may not work because all lines are aligned to center, and they look messy on the left border. The solution is using a minipage to align text inside figure.

\begin{figure}[t]
\centering
\begin{minipage}[t]{0.5\textwidth}
this is first line \\
\hspace*{0.5cm} this is second line \\
this is third line \\
this is fourth line
\end{minipage}
\caption{caption}
\label{l}
\end{figure}

Wednesday, April 11, 2007

Latex note: protect citations in caption

\caption{xxx \cite{yyy}} won't work, it won't compile with latex sometimes.

use \caption{xxx {\protect \cite{yyy}}} instead.