[pdftex] launching programs...
G. D. Brettschneider
pdftex at GDBrettschneider.de
Fri Sep 5 18:31:06 CEST 2003
Thierry Bouche wrote:
>
> (...) I could prefer to send a command to execute to the system directly
> (xemacs file.tex, e.g., assuming command is on the system path) and I
> would like to have such a feature as much OS-independant as possible (...)
>
In case you're talking about launching programs during *runtime* of the
pdftex engine, set
shell_escape = t
in texmf.cnf. Then define a system macro
\def \system #1{\immediate \write 18 {#1}}
and start your experiments with something like this ( which brings a
list of environment variables):
\system {set > envivar.txt}
\parindent = 0mm \par
% Display environment variables which contain characters
% like "$", "_", "<", "\":
\bgroup
% Enable linebreak after ":" and ";":
\long \def \colon #1{%
\def \first {#1}%
\ifx \first \backslash :\backslash \else
\ifx \first \slash : \slash \else
\ifx \first \slash :\par \hskip \baselineskip \slash \else
\ifx \first \par :\par \hskip \baselineskip \fi \fi \fi \fi}%
\long \def \semicolon {;\par \hskip \baselineskip}%
\catcode `\: = 13 % active
\catcode `\; = 13 % active
\catcode `\_ = 12 % other
\catcode `\$ = 12 % other
\catcode `\< = 0 % escape
\catcode `\\ = 12 % other
% Now use "<" instead of "\" as escape character,
% and don't read linebreak as whitespace:
<obeylines
% Enable linebreak after ":" and ";":
<def <backslash {\}%
<def <slash {\}%
<let ; = <semicolon
<let : = <colon
% Load and display generated file:
<input envivar.txt
<par <vfill
<egroup
In practice, since system commands usually are given different names and
options on DOS/Windows and UNIX/Linux, you may have to write both a
batch file and a shell script with the same base name in order to
execute an OS-independent command.
Regards,
Gerolf
More information about the pdftex
mailing list