인라인 수학 모드에서 \input{} 사용 -- 추가 `}`

인라인 수학 모드에서 \input{} 사용 -- 추가 `}`

저는 특정 값을 생성하고 이를 Python의 단일 .tex 파일( example.tex)로 인쇄합니다. 대부분의 경우 표 형식 환경의 형식 \SI{<value>}{\percent}이나 한 줄로 인쇄합니다 & \SI{<value>}{\percent} & \SI{<value>}{\percent} & \SI{<value>}{\percent}.

그러나 \input{example.tex}일반 텍스트 aligntabular환경에서는 문제 없이 이 값을 쉽게 포함할 수 있습니다. 그러나 테이블 캡션의 수학 모드( $$, \[\], \ensuremath) 내에서 이를 사용하면 로그 파일의 }입력 위치에 "...an extra"가 생성됩니다.

Pdflatex가 컴파일되고 값이 표시됩니다. 경고는 오류이므로 다음 중 하나를 묻고 싶습니다.

1) Is the use of `\input{}` for this purpose generally recommended?
2) How to get rid of the error/what did I do wrong?

MWE 아래에는 test_size.tex순전히 \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}

편집하다:이것도 도움이 되었을 것입니다. 중복글 올려서 죄송합니다.

답변1

\input멸종위기종이므로 ​​보호가 필요하므로 \protect\input대신 사용하세요.

그런데 애초에 왜 이런 데이터를 포함시키겠습니까?

관련 정보