2010年10月21日 星期四

[轉錄]Latex image inside table

Pictures do not necessarily have to be placed inside the figure environment, but can perfectly be included inside table cells.

The advantage is, you can without any effort arrange a series of images in a matrix and individually scale them.

And here is how you would do it: You first need the graphicx package to include graphics:

\usepackage{graphicx}

Now you can directly start with your table environment and add graphics:

\begin{table}[ht]

\caption{A table arranging images}
\centering
\begin{tabular}{cc}
\includegraphics[scale=1]{graphic1}&\includegraphics[scale=1]{graphic2}\\
\newline
\includegraphics[scale=1]{graphic3}&\includegraphics[scale=1]{graphic4}\\
\end{tabular}
\label{tab:gt}

\end{table}%

Note: In order to have visual borders, you would have \hline instead of \newline and use horizontal bars in the column definition of the tabular environment (“|c|c|” instead of “cc”).

The downside of this technique is obvious, you do not have access to features provided by the figure environment like a label or caption. Nevertheless, it might still come in handy in certain situations.

Note: The figures will not appear in the \listoffigures index, for the reason mentioned above.

0 意見:

張貼留言