Context: I have a number of different documents, and have to apply the same formatting to each of them for consistency. Because the format depends on the page size, I found a class to be more useful than a style.
I have used the following technique in the past, but it is no longer working for me after an update and switching to lualatex 1.14:
mwe.tex:
Code: Select all
\documentclass{mwe}
\begin{document}
.
\end{document}
Code: Select all
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mwe}
% if letterleaf is defined in the Makefile, use letter paper options. Otherwise A4.
\newcommand{\ifletter}[2]{\ifcsname letterleaf\endcsname #1 \else #2 \fi}
\ifletter{
% add to global options list, so it gets passed to typearea.
\xdef\@classoptionslist{\@classoptionslist,paper=letter}
}{}
\LoadClass[12pt,DIV=15]{scrartcl}
Code: Select all
all : mwe-a4.pdf mwe-letter.pdf
mwe-a4.pdf : mwe.tex mwe.cls
lualatex -interaction=nonstopmode -halt-on-error \
--jobname=mwe-a4 mwe.tex
mwe-letter.pdf : mwe.tex mwe.cls
lualatex -interaction=nonstopmode -halt-on-error \
--jobname=mwe-letter \
'\xdef\letterleaf{1}\input{mwe.tex}'
I expect the above to produce two documents, one on A4 paper, and one on US Letter paper. Unfortunately, both documents have the default A4 paper size.
There are no unused global option warnings. If I add "paper=letter" to the \documentclass optional argument, it works, so I know the format is correct - and I can see it's adding the option to \@classoptionslist via tracing.
Do global options no longer use \@classoptionslist? Or is there a better way to achieve this? Thanks for any help.