5

This is almost certainly a silly mistake somewhere. I'm essentially trying to do what is being done here. My MWE project:

$ find ./
./
./common
./common/preambleCommon.tex
./mydoc
./mydoc/mydoc.tex

mydoc.tex:

\documentclass{article}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                                       %
\newcommand*{\commonDir}{../common/}%  %
\input{\commonDir{preambleCommon}}     %
                                       %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

Hello!

\mytestcmd

\end{document}

preambleCommon.tex:

\newcommand*{\mytestcmd}{Hello, from my test cmd.}

When I run latex mydoc.tex, this comes up:

! LaTeX Error: File `../common/preambleCommon.tex' not found.

But if I do ls ../common/preambleCommon.tex it shows up.

5

The error message of LaTeX is wrong, it should read:

! LaTeX Error: File `../common/{preambleCommon}.tex' not found.

The the error is clear: the curly braces. They are not removed as argument braces, because \commonDir does not take an argument in \input{\commonDir{preambleCommon}}.

Corrected:

\newcommand*{\commonDir}{../common/}%
\input{\commonDir preambleCommon}% space is automatically gobbled after command name
  • I did read the space gobbling but forgot about it ... thanks! – bbarker Apr 21 '14 at 23:47

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.