Graphics, Figures & TablesInclusion of File with Period in its Name

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

Inclusion of File with Period in its Name

Post by Singularity »

How do I include a pdf file which has a period in its name, using package pdfpages?

I have a few dozen (96, to be exact) figures to be included in my document. The following code generates the error "Unknown graphics extension", because it thinks the first period means that begins the file extension (how 20th century is that?)

Code: Select all

\documentclass{article}
\usepackage{pdfpages}

\begin{document}
The graphs for $\beta$ from $1$ through $16$ are as follows
\includepdfmerge[fitpaper]{N=0032_Beta=01.00_tol=1e-08_t=0000_Energy_per_Mode.pdf, N=0032_Beta=01.00_tol=1e-08_t=0000_Energy_per_Frequency.pdf,
                           N=0032_Beta=02.00_tol=1e-08_t=0000_Energy_per_Mode.pdf, N=0032_Beta=02.00_tol=1e-08_t=0000_Energy_per_Frequency.pdf}
\end{document}
But if I remove the periods in the file names (and rename the files!), the code works. The graphics files being included are generated - and named - automatically and, frankly, I don't want to have to do all that file renaming. And what character would I use in place of a decimal point, anyway?

How do I include documents which have a period in their name?

Note that I already tried replacing the periods with \., but then LaTeX thought it was supposed to be in math mode and generate "Missing $ inserted" errors.
Attachments
N=0032_Beta=02.00_tol=1e-08_t=0000_Energy_per_Mode.pdf
(262.76 KiB) Downloaded 327 times
N=0032_Beta=02.00_tol=1e-08_t=0000_Energy_per_Frequency.pdf
(8.27 KiB) Downloaded 326 times
N=0032_Beta=01.00_tol=1e-08_t=0000_Energy_per_Mode.pdf
(132.35 KiB) Downloaded 287 times
N=0032_Beta=01.00_tol=1e-08_t=0000_Energy_per_Frequency.pdf
(7.84 KiB) Downloaded 316 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Inclusion of File with Period in its Name

Post by localghost »

It's recommended in general to avoid special characters (blank spaces, underscores, …) in the paths and names of such files. But you can try the grffile package (from the oberdiek bundle) for extended file processing. No guarantee for success because it is designed for the graphicx package.

Another approach would be to quote the complete path of the file.

Code: Select all

\includepdfmerge[fitpaper]{
  "N=0032_Beta=01.00_tol=1e-08_t=0000_Energy_per_Mode.pdf",
  "N=0032_Beta=01.00_tol=1e-08_t=0000_Energy_per_Frequency.pdf"
  "N=0032_Beta=02.00_tol=1e-08_t=0000_Energy_per_Mode.pdf",
  "N=0032_Beta=02.00_tol=1e-08_t=0000_Energy_per_Frequency.pdf"
}
But this could fail here. And it may cause problems when writing with babel in a language which uses the quote characters as shorthand (e.g. German).

Finally you could try to replace the dots by comma and see if that works.


Thorsten
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

Inclusion of File with Period in its Name

Post by Singularity »

Package grffile worked. Adding this to the above MWE fixed the problem.

Code: Select all

\usepackage[multidot]{grffile}   % Unusual file names support.
Post Reply