1

my script produces this error:

Runaway argument?
\section *{Serumnatrium} \par \ib {Zweck}{ \el { * Wasserverteilung *\ETC.
! File ended while scanning use of \@xs@testcase.
<inserted text> 
                \par 

Unfortunately, I can't create a minimal example that produces the error. As far as I understand, there must be an emtpy space that's interpreted as argument(?) but I can't find the position that causes the error, since I have some macros that are forwarding the arguments to some others.

I found that post: \IfStrEqCase having problem with last optional parameter, added \tracingmacros=1 and got a 140MB log file. But I don't know how to interprete the data.

What I am looking for in the file?

Edit: I suppose the error might be connected with a macro that has 3 arguments in definition but is sometimes called with just 2, when the 3 one isn't needed.

Moldevort
  • 1,295
  • Why can't you create an MWE? Does the problem disappear if you remove any part of the document? – Ian Thompson Apr 14 '14 at 10:47
  • If I remove any macro, a "Undefined control sequence" appears. When I try to build a minimal example with the macros, it's working. I can't reproduce the error with a MWE. – Moldevort Apr 14 '14 at 11:01
  • The question you link to points to a solution (perhaps not obvious): it's likely you have \IfStrEqCase with an 'accidental' space in it, so adding % at the end of the lines should help. – Joseph Wright Apr 14 '14 at 11:05
  • 1
    Selectively comment out lines from your document until you produce an MWE. Very likely you will find the culprit and never need to post it but, if not, you'll have code you can post. – cfr Apr 14 '14 at 11:13
  • Now I get: `Runaway argument? {Undefined option to ds:
    ! Paragraph ended before \PackageError was complete. \par l.2308 * Wachstumshemmung bei Kindern}}`

    When I comment out macros, I get the new error with Undefined control sequence

    – Moldevort Apr 14 '14 at 11:18

2 Answers2

4

Too long for a comment.

Typical reasons for "Runaway argument" errors are:

  • A missing closing argument brace.
  • A missing argument for a macro that confuses the internals of the macro.
  • Bug.

Example for a missing closing argument brace:

\documentclass{article}
\begin{document}
Hello \textbf{World!
\section{Foobar}
\end{document}

TeX complains:

Runaway argument?
{World! \section {Foobar} \end {document} 
! File ended while scanning use of \textbf .
<inserted text> 
                \par

The help text of the error message:

? h
I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.

The place, where TeX throws the error is the location, where TeX finds out, that something is wrong, e.g. the next empty line (\par) in case of non-\long arguments or even the end of file.

However, there are clues:

  • The error message contains the macro, here \textbf . Note the space at the end that belongs to the macro name. It is the internal command for \textbf that is written in the source.

    In your case it is \@xs@testcase. It is probably an internal macro in package xstring. If you are using the macros of that package, then it might be a clue and you can check the arguments.

  • The start of the argument is given in the line below Runaway argument?. In your case the argument starts with \section *{Serumnatrium}. This looks like user code and is a strong hint for the location. Find it and check the source code just before.

Analyzing with \tracingmacros

\tracingmacros=1 is a useful tool for analyzing this kind of error. But the amount of data, written to the .log file, can be indeed very huge. Move it closer to the location of the error to limit the data. And it can be even be used to locate the error. If \tracingmacros=1 is used too late, then the .log file does not show its output. With the method of a binary search, the location of the problem can be found efficiently.

When running TeX, stop at the error by quitting with x. Then the .log file is read backwards. Thus the amount of data does not matter much (unless you run out of disk space).

It needs some experience to understand the output of \tracingmacros. But just looking at macro names that are expanded or arguments that are processed already give valuable clues. For example, these clues help to locate the problem in the source. And experts can study the internals to analyze bugs.

Heiko Oberdiek
  • 271,626
1

Thanks for the long explanation. It didn't solve the problem but answered the asked question about how to deal with log files.

I had the suspicion that the macros are fine and that there are some chars too much or less in the main document. So I moved an extra \end{document} through my document to see when the error appears. It was that simple: Just one { too much that I added by accident.

before:

\ib{caption}{
\el{
* A
* B
    ** B1
    ** B2
    ** B3
* C}}{

after:

\ib{caption}{
\el{
* A
* B
    ** B1
    ** B2
    ** B3
* C}}
Moldevort
  • 1,295