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 have a table with images in one of the columns. My problem is that the image overlaps the horizontal line above it, making it look bad. I first tried putting a \\ after each \hline, but this causes gaps in the right most vertical line. I then tried inserting \newline in each cell containing an image, but I get an error that there is no line to end. Does anyone know how I might be able to fix this?

share|improve this question
2  
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. This would be the best way of helping you, since it shows your code and others can start working with something rather than starting from scratch. Although you're not able to upload images just yet, please do so and remove the ! that is inserted. Someone with edit privileges will embed the images in your post. –  Werner Jan 21 '12 at 1:26
    
You could try using the optional argument after the \\ to specify the spacing: \\[0.1cm] or an extra \\ after the \hline. –  Peter Grill Jan 21 '12 at 1:26
add comment

1 Answer

You could add a trim option when including your image. Have a look at this example. The first row contains images without options, touching the lines above and below. The next row contains a correction by adding the trim option, using negative space of -5bp.

\documentclass[12pt]{article}
\usepackage{graphicx}
\begin{document}
\begin{tabular}{ccc}
\hline
Original: & \includegraphics{tex} &
    \raisebox{-\height}{\includegraphics{tex}}\\
\hline
Corrected: & \includegraphics[trim=0 0 0 -5]{tex} &
    \raisebox{-\height}{\includegraphics[trim=0 -5 0 0]{tex}}\\
\hline
\end{tabular}
\end{document}

table with images

The trim option takes four lengths as argument, specifying the amount to remove or add to each side. trim= 1 2 3 4 would "crop" the picture by 1bp at the left, 2bp at the bottom, 3bp on the right and 4bp at the top. Here we used negative value to add some space.

The graphicx package provides further options for \includegraphicx, described in the manual.

For more complex adjustments, you could use the adjustbox package, which provides flexible alternatives and is also well documented.

share|improve this answer
    
Awesome, trim was just what i was looking for. Thanks! –  Peter Russo Jan 21 '12 at 18:46
add comment

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.