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.
\IfStrEqCasewith an 'accidental' space in it, so adding%at the end of the lines should help. – Joseph Wright Apr 14 '14 at 11:05! Paragraph ended before \PackageError was complete.
When I comment out macros, I get the new error with
Undefined control sequence