Tuesday, May 13, 2008

Managing the layout of figures in Latex

The placement of figures in your Latex document can sometimes be painful. I have recently started using the tabular environment to manage the layout of my figures in Latex documents. The idea is similar to using tables to manage layouts in html documents (before the popularity of CSS).

Here is an example:

Option 1:

\begin{figure}
\begin{center}
\begin{tabular}[c]{cc}
\begin{tabular}[c]{c}
%% Put figure (a) here
\end{tabular} &
\begin{tabular}[c]{c}
%% Put figure (b) here
\end{tabular} \\
(a) & (b) \\
\end{tabular}
\end{center}
\end{figure}


The above will result in a two-column layout for the sub-parts of a figure. An easier alternative is not to have the nesting in the tabular environment and just have the following.

Option 2:

\begin{figure}
\begin{center}
\begin{tabular}[c]{cc}
%% Put figure (a) here
&
%% Put figure (b) here \\
(a) & (b) \\
\end{tabular}
\end{center}
\end{figure}


When the sub-figures are of the about the same size, option 2 works great. But when the sub-figures have different sizes and you want to align the figures a particular way then using option 1 gives more control. The other advantage of using Option 1 is that you can take the nesting of the tabular environment as far as you like. Consider this variation on option 1:



\begin{figure}
\begin{center}
\begin{tabular}[c]{cc}
\begin{tabular}[c]{c}
%% Put figure (a)_0 here & Put figure (a)_1 here \\
\end{tabular} &
\begin{tabular}[c]{c}
%% Put figure (b) here
\end{tabular} \\
(a) & (b) \\
\end{tabular}
\end{center}
\end{figure}





In the above example we have added two figures in the first column
while we just have a one figure in the second column. Note that this
same result can be achieved using \multirow and \multicolumn within
one tabular environment. The explicit tabular environment is more
intuitive for me and makes it easier to visualize and design the
layout.

4 comments:

Your project manager said...

Useful tips - thanks!

Your project manager said...

Useful tips - thanks!

Ganesh

marry said...

Blogs are so informative where we get lots of information on any topic. Nice job keep it up!!
_____________________________

Literature Review

Dissertation Writing service said...

This kind of information is very limited on internet. Nice to find the post related to my searching criteria. Your updated and informative post will be appreciated by blog loving people.

Buy Dissertation Online