[texhax] (Fwd) Re: Vertical alignment in table containing text

hh hh-brasil at bol.com.br
Mon Sep 21 18:01:12 CEST 2009



Forget table-environment and try something like this:

\begin{minipage}[t]{.59\textwidth}
\vspace*{0pt}

Lorem ipsum dolor sit amet, consect wisi enim ad minim veniam, quis 
nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea 
commodo consequat. Lorem ipsum dolor sit amet, consectetuer adipiscing 
veniam

\end{minipage}\hfill
\begin{minipage}[t]{.4\textwidth}
\vspace*{0pt}

\includegraphics[width=0.4\textwidth]{007985029-1.jpg} 

\end{minipage}

hh

Date sent:      	Mon, 21 Sep 2009 14:18:48 +0100
From:           	Henry Law <news at lawshouse.org>
To:             	texhax at tug.org
Subject:        	[texhax] Vertical alignment in table containing text 
and figures

> (I posted this to comp.text.tex yesterday; I hope there's not too much 
> overlap in the readership from there and here.)
> 
> As part of a reference book I need to format a series of pictures with 
> explanatory text.  I plan to do it using a table of two columns: #1 has 
> the text, #2 the image and they divide the line 60:40.
> 
> I've used the "array" package for the table and a \parbox for the text.  
> I've almost cracked it, except for the vertical alignment. If the 
> explanatory text is deeper than the image, I want the image at the top 
> of the cell; similarly if the text is brief then I want it too at the 
> top of the cell; whereas everything I do comes out with the smaller of 
> the two _bottom_ aligned (as shown in 
> http://www.lawshouse.org/tex/Alignment.jpg).
> 
> Surely this should be easy to do?  It's the default behaviour in WP 
> packages like OpenOffice and MS Wierd.  Can someone help me fix my code, 
> or else suggest an alternative, sure-fire way of doing it?
> 
> My sample file is at http://www.lawshouse.org/tex/array.tex and the 
> images it uses are http://www.lawshouse.org/tex/mary-rose.jpg and 
> http://www.lawshouse.org/tex/007985029-1.jpg but here's the code (which 
> may be wrapped).
> 
> \documentclass[a4paper,12pt]{book}
> 
> \usepackage{graphicx}
> \usepackage{array}
> 
> \begin{document}
> 
> \begin{tabular}{|>{\raggedright}b{0.6\textwidth}|>{\centering}b{0.4\textwidth}|} 
> 
>   \hline
>   \parbox{0.6\textwidth}{Lorem ipsum dolor sit amet, consect wisi enim 
> ad minim veniam, quis nostrud exerci tation ullamcorper suscipit 
> lobortis nisl ut aliquip ex ea commodo consequat. Lorem ipsum dolor sit 
> amet, consectetuer adipiscing veniam} \\
>  & \includegraphics[width=0.4\textwidth]{mary-rose.jpg} \tabularnewline
>   \hline
>   \parbox{0.6\textwidth}{Lorem ipsum dolor sit amet, consect wisi enim 
> ad minim veniam, quis nostrud exerci tation ullamcorper suscipit 
> lobortis nisl ut aliquip ex ea commodo consequat. Lorem ipsum dolor sit 
> amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod 
> tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad 
> minim veniam Lorem ipsum dolor sit amet, consectetuer adipiscing elit, 
> sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam 
> erat volutpat. Ut wisi enim ad minim veniam} \\
>   & \includegraphics[width=0.4\textwidth]{007985029-1.jpg} \tabularnewline
>   \hline
> \end{tabular}
> 
> \end{document}
> 
> The images are Copyright © 2009 BBC; I scrounged them for testing.
> 
> -- 
> 
> Henry Law            Manchester, England 
> 
> 
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
> 
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org


------- End of forwarded message -------


More information about the texhax mailing list