2

I'm making some figures with Visio 2013 and exporting them as pdf files. I'm including them in LaTeX:

\begin{figure}[h]
    \centering
    \includegraphics[width=1.00\textwidth]{./Figures/figure.pdf}
    \caption{Figura exportada a pdf desde Visio}
\end{figure}

The problem is that the captions are rendering inside the figure. I'm using pdfLaTeX.

Bad caption

Anyone know what is happening? I googled and I can't find nothing about it. The only clue is a comment in another question, but about eps files, and with no reply:

It's a baseline problem. The centers of you graphs are aligned with the bottom of the table (usually it's the other way around). Must be peculiar to eps files. – John Kormylo Sep 12 '14 at 19:50

I'll apreciaty any help. I'm new with LaTeX :P

Edit: this is thie pdf

Edit2: this is the result with a smaller width and the bbox. The figure it's bigger than the bbox!

enter image description here

Edit3: This is the result using trim. It works fine, but doing this for each file is annoying :( enter image description here

  • while I am not quite sure what is happening, the exported pdf would be helpfull. – ted May 28 '15 at 16:07
  • Is that at the bottom of the page? It is quite likely, that the image is just too big. Try .5\linewidth. – Johannes_B May 28 '15 at 16:09
  • Try doing \fbox{\includegraphics[width=\textwidth]{./Figures/figure.pdf}} so that TeX will draw a frame showing the bounding box it sees for the images. There are good chances that this bounding box doesn't contain all the image; if this is the case, finding a remedy is easy. From what I see, the image is outside its bounding box also on the right, not only at the bottom. – egreg May 28 '15 at 16:14
  • @Johannes_B , no, it's not the bottom of the page, it happens in any place. I tried your advice and is happening also :( – Brian May 28 '15 at 16:14
  • @ted I aded a reference to the pdf – Brian May 28 '15 at 16:19
3

The image produced with \fbox shows that the PDF file advertises a bad bounding box.

If you are not able to fix it in the file, which should be the best way to cope with the problem, you can still remedy by using the trim option to \includegraphics.

So, say that the image protrudes by 2cm to the right and 1cm at the bottom (evaluate these dimensions by including the file at its natural size or experiment with various settings). Then

\fbox{\includegraphics[clip,trim=2cm -1cm -2cm 1cm]{filename.pdf}}

should show the image centered in the frame. The order of the length is “left”, “bottom”, “right” and “top”, so we are trimming 2cm from the left and adding 2cm to the right.

When you're satisfied of the result, you can remove \fbox{...} around the image loading command and add the width=\textwidth option.

(Note that clip is necessary to avoid the white borders hide something around the picture.)

  • hey, I did what that and post it as an aswer with the results, but the admins deleted the post. I don't know why, because it was an good answer. – Brian May 28 '15 at 19:12
  • Anyways, I prefer to fix the problem in the pdf itself, but I dont know how. From Visio I generate a pdf file adjusted to the figure. I don't know how to adjust the bounding box. I think it's a problem of Visio, – Brian May 28 '15 at 19:19
  • I also needed to add clip as a parameter to includegraphics, otherwise there were problems with the figure's caption being ovelaid by stuff beneath it. – Martin Pecka Jul 12 '16 at 14:48
  • @peci1 Yes, with clip is better – egreg Jul 12 '16 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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