This may seem like a very stupid question, but I can't work out how to identify a file to be inputed using \input in xelatex. I think I am doing the right thing, but for some reason it does not work.

My main file looks like this:


I have a file called testinput.tex in the same directory. If, in that directory, I run xelatex it complains it cannot find the file, but runs fine if I type in the file's name.

This is XeTeX, Version 3.14159265-2.6-0.99996 (TeX Live 2016) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2017/01/01> patch level 3
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
Document Class: report 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size10.clo)) (./test.aux)
! I can't find file `(testinput.tex)'.
l.3 \input(testinput.tex)

(Press Enter to retry, or Control-D to exit)
Please type another input file name: testinput.tex
(./testinput.tex) [1] (./test.aux) )
Output written on test.pdf (1 page).
Transcript written on test.log.

I am baffled as to what I am doing wrong. I have tried this without the .tex extension and seen the same result.


Your input suggests you use parentheses (()) around your file name. The correct way to pass an argument (mandatory) to a LaTeX command is to use braces ({}). So you should use the following code:


This is by the way independent of any engine.

Update: As LaTeX will automatically append .tex you could also use the following:


But be aware that here LaTeX will check for file testinput first and then look at testinput.tex. That's probably a good reason to use the extension .tex while inputting the file.

  • 1
    AFAIK LaTeX does not append .tex, TeX itself or kpathsea may append .tex, but this is implementation depending (nevertheless common for current TeX implementations). LaTeX appends .tex only if you use \include. – Schweinebacke Apr 23 '17 at 17:38
  • 1
    @Schweinebacke At least for me it works, but you're right though (read it at weinelt.de, golatex.de says something different). – TeXnician Apr 23 '17 at 17:41
  • @TeXnician: From weinelt.de: "Die Beschreibung auf dieser Seite basiert auf der heutzutage geradezu antiken LaTeX-Version 2.09; die Erweiterungen der aktuellen Version LaTeX2e sind leider immernoch nicht enthalten." ;-) – user31729 Apr 23 '17 at 17:48
  • 1
    @TeXnician: The problem with weinelt.de is that this site pops up very frequently if you use Google to look up for LaTeX reference. More weird is that the owner of the site started to provide a LaTeX reference with LaTeX 2.09 about 5 years after LaTeX2e was established ... – user31729 Apr 23 '17 at 18:08
  • 2
    @Schweinebacke no, adding .tex is implemented by tex-the-program, (and documented in the texbook) it isn't a latex feature. – David Carlisle Apr 23 '17 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.