I generate certain values and print them in single .tex-files (example.tex) in python, mostly in the form \SI{<value>}{\percent} or as single lines for tabular environments & \SI{<value>}{\percent} & \SI{<value>}{\percent} & \SI{<value>}{\percent}.
However, I can easily use \input{example.tex} to include this value in normal text,align or tabular environments without any trouble. But when using it within a mathmode ($$, \[\], \ensuremath) of a table caption, the log files yields "...an extra }" at the place of input.
Pdflatex compiles and the value shows up, bit since the warning is an error, Id like to ask either:
1) Is the use of `\input{}` for this purpose generally recommended?
2) How to get rid of the error/what did I do wrong?
Below an MWE, test_size.tex consists purely of \SI{30}{\percent}.
\documentclass{article}
\usepackage{siunitx}
\usepackage{amsmath}
\begin{document}
Normal inline mode works: \input{./values/test_size.tex}\\[1ex]
Normal math inline mode works: $\input{./values/test_size.tex}$
\begin{table}
\caption{Math inline caption doesnt work: $\input{./values/test_size.tex}$}
\end{table}
\begin{align}
\textrm{align enviroment works: } \input{./values/test_size.tex}
\end{align}
\end{document}
EDIT: This would have helped as well. Sorry for double posting.
\inputto include different sections and so far for me it is the easiest way to automatically use values generated in my python projects. I assume there are better ways, and eager to read up on it. Could you provide me with some keywords? – Pratched Mar 20 '20 at 16:26\ExtVal{test_size}instead of writing this all the time. Then it is also much easier if you later on decide to move the data to a different folder. – daleif Mar 20 '20 at 16:30\inputin the first place. But sure, macros shorten my effort as well. – Pratched Mar 20 '20 at 16:35