Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you vertically center text with an image in a LaTeX table?

I want to align text with the center of a large image in LaTeX. Unfortunately, the text some text is aligned with the bottom of the image:

\begin{tabular}{cc}
    some text & \includegraphics{image_name.eps}
\end{tabular}

I've found a website that recommends using m{width of the cell} instead of c for that column in the table, but it hasn't worked.

\begin{tabular}{m{1in}c}
    some text & \includegraphics{image_name.eps}
\end{tabular}

I'm sure a latex pro would look at this and know what to do! Which implies that I cannot be a LaTeX pro until you teach me...

like image 413
user Avatar asked Jan 03 '11 01:01

user


People also ask

How do I center text and image in LaTeX?

We center text or images using \begin{center} and \end{center}. Just put \begin{center} when you want to start centering, and \end{center} when you want to stop centering.

How do I center text vertically in a table?

Select the text that you want to center. in the Page Setup group, and then click the Layout tab. In the Vertical alignment box, click Center. In the Apply to box, click Selected text, and then click OK.

How do you align text in a table in LaTeX?

You can also use r to align the text to the right and l for left alignment. This will insert a horizontal line on top of the table and at the bottom too. There is no restriction on the number of times you can use \hline . Each & is a cell separator and the double-backslash \\ sets the end of this row.


1 Answers

You can use minipages to align your text with the image:

\begin{minipage}[c]{0.25\textwidth}
Text comes here
\end{minipage}
\begin{minipage}[c]{0.25\textwidth}
\includegraphics{image_name.eps}
\end{minipage}

It´s not really a table, and you must specify the width of the minipages, but it may work for you.

like image 51
Emilio Silva Avatar answered Oct 15 '22 12:10

Emilio Silva