I have a file bar.tex
that I include in other files.
$ cat bar.tex
hello, world
$ cat foo.tex
\documentclass{article}
\begin{document}
\include{bar.tex}
\end{document}
$ pdflatex foo.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./foo.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 2 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo)) (./foo.aux
(./bar.tex.aux))
No file bar.tex.tex.
(./foo.aux (./bar.tex.aux)) )
No pages of output.
Transcript written on foo.log.
You can see above that pdflatex could not include the file because No
file bar.tex.tex
. It was looking for bar.tex.tex
instead of
bar.tex
.
Of course the following works fine.
$ cat foo2.tex
\documentclass{article}
\begin{document}
\include{bar}
\end{document}
$ pdflatex foo2.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./foo2.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 2 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
No file foo2.aux.
(./bar.tex) [1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./foo2.aux
(./bar.aux)) )</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr
10.pfb>
Output written on foo2.pdf (1 page, 11574 bytes).
But when I use \input
instead of \include
both bar.tex
and bar
seem to work.
$ cat foo3.tex
\documentclass{article}
\begin{document}
\input{bar.tex}
\end{document}
$ pdflatex foo3.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./foo3.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 2 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
No file foo3.aux.
(./bar.tex) [1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./foo3.aux)
)</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on foo3.pdf (1 page, 11574 bytes).
Transcript written on foo3.log.
$ cat foo4.tex
\documentclass{article}
\begin{document}
\input{bar}
\end{document}
$ pdflatex foo4.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./foo4.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 2 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
No file foo4.aux.
(./bar.tex) [1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./foo4.aux)
)</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on foo4.pdf (1 page, 11574 bytes).
Transcript written on foo4.log.
Why is there this inconsistency between \include
and \input
, i.e.
why \include
requires the file to be included to be speicified without
the extension name whereas \input
does not care whether or not the
extension name is specified?