Adding captions to PDF figures in LaTeX

  • Context: LaTeX 
  • Thread starter Thread starter ChrisVer
  • Start date Start date
  • Tags Tags
    Latex Pdf
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
3 replies · 3K views
Science Advisor
Messages
3,372
Reaction score
465
Hi, I have some figures in a pdf form, and I'd like to pass them into latex as figures ->meaning I want to be able to use a caption.
I used the:
\usepackage{pdfpages}

but this inserts the pdf page as it is, and I can't "edit" it (by adding a caption).

Is there any possible way to do it?
 
Physics news on Phys.org
You mean something like:
Code:
\usepackage{graphicx}
...
\ begin{figure}
\includegraphics[width=\textwidth]{file.pdf}
\caption{This is a caption}
\end{figure}
?
 
  • Like
Likes   Reactions: ChrisVer
As long as the pdf is in the same folder as your .tex file, then yes. If it isn't, you can use:
Code:
\graphicspath{ {path1}{path2}... }
in the preamble. This has some issues if the folder name has spaces though, so I prefer just putting the pdfs in the same folder as the .tex file and not bother with it. If you absolutely want that though, there's also the "grffile" package, but it can be slow (on my computer the compilation takes about 20x longer than without the package). Also, I forgot to mention, remove the space between the backslash and "figure", together it gave me some weird formatting on the site so I separated them.
 
  • Like
Likes   Reactions: ChrisVer