0

I'm new to Latex, but have been making a study guide for my class which has gotten very large. I changed one small thing, I believe I changed a section name, and now I get this error that I cannot for the life of me fix to allow for compiling again. Does anyone know what this error means and where it could be in my document to fix? Thanks!

~<inserted text> 
                \par 
l.36 ... {section}{\includepdf }{253}{section*.37}
                                                  %
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.

Runaway argument?~
6
  • 2
    Welcome. // Make a copy of your work and try the 50:50 strategy, as lined out here tex.stackexchange.com/questions/651156/… , to narrow down the trouble maker(s).
    – MS-SPO
    Commented May 6 at 13:23
  • 4
    Just a guess: Looks like you've used \includepdf inside the argument of a \section command. But this wouldn't make any sense … You should indeed try to break-down your document to a minimal working example and add the resulting code to your question. And if the error is inside the aux or toc file, you have to delete them after every reduction step.
    – cabohah
    Commented May 6 at 13:39
  • 1
    The \includepdf may be around line 36 of your .tex file (though it could be a different file if you're using several).
    – cfr
    Commented May 6 at 13:51
  • 1
    @cfr Don't think, it is in the tex file but the aux of toc. But maybe I'm wrong.
    – cabohah
    Commented May 6 at 14:06
  • @cabohah I think you're right.
    – cfr
    Commented May 6 at 14:08

1 Answer 1

1

Here is an other illustration of the 50:50 strategy I suggested. It's a simple example, and your trouble will probably on a similar level, in a comparable place.

The keys here are:

  • follow a systematic process
  • until the point, where you know where to look for what
  • correct it and continue

Needless (?) to say, you should do the following on a copy of your files ..., just in case ...

Iteration 1 - knowing nothing

Let's assume you have a file like this, and let's pretend we don't spot the error right away.

\documentclass[10pt,a4paper]{article}
\usepackage{lipsum}
\usepackage{graphicx}
\newcommand\strange[0]{\includegraphics[scale=.3]{example-images} }

\begin{document}
 \section{Just a section}
 \lipsum[1]
 
 \includegraphics[scale=.3]{example-image} 
 
 \section{\strange{hello world} }
 \lipsum[5]
 
\end{document}

A compile yields

error1

Though it hints to line 14, we might not be able to understand the problem, as there is no image at line 14 ...:

! LaTeX Error: File `example-images' not found.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.14 \section{\strange{hello world} }
I could not locate the file with any of these extensions: ...

Iteration 2 - where is it, roughly? (split 50:50)

Let's continue pretending we are blind enough to overlook the obvious. Let's comment out the lower part, which compiles:

\documentclass[10pt,a4paper]{article}
\usepackage{lipsum}
\usepackage{graphicx}
\newcommand\strange[0]{\includegraphics[scale=.3]{example-images} }

\begin{document}
 \section{Just a section}
 \lipsum[1]
 
% \includegraphics[scale=.3]{example-image} 
% 
% \section{\strange{hello world} }
% \lipsum[5]

Is the problem here? Let's check the opposite, i.e. "the other 50%":

\documentclass[10pt,a4paper]{article}
\usepackage{lipsum}
\usepackage{graphicx}
\newcommand\strange[0]{\includegraphics[scale=.3]{example-images} }

\begin{document}
% \section{Just a section}
% \lipsum[1]
 
 \includegraphics[scale=.3]{example-image} 
 
 \section{\strange{hello world} }
 \lipsum[5]
 
\end{document}

This fails, so the problem must be somewhere here.

Iteration 3 - closer look at lower half (split 50:50)

With the previous hint in mind, and line 14 back again, let's try this half (of the previous half):

Compiles:

\documentclass[10pt,a4paper]{article}
\usepackage{lipsum}
\usepackage{graphicx}
\newcommand\strange[0]{\includegraphics[scale=.3]{example-images} }

\begin{document}
% \section{Just a section}
% \lipsum[1]
 
 \includegraphics[scale=.3]{example-image} 
 
% \section{\strange{hello world} }
 \lipsum[5]
 
\end{document}

Proof: dosen't compile

\documentclass[10pt,a4paper]{article}
\usepackage{lipsum}
\usepackage{graphicx}
\newcommand\strange[0]{\includegraphics[scale=.3]{example-images} }

\begin{document}
% \section{Just a section}
% \lipsum[1]
 
% \includegraphics[scale=.3]{example-image} 
 
 \section{\strange{hello world} }
% \lipsum[5]
 
\end{document}

Iteration 4 - what's in a line? (split 50:50)

Now, we no longer can run away from the fact that this line bears something strange: \section{\strange{hello world} }

How to narrow it down? Make it discardeble: 50:50 on the next lower level.

This fails (with the rest as above)

 \section{
    \strange{hello world} 
 }

while this compiles:

 \section{
%   \strange{hello world} 
 }

Iteration 5 - time of focused analysis and enlightment

Ok, let's have a close look at this strange macro. Who defined it? Me myself? Ok:

\newcommand\strange[0]{\includegraphics[scale=.3]{example-images} 

Either repeating reformating and compile as with the section, or rereading the error message again, sooner or later you'll wonder:

  • who defined example-images ?
  • answer: nobody
  • it's true, that package graphicx provides an example-image (at least)
  • but it doesn't provide example-images

So, was it a typo?

Proof

Ok, let's try the changed filename ... and it compiles.

\documentclass[10pt,a4paper]{article}
\usepackage{lipsum}
\usepackage{graphicx}
\newcommand\strange[0]{\includegraphics[scale=.3]{example-image} }

\begin{document}
 \section{Just a section}
 \lipsum[1]
 
 \includegraphics[scale=.3]{example-image} 
 
 \section{
    \strange{hello world} 
 }
 \lipsum[5]
 
\end{document}

result

1
  • 3
    the problem with the strategy you outline is that if the error is in the .aux file you will get the same error whichever half you pick, here (probably) the error is in the .toc but still it takes some care when dividing and conquering Commented May 6 at 17:57

Not the answer you're looking for? Browse other questions tagged .