Insert Latex PDF Figures: Easy Guide to Captions

  • Context: LaTeX 
  • Thread starter Thread starter ChrisVer
  • Start date Start date
  • Tags Tags
    Latex Pdf
Click For Summary

Discussion Overview

The discussion revolves around the process of inserting PDF figures into LaTeX documents with the ability to add captions. Participants explore methods and potential issues related to this task, focusing on technical aspects of LaTeX packages and commands.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant inquires about inserting PDF figures into LaTeX while being able to add captions, expressing difficulty with the \usepackage{pdfpages} method.
  • Another participant suggests using the \usepackage{graphicx} package along with the figure environment to include the PDF and add a caption.
  • A subsequent participant questions the effectiveness of the proposed method.
  • Further, a participant confirms that the method should work if the PDF is in the same directory as the .tex file and discusses the use of \graphicspath for different folder locations, noting potential issues with spaces in folder names.
  • This participant also mentions the "grffile" package as an alternative, cautioning about its impact on compilation speed and providing a formatting tip regarding spacing in commands.

Areas of Agreement / Disagreement

Participants present multiple approaches and considerations, but there is no consensus on the best method or potential issues, indicating an unresolved discussion.

Contextual Notes

Limitations include potential issues with folder paths, the impact of using certain packages on compilation speed, and formatting concerns that may arise in the LaTeX code.

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   Reactions: 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   Reactions: ChrisVer

Similar threads

  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 5 ·
Replies
5
Views
7K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 9 ·
Replies
9
Views
6K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 2 ·
Replies
2
Views
5K