Search code examples
latex

\input command works inside \footnote, but not inside \thanks


I have two LaTeX documents (research papers, paper1.tex and paper2.tex) that share the same acknowledgements ("I would like to thank X for comments, Y for funding, ..."). These get updated periodically and rather than update them in both papers, I created a acknowledgements.tex file. Elsewhere I tried using a construction like \footnote{\input{filename.tex}} which worked well and it works here as well as long as I use it in the body of the text. Putting it in a section title at first throws errors which can be fixed using \protect or \includepackage[stable]{footmisc} (as recommended here). But when I put in the title footnote \title{My title\thanks{\input{acknowledgements.tex}}, I get the following errors (which neither \protect nor \includepackage[stable]{footmisc} can resolve):

Error message

MWE

Make two .tex documents and put them in the same folder. The first is called paper.tex and contains:

\documentclass[pdf, letterpaper, 11pt]{article}

\begin{document}
% \title{My title\protect\thanks{\input{test.tex}}}
% \title{My title\thanks{\input{test.tex}}}
\title{My title\thanks{test}}
\author{It's me}

\maketitle

\end{document}

while the second is called test.tex and just contains the word test. Uncommenting the first or second title in favor of the last replicates the error.

Log file

This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded format=pdflatex 2020.2.20)  8 SEP 2024 14:23
entering extended mode
 restricted \write18 enabled.
 file:line:error style messages enabled.
 %&-line parsing enabled.
**paper.tex
(./paper.tex
LaTeX2e <2018-12-01>
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/size11.clo
File: size11.clo 2018/09/03 v1.4i Standard LaTeX file (size option)
)
\c@part=\count80
\c@section=\count81
\c@subsection=\count82
\c@subsubsection=\count83
\c@paragraph=\count84
\c@subparagraph=\count85
\c@figure=\count86
\c@table=\count87
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)

LaTeX Warning: Unused global option(s):
    [pdf].

(./paper.aux)
\openout1 = `paper.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <17.28> on input line 9.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <12> on input line 9.
LaTeX Font Info:    Try loading font information for OMS+cmr on input line 9.
 (/usr/local/texlive/2019/texmf-dist/tex/latex/base/omscmr.fd
File: omscmr.fd 2014/09/29 v2.5h Standard LaTeX font definitions
)
LaTeX Font Info:    Font shape `OMS/cmr/m/n' in size <12> not available
(Font)              Font shape `OMS/cmsy/m/n' tried instead on input line 9.

./paper.tex:9: Use of \@xfootnotemark doesn't match its definition.
\@ifnextchar ... \reserved@d =#1\def \reserved@a {
                                                  #2}\def \reserved@b {#3}\f...
l.9 \maketitle
              
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.

./paper.tex:9: Argument of \@iinput has an extra }.
<inserted text> 
                \par 
l.9 \maketitle
              
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.

Runaway argument?
./paper.tex:9: Paragraph ended before \@iinput was complete.
<to be read again> 
                   \par 
l.9 \maketitle
              
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.

./paper.tex:9: Missing \endcsname inserted.
<to be read again> 
                   \csname\endcsname 

[THIS ERROR GETS REPEATED 100 TIMES WHICH I WON'T COPY HERE]
              
(That makes 100 errors; please try again.) 
Here is how much of TeX's memory you used:
 229 strings out of 492616
 2688 string characters out of 6129481
 60046 words of memory out of 5000000
 4233 multiletter control sequences out of 15000+600000
 5767 words of font info for 21 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191
 36i,5n,33p,117b,245s stack positions out of 5000i,500n,10000p,200000b,80000s

./paper.tex:9:  ==> Fatal error occurred, no output PDF file produced!

Solution

  • Place the \protect right before \input:

    \documentclass[letterpaper, 11pt]{article}
    
    \begin{document}
    
     \title{My title\thanks{\protect\input{test.tex}}}
    \author{It's me}
    
    \maketitle
    
    \end{document}