1

in a latex file called "main.tex" i can write the line

\input /home/user1/defs.tex

to input the conents of "defs.tex" at the position of that command.

now i want to generalize this, so that any user can compile the tex-document and "defs.tex" inside his home-directory is being inserted. my first guess

\input ~/defs.tex

didnt work. does anyone know how to solve this?

Clemens
  • 11
  • 2

1 Answers1

0

https://tex.stackexchange.com/questions/1728/accessing-environment-variables-within-a-document

Thus, it would seem that:

\documentclass{article}
\immediate\write18{echo $HOME >/tmp/foo.tex}
\begin{document}
\input{var}
\end{document}

might do the trick. Or some such.

NOTE: I'm not a TeX expert, so be sure to read the referenced article carefully, and be prepared to experiment.

Community
  • 1
  • 1
Brian Clapper
  • 25,705
  • 7
  • 65
  • 65