Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to use LaTeX to create a photo directory. On a given page, I want it to have a grid of photos (which are of varying aspect ratios) with the information for that person above/below the photo enclosed in a box. I've played around with using figures, but I can't seem to get the sizing to be consistent enough to make it look like a nice grid.

Here's an example of what one of the figures looks like:

\begin{figure} \centering
\framebox[3.5in]{\LARGE Name}\\
\includegraphics[width=3.5in,height=2.345in]{image.jpg}\\
\fbox{\parbox{3.5in}{\centering Address\\
Home: PhoneNumber\\
Person1: PhoneNumber\\
Person2: PhoneNumber
}}
\end{figure}

The problem is that some of the frameboxes will be different heights because of names with letters like g and y, and then the different aspect ratios of the photos make the total size of the boxes vary.

Is there a better way to layout a grid of photos and text so the dimensions will be consistent regardless of the text in the name or the aspect ratio of the photo?

UPDATE: Combining the comments by uwe-ziegenhagen and and mike-renfro, I switched to a tabular and it seems to be working better. Also based on egreg's suggestion, I also now only specify the width or height (whichever will fill the dimension of the desired aspect ratio).

But still the row with the image in the tabular is of varying height based on the image. The "Rules and Struts" section of (http://en.wikibooks.org/wiki/LaTeX/Advanced_Topics) indicates that \rule could be used, but it leaves a large gap and then the image.

This answer said that creating a \vrule would allow for specifying the height of the row and it does, but then the image is at the bottom of the row. Is there a way to fix that?

Here's an example and I need a way to make both of the images be in the center of the tabulars that are the same height even though one has a smaller image (\rule in this example):

\newcolumntype{C}{>{\centering\arraybackslash} m{3.5in} }
\\def\\photostrut{\\vrule height 3.5in depth 0in width 0in}

\begin{tabular}{|C|} \hline
\LARGE Name \strut \\ \hline
\photostrut \rule{2.5in}{3.25in} \\ \hline
Address \strut \\
Home: PhoneNumber \strut \\
Person1: PhoneNumber \strut \\
Person2: PhoneNumber \strut \\ \hline
\end{tabular}

\begin{tabular}{|C|} \hline
\LARGE Name \strut \\ \hline
\photostrut \rule{3.5in}{2.0in} \\ \hline
Address \strut \\
Home: PhoneNumber \strut \\
Person1: PhoneNumber \strut \\
Person2: PhoneNumber \strut \\ \hline
\end{tabular}
share|improve this question
    
If the dimensions of letters are a problem, you can put a \strut here and there (for instance, at the beginning and at the end, if the text spans more than one line). (\struts are invisible, zero-width objects with height and depth of a "maximal" text line.) –  mbork Mar 31 '12 at 10:11
    
Specifying both width and height will distort the images. What kind of grid do you have in mind? And what type of alignment for rows? –  egreg Mar 31 '12 at 10:41
    
See how far paper edition of my university facebook gets you. I think it should handle figures up to a particular size, and center everything accordingly. –  Mike Renfro Mar 31 '12 at 14:50

1 Answer 1

What about using a tabularenvironment?

\documentclass{article}

\begin{document}

\begin{tabular}{|c|} \hline
Name \\ \hline
\rule{3.5in}{2.345in} \\ \hline
Home: PhoneNumber\\
Person1: PhoneNumber\\
Person2: PhoneNumber \\ \hline
\end{tabular}

\end{document}
share|improve this answer
    
This seems to be the right sort of idea, but the problem is that the images are different sizes and the table just exactly fits the image. I tried specifying the width using the tabular*, but then I couldn't get the right line to be at the edge of the table. –  Dave Johansen Apr 1 '12 at 23:20
    
A snippet from the above comment from mike-renfro allowed me to specify the width so the width was correct and the image was centered, but now the varying heights of the images cause the tabular to be varying sizes. How can I force the row with the image to be a specific height and not just fit the image? –  Dave Johansen Apr 4 '12 at 3:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.