Graphics, Figures & Tablesaligning figures and text inside a table cell

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
pear
Posts: 1
Joined: Tue Mar 16, 2010 4:49 am

aligning figures and text inside a table cell

Post by pear »

Hi all,
I need to align the figures in one column and text to the near by columns of a table to the appropriate cell centers. I face a problem in aligning my figures to the cell center and also the text are not aligned to the appropriate cell centers. Please refer the (alignment_query.pdf) for more details.

Code: Select all

\begin{table}[ht]
 \centering
 \begin{tabular}{|c||p{1.5in}|c|c|c|}
 \hline 
 Unit cell & Lattice & Glide Planes & Glide directions & Glide system \\
 \hline 
 \includegraphics[scale=0.25]{./fig/ch2-fig6.jpg} & bcc(Li, Cr, Nb, Mo, \alpha-Fe, \beta-Ti) & (111)             & [101]                 & 4*3 = 12\\
 \hline 
 \includegraphics[scale=0.25]{./fig/ch2-fig7.jpg} & fcc(Al, Ni, Cu, Ag, Pt, Pb, \alpha-Fe)   & (101) (112) (123) & [111]                 & 6*2 = 12 \\
 \hline 
 \includegraphics[scale=0.25]{./fig/ch2-fig8.jpg} & hcp(Be, mg, Co, Zr,\alpha-Ti)            & basal planes      & 
 principle axes & 1*3=3 \\
 \hline 
 \end{tabular}
 \label{tab:gt}
 \caption{A table arranging images}
\end{table}
please help me.
alignment_query.pdf
(118.86 KiB) Downloaded 223 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

yoyoimut
Posts: 120
Joined: Mon Oct 19, 2009 6:58 am

aligning figures and text inside a table cell

Post by yoyoimut »

Try modify the following code snippet until it suits your scenario.
It works almost perfectly.

Code: Select all

\documentclass{book}
\usepackage[draft]{graphicx}
\usepackage{array,longtable}

\begin{document}
\newcolumntype{A}{>{\begin{minipage}[c][7cm][c]{6cm}\centering\arraybackslash}m{6cm}<{\end{minipage}}}
\begin{longtable}{|A|c|c|}\hline
\fbox{\includegraphics[height=4.5cm]{sample}} & sample.eps 					& something\\\hline
\rule{4cm}{4cm} 															& rule of 4cm by 4cm 	& something \\\hline
\end{longtable}
\end{document}
Post Reply