My general goal is to have a table with all S columns. While debugging, I came to these minimal examples which now almost seem too simple.
Working as expected:
\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{Sc}
1&2\\
\end{tabular}
\end{document}
This fails with a quite obscure error message:
\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{Sc}
\input{\jobname-example_content.tex}
\end{tabular}
\end{document}
Error message:
! Extra }, or forgotten $.
<recently read> }
l.11 \end
{tabular}
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.
! Extra }, or forgotten $.
<argument> ...{\scan_stop: \c_math_toggle_token }}
l.11 \end
{tabular}
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.
! Missing $ inserted.
<inserted text>
$
l.11 \end
{tabular}
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.
! Missing } inserted.
<inserted text>
}
l.11 \end
{tabular}
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.
! Missing } inserted.
<inserted text>
}
l.11 \end
{tabular}
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.
! Missing control sequence inserted.
<inserted text>
\inaccessible
l.11 \end
{tabular}
Please don't say `\def cs{...}', say `\def\cs{...}'.
I've inserted an inaccessible control sequence so that your
definition will be completed without mixing me up too badly.
You can recover graciously from this error, if you're
careful; see exercise 27.2 in The TeXbook.
! I can't find file `{test2-example_content.tex}'.
<to be read again>
\color_group_end:
l.11 \end
{tabular}
(Press Enter to retry, or Control-D to exit)
Please type another input file name
! Emergency stop.
However, these examples all work well:
\documentclass{article}
\usepackage{siunitx}
\begin{filecontents*}{\jobname-example_content.tex}
1&2\\
\end{filecontents*}
\begin{document}
\begin{tabular}{cS}
\input{\jobname-example_content.tex}
\end{tabular}
\end{document}
\documentclass{article}
\usepackage{siunitx}
\begin{filecontents*}{\jobname-example_content.tex}
1&2\\
\end{filecontents*}
\makeatletter
\newcommand{\expinput}[1]{\@@input #1}
\makeatother
\begin{document}
\begin{tabular}{Sc}
\expinput{\jobname-example_content.tex}
\end{tabular}
\end{document}
In summary, the problem only occurs if I input values from file and the first column is an S column.
This is my version information:
$ pdflatex -version
pdfTeX 3.14159265-2.6-1.40.20 (TeX Live 2019)
Related questions:
- The workaround with
\@@inputstems from an answer to one of my previous questions. - A similar question was raised here. However, many different aspects were intertwined there and the only answer contains a version which does not use
\input.
S? FWIW, I can replicate the issue you encounter for both\begin{tabular}{Sc}and\begin{tabular}{cS}. – Mico May 03 '20 at 11:01cSworks whereasScdoes not. – Lukas May 03 '20 at 11:45