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

Hans Hagen pragma at wxs.nl
Tue Feb 4 13:43:26 CET 2003


At 10:59 PM 2/3/2003 +0100, you wrote:
>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}

hm, i guess that you meant something:

{\catcode`\%=12\gdef\percentstring{%}}

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

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma at wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------



More information about the fptex mailing list