[fptex] can one capture an environmental variable within a new command in latex?

Heiko Oberdiek oberdiek at uni-freiburg.de
Mon Feb 3 22:59:22 CET 2003


On Mon, Feb 03, 2003 at 02:24:44PM -0600, Luis A Escobar wrote:

> I would like to write a newcommand which captures an environmental
>   variable defined in a windows environment. This could help me to
>   write latex document that depend on environmental variables but which
>   are basically machine independent in terms of paths, location of
>   newcommands, figures, etc. Something like (but
> 
>   \newcommand{mypath}{\getenv{\$HOME}}

You can use the \write18-feature to call system commands,
write it to a file and read this by TeX.

\immediate\write18{echo %HOME%>env.tex}

(you have to enable the feature, eg. on the command line
  latex -shell-escape

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>


More information about the fptex mailing list