TransWikia.com

Caption of an included PDF is not showing up

TeX - LaTeX Asked by telion on May 28, 2021

I’m a bit new to LaTeX and I wanted to include a PDF image as a figure like this:

begin{figure}[h]
    centering
    includegraphics{pic.pdf}   
    caption{Some Text
    }
    label{fig:someLabel}
end{figure}

However, the caption is not showing. It works however if I use PNG or JPG.
The reason why I use PDF is the image quality that drops severly when using PNG or JPG on top of the bad export quality of the program I use to create these images.

So what can I do to display the image in good quality, on the page I need it to with the caption I wrote?

The head of the document (document class and packages) is this:

documentclass[12pt,leqno,a4paper]{article}
usepackage{natbib}
usepackage{epsfig}
usepackage{booktabs}

% own latex packages

usepackage{amsmath,amssymb,amsfonts}
usepackage{algorithmic}
usepackage{graphicx}
usepackage{textcomp}
usepackage{tocloft}
usepackage{relsize}

usepackage{url}
usepackage{hyperref}
usepackage{ntheorem}
usepackage{fixltx2e}
usepackage{balance}
theoremseparator{:}
newtheorem{hyp}{Hypothesis}

usepackage{array} % for defining a new column type
usepackage{varwidth} %for the varwidth minipage environment
usepackage[toc]{glossaries}
% recommended: uncomment following line if you write in German 
%usepackeage{german}  
makeglossaries
input{glossary.tex}


renewcommand{baselinestretch}{1.3}
parskip = medskipamount
frenchspacing
bibpunct[; ]{(}{)}{;}{a}{,}{;}
...
input{image.tex}

Note: This is a template from my university, so I probably can only add or remove my own packages. The image is defined in a separate file and inserted at some point in the text.

The rest of the document is made of sections, file inputs, bibliography and glossary. There shouldn’t be anything too exotic.

If you need more info please feel free to ask, but I don’t know for what information to look for to fix this.

The PDF I try to include is a single picture on a single page. It is an export of draw.io (https://draw.io/).

One Answer

Apparently the PDF I used, was a full page with a lot of whitespace at the bottom, which caused LaTeX to not display the caption.

After making sure the image of the PDF is not covering the whole page the issue was resolved.

It was a little unexpected that no warning indicated that the caption is not displaying because of the size of the PDF.

Answered by telion on May 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP