Saturday, October 11, 2014

Latex: Image in a table overlaps the row separator line

When embedding images in Latex tables, you may find that the images will overlap with the horizontal line above its row. Like described by Stefan Kottwitz in [1], it looks like:

To avoid this problem, the easiest solution is to use the "trim" parameter of the includegraphics command. 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.

To add some spacing at the top, we can use a negative value as shown below:
\includegraphics[trim=0 0 0 -5]{figure.jpg}

In case multiple parameters are to be specified, such as "width", we can do it as follows:
\includegraphics[trim=0 0 0 -5,width=0.2\textwidth]{figure.jpg}

References:
1. http://tex.stackexchange.com/questions/41788/image-in-table-covers-horizontal-line-above-it

No comments:

Post a Comment