1

I want to generate multiple pdf files with different font sizes. I referred to this solution, and formed the following code.

% test.tex
\documentclass{article}
\usepackage{shellesc}
\ShellEscape{%
  lualatex --jobname="\jobname-8pt"
  "\PassOptionsToClass{8pt}{article}"
}%
\ShellEscape{%
  lualatex --jobname="\jobname-12pt"
  "\PassOptionsToClass{12pt}{article}"
}%
\expandafter\stop

\begin{document} Hello world. \end{document}

It doesn't work with the -shell-escape flag on the terminal. What is the correct way of coding this? What is the purpose of \gdef\string and \string\input\space\jobname in the original answer?

Niranjan
  • 3,435

1 Answers1

2

You need to input the document again. The \string commands are used in order to avoid TeX expanding the commands, which would produce rubbish in the command line passed by \ShellEsc.

You also need a conditional to skip over the \ShellEsc part when doing the real typesetting.

I changed article into amsart, because there is no 8pt option for the former.

\documentclass{amsart}
\usepackage{shellesc}

\ifdefined\dotypesetting\else \edef\typesettingcommand#1{% lualatex --jobname='\jobname-#1' '\gdef\string\dotypesetting{}% the \else part will be skipped \string\PassOptionsToClass{#1}{amsart}% pass the option \string\input{\jobname}'% input the document } \ShellEscape{\typesettingcommand{8pt}}% do the first run \ShellEscape{\typesettingcommand{12pt}}% do the second run \expandafter\stop \fi

\begin{document} Hello world. \end{document}

egreg
  • 1,121,712