1

I made an svg file with Inkscape, which I saved as a pdf with the "Omit text in PDF and create LaTeX file" option. I also checked "Use exported Object's size". When using the resulting pdf_tex file in a latex document, there is a lot of white space under the figure. Like this:

White space

When exporting to eps instead of pdf, I get the following:

Misaligned text

The code of my tex file is as follows:

\documentclass{beamer}
\usepackage{color}

\begin{document}
    \begin{frame}
        \begin{figure}
            \def\svgwidth{1\textwidth}
            \input{mpc.pdf_tex}
            \caption{Caption}
        \end{figure}
    \end{frame}
    \begin{frame}
        \begin{figure}
            \def\svgwidth{1\textwidth}
            \input{mpc.eps_tex}
            \caption{Caption}
        \end{figure}
    \end{frame}
\end{document}

The svg, pdf_tex, eps_tex, pdf, eps and tex file can be downloaded from this link.

In my actual tex file, I have a slide with some text and then underneath it the figure without caption. Because of the extra white space my text is pushed to the top, resulting in a very ugly slide.

Edit

As a temporary solution, I added \vspace*{-3cm} after the include statement, but this is not ideal. I plan on making a lot more figures with Inkscape and I would prefer to have them ready to use when they are exported. Additionally, the 3cm is just a guess and not very precise.

3
  • if you "Omit text in PDF" you must take care of the real size of the draw in inkscape and the final size in the LTeX PDF so that it will have the right dimensions for the LaTeX font, and not in the opposite direction. But the first is think if you really need this instead of allow the text in the PDF image using the same TTF or OTF font. It is just easier and safer to obtain what you expected.
    – Fran
    Dec 1 '20 at 21:16
  • I use "Omit text in PDF" so the text in my image is consistent with that of my tex document. Here it's not that big of deal, but when I use math expressions in my image I really nead them to be compiled by Latex.
    – MDescamps
    Dec 1 '20 at 21:21
  • Then check that everything in Inkscape is always at 1:1 scale with respect the final version, including that text was not zoomed at any moment and still have 10pt in all the labels if you want to use it in a document with 10pt font.
    – Fran
    Dec 1 '20 at 21:48
1

One common method would be to use the package caption and manually set the aboveskip to whatever you want it to be:

\documentclass{beamer}
\usepackage{color}
\usepackage{caption}
\captionsetup[figure]{aboveskip=-10pt}

\begin{document}
    \begin{frame}
        \begin{figure}
            \def\svgwidth{1\textwidth}
            \input{mpc.pdf_tex}
            \caption{Caption}
        \end{figure}
    \end{frame}
\end{document}

In the case above, I decreased the space between the figure and the caption by 10pt.

3
  • I added the caption to show the white space, but I also want it gone when I am not using captions. I will edit my quistion so this is a bit clearer.
    – MDescamps
    Dec 1 '20 at 19:39
  • Ah I see. Have you tried using minipage? Dec 1 '20 at 19:42
  • I don't think I've ever used minipage, but I'll give it a try. However, my dream scenario would still be to find the origin of this white space and kill it at the source.
    – MDescamps
    Dec 1 '20 at 19:49

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.