0

I am getting an error displaying a PDF in latex. The pdf is only a single page. I am getting a box with \AM@currentdocname.pdf shown. Based on my googling, including the [final] option should have stopped this behavior. I've tried eliminating other packages which I thought might cause the error, to no avail. How does this look? I added the potentially extraneous packages for the document.

Here is my MWE:

\documentclass[12pt,letterpaper,oneside]{book}
\usepackage[font={bf,footnotesize},labelsep=period]{caption}
\usepackage{geometry}
\usepackage{setspace}
\usepackage{indentfirst}
\usepackage{float}
\usepackage{flafter}
\usepackage{amssymb,amsmath,amsfonts}
\usepackage{theorem}
\usepackage{varioref} 
\usepackage{tocbibind} 
\usepackage{listings} 
\usepackage{xspace}
\usepackage{threeparttable}
\usepackage{booktabs}
\usepackage{color}
\usepackage{url}
\usepackage{ifpdf}
\usepackage{graphicx}
\usepackage[final]{pdfpages}

\begin{document}

\includepdf[pages=1]{5_figures/pdf_file}

\end{document}

5_figures is a folder at the top level of the overleaf directory. However, I tried moving the pdf file to the top level and got the same behavior.

I have also tried just using includegraphics instead of pdfpages:

\begin{figure}[h]
\centering
\includegraphics[width=1.00\textwidth]{pdf_file}
\end{figure}

This option omits the pdf page entirely, however.

The logfile shows 2 errors with the pdfpages example:

Package pdfpages Error: Cannot find file `5_figures/pdf_file'. Undefined control sequence. Missing number, treated as zero. Package pdfpages Error: Page 1 of '\AM@currentdocname ' does not exist. Package pdftex.def Error: File '\AM@currentdocname .pdf' not found: using draft setting.

and:

The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}. The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., \hobx'), typeI' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.

The message about not finding the file is odd because Overleaf recognizes the path and auto-populates the file name when I type it in.

  • show the log-file. – Ulrike Fischer Jan 30 at 20:13
  • That's the standard error message if a file is not found. So check if the name is correct. – Ulrike Fischer Jan 30 at 20:26
  • Yeah, that was the first thing I thought of too. The odd thing is that Overleaf recognizes the file in the path and auto-populates the name as I type it in. I've used pdfs in docs before just as above without issue. – Shawn Jan 30 at 20:28
  • Well don't trust some auto-whatever, check the name (e.g. if there is a space at the end ...) – Ulrike Fischer Jan 30 at 20:29
  • Yep, you're right. There was a space after one of the '_' between words. #foreheadslap. Thank you – Shawn Jan 30 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.