LaTeX Insert Latex PDF Figures: Easy Guide to Captions

  • Thread starter Thread starter ChrisVer
  • Start date Start date
  • Tags Tags
    Latex Pdf
AI Thread Summary
To insert figures from a PDF into LaTeX with captions, the recommended approach is to use the graphicx package. This allows you to include the PDF as a figure with the desired caption. Ensure the PDF is in the same directory as your .tex file for easy access. If the PDF is located in a different folder, you can specify the path using the graphicspath command, but be cautious of spaces in folder names, which can cause issues. Alternatively, the grffile package can handle spaces but may significantly slow down compilation time. It's also important to ensure there are no spaces between the backslash and the figure command to avoid formatting problems.
ChrisVer
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 ChrisVer
would that work?
 
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 ChrisVer

Similar threads

Replies
3
Views
2K
Replies
7
Views
4K
Replies
12
Views
3K
Replies
5
Views
6K
Replies
11
Views
2K
Replies
2
Views
3K
Replies
2
Views
5K
Replies
5
Views
4K
Back
Top