.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "PERLTEX 1" .TH PERLTEX 1 2024-12-03 v2.3 " " .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME perltex \- enable LaTeX macros to be defined in terms of Perl code .SH SYNOPSIS .IX Header "SYNOPSIS" perltex [\fB\-\-help\fR] [\fB\-\-latex\fR=\fIprogram\fR] [\fB\-\-\fR[\fBno\fR]\fBsafe\fR] [\fB\-\-permit\fR=\fIfeature\fR] [\fB\-\-makesty\fR] [\fIlatex options\fR] .SH DESCRIPTION .IX Header "DESCRIPTION" LaTeX \-\- through the underlying TeX typesetting system \-\- produces beautifully typeset documents but has a macro language that is difficult to program. In particular, support for complex string manipulation is largely lacking. Perl is a popular general-purpose programming language whose forte is string manipulation. However, it has no typesetting capabilities whatsoever. .PP Clearly, Perl's programmability could complement LaTeX's typesetting strengths. \fBperltex\fR is the tool that enables a symbiosis between the two systems. All a user needs to do is compile a LaTeX document using \fBperltex\fR instead of \fBlatex\fR. (\fBperltex\fR is actually a wrapper for \fBlatex\fR, so no \fBlatex\fR functionality is lost.) If the document includes a \f(CW\*(C`\eusepackage{perltex}\*(C'\fR in its preamble, then \&\f(CW\*(C`\eperlnewcommand\*(C'\fR and \f(CW\*(C`\eperlrenewcommand\*(C'\fR macros will be made available. These behave just like LaTeX's \f(CW\*(C`\enewcommand\*(C'\fR and \&\f(CW\*(C`\erenewcommand\*(C'\fR except that the macro body contains Perl code instead of LaTeX code. .SH OPTIONS .IX Header "OPTIONS" \&\fBperltex\fR accepts the following command-line options: .IP \fB\-\-help\fR 4 .IX Item "--help" Display basic usage information. .IP \fB\-\-latex\fR=\fIprogram\fR 4 .IX Item "--latex=program" Specify a program to use instead of \fBlatex\fR. For example, \&\f(CW\*(C`\-\-latex=pdflatex\*(C'\fR would typeset the given document using \&\fBpdflatex\fR instead of ordinary \fBlatex\fR. .IP \fB\-\-\fR[\fBno\fR]\fBsafe\fR 4 .IX Item "--[no]safe" Enable or disable sandboxing. With the default of \fB\-\-safe\fR, \&\fBperltex\fR executes the code from a \f(CW\*(C`\eperlnewcommand\*(C'\fR or \&\f(CW\*(C`\eperlrenewcommand\*(C'\fR macro within a protected environment that prohibits ``unsafe'' operations such as accessing files or executing external programs. Specifying \fB\-\-nosafe\fR gives the LaTeX document \&\fIcarte blanche\fR to execute any arbitrary Perl code, including that which can harm the user's files. See Safe for more information. .IP \fB\-\-permit\fR=\fIfeature\fR 4 .IX Item "--permit=feature" Permit particular Perl operations to be performed. The \fB\-\-permit\fR option, which can be specified more than once on the command line, enables finer-grained control over the \fBperltex\fR sandbox. See Opcode for more information. .IP \fB\-\-makesty\fR 4 .IX Item "--makesty" Generate a LaTeX style file called \fInoperltex.sty\fR. Replacing the document's \f(CW\*(C`\eusepackage{perltex}\*(C'\fR line with \f(CW\*(C`\eusepackage{noperltex}\*(C'\fR produces the same output but does not require PerlTeX, making the document suitable for distribution to people who do not have PerlTeX installed. The disadvantage is that \fInoperltex.sty\fR is specific to the document that produced it. Any changes to the document's PerlTeX macro definitions or macro invocations necessitates rerunning \&\fBperltex\fR with the \fB\-\-makesty\fR option. .PP These options are then followed by whatever options are normally passed to \fBlatex\fR (or whatever program was specified with \&\f(CW\*(C`\-\-latex\*(C'\fR), including, for instance, the name of the \fI.tex\fR file to compile. .SH EXAMPLES .IX Header "EXAMPLES" In its simplest form, \fBperltex\fR is run just like \fBlatex\fR: .PP .Vb 1 \& perltex myfile.tex .Ve .PP To use \fBpdflatex\fR instead of regular \fBlatex\fR, use the \fB\-\-latex\fR option: .PP .Vb 1 \& perltex \-\-latex=pdflatex myfile.tex .Ve .PP If LaTeX gives a ``\f(CW\*(C`trapped by operation mask\*(C'\fR'' error and you trust the \fI.tex\fR file you're trying to compile not to execute malicious Perl code (e.g., because you wrote it yourself), you can disable \&\fBperltex\fR's safety mechansisms with \fB\-\-nosafe\fR: .PP .Vb 1 \& perltex \-\-nosafe myfile.tex .Ve .PP The following command gives documents only \fBperltex\fR's default permissions (\f(CW\*(C`:browse\*(C'\fR) plus the ability to open files and invoke the \&\f(CW\*(C`time\*(C'\fR command: .PP .Vb 2 \& perltex \-\-permit=:browse \-\-permit=:filesys_open \& \-\-permit=time myfile.tex .Ve .SH ENVIRONMENT .IX Header "ENVIRONMENT" \&\fBperltex\fR honors the following environment variables: .IP PERLTEX 4 .IX Item "PERLTEX" Specify the filename of the LaTeX compiler. The LaTeX compiler defaults to ``\f(CW\*(C`latex\*(C'\fR''. The \f(CW\*(C`PERLTEX\*(C'\fR environment variable overrides this default, and the \fB\-\-latex\fR command-line option (see "OPTIONS") overrides that. .SH FILES .IX Header "FILES" While compiling \fIjobname.tex\fR, \fBperltex\fR makes use of the following files: .IP \fIjobname.lgpl\fR 4 .IX Item "jobname.lgpl" log file written by Perl; helpful for debugging Perl macros .IP \fIjobname.topl\fR 4 .IX Item "jobname.topl" information sent from LaTeX to Perl .IP \fIjobname.frpl\fR 4 .IX Item "jobname.frpl" information sent from Perl to LaTeX .IP \fIjobname.tfpl\fR 4 .IX Item "jobname.tfpl" ``flag'' file whose existence indicates that \fIjobname.topl\fR contains valid data .IP \fIjobname.ffpl\fR 4 .IX Item "jobname.ffpl" ``flag'' file whose existence indicates that \fIjobname.frpl\fR contains valid data .IP \fIjobname.dfpl\fR 4 .IX Item "jobname.dfpl" ``flag'' file whose existence indicates that \fIjobname.ffpl\fR has been deleted .IP \fInoperltex\-#.tex\fR 4 .IX Item "noperltex-#.tex" file generated by \fInoperltex.sty\fR for each PerlTeX macro invocation .SH NOTES .IX Header "NOTES" \&\fBperltex\fR's sandbox defaults to what Opcode calls ``\f(CW\*(C`:browse\*(C'\fR''. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBlatex\fR\|(1), \fBpdflatex\fR\|(1), \fBperl\fR\|(1), \fBSafe\fR\|(3pm), \fBOpcode\fR\|(3pm) .SH AUTHOR .IX Header "AUTHOR" Scott Pakin, \fIscott+pt@pakin.org\fR