[tex-eplain] include directory in the document

Karl Berry karl at freefriends.org
Sat Jan 10 18:55:10 CET 2004


    How can I automatically print the working directory (e.g. /home/###/###/ 
    ) in a document? 

The only way I can think of is to define it on the cmdline, e.g.,
  $ tex "\\def\\pwd{`pwd`}\\input myfile.tex"
Or write it to a file beforehand and then \read it.  There's no direct
way that I know of.

    Is the \jobname control sequence all I can get from TeX? 

Yes, that's the only primitive.

    Is there a way of calling a linux command, e.g. pwd from TeX?

There is, but it's usually disabled by default because of security, and
it's not expandable.

You can set it for yourself:
  tex --shell-escape myfile.tex

Then you can say, for instance:
  \write18{pwd >/tmp/somefile}
And then \read /tmp/somefile.  Or some variation thereof.

All pretty much of a pain, I'm afraid.


More information about the tex-eplain mailing list