LaTeX CGI Tests

Engine Parameter

By default pdftex, or xelatex if fontspec is used.

  \documentclass{article}
  \usepackage{iftex}
  \newcommand\test[1]{\par\expandafter#1\string#1: true\fi}
  \begin{document}
  \ttfamily
  \test\ifpdftex
  \test\ifluatex
  \test\ifxetex
  \test\ifptex
  \test\ifuptex
  \end{document}

lualatex

%!TEX lualatex
  \documentclass{article}
  \usepackage{iftex}
  \newcommand\test[1]{\par\expandafter#1\string#1: true\fi}
  \begin{document}
  \ttfamily
  \test\ifpdftex
  \test\ifluatex
  \test\ifxetex
  \test\ifptex
  \test\ifuptex
  \end{document}

xelatex

%!TEX xelatex
  \documentclass{article}
  \usepackage{iftex}
  \newcommand\test[1]{\par\expandafter#1\string#1: true\fi}
  \begin{document}
  \ttfamily
  \test\ifpdftex
  \test\ifluatex
  \test\ifxetex
  \test\ifptex
  \test\ifuptex
  \end{document}

Multiple engine comments may be used, all but the first are ignored. uplatex is used here.

%!TEX uplatex
%!TEX xelatex
  \documentclass{article}
  \usepackage{iftex}
  \newcommand\test[1]{\par\expandafter#1\string#1: true\fi}
  \begin{document}
  \ttfamily
  \test\ifpdftex
  \test\ifluatex
  \test\ifxetex
  \test\ifptex
  \test\ifuptex
  \end{document}

Return Parameter

PDF.js

By default using the PDF.js library to render the PDF.

  \documentclass{article}
  \showoutput
  \begin{document}
  Example equation
  \[e=mc^2\]
  \end{document}

Browser PDF default

The browser's default action for PDF files.

%!TeX pdf    
  \documentclass{article}
  \showoutput
  \begin{document}
  Example equation
  \[e=mc^2\]
  \end{document}

Log file

Returning the log file as plain text.

%!TeX log    
  \documentclass{article}
  \showoutput
  \begin{document}
  Example equation
  \[e=mc^2\]
  \end{document}

Makeindex[] Parameter

Multiple !TEX makeindex may be used, each sets a makeindex[] parameter in the form submission.


% !TEX makeindex document
% !TEX makeindex -s nomencl.ist -o document.nls -t document.nlg document.nlo

\documentclass[oneside,12pt]{article}

\usepackage{makeidx}
\makeindex

\usepackage{nomencl}
\makenomenclature

\begin{document}

Testing\index{testing} nomenclature\index{nomenclature}
\[
E = mc^2
\]

\nomenclature{$E$}{Energy}
\nomenclature{$m$}{Mass}
\nomenclature{$c$}{Speed of Light}

\begin{center}
\begin{minipage}[t]{.45\linewidth}
\printnomenclature    
  \end{minipage}\hfill
  \begin{minipage}[t]{.45\linewidth}
\renewenvironment{theindex}{%
\section*{\indexname}}{}
\printindex
  \end{minipage}
\end{center}

\end{document}