# leaflet does not work with lualatex

The leaflet documentation explicitly mentions TeX, pdfTeX and VTeX; documents (e.g., leaflet-manual.tex included in TeXLive2016) don't compile properly with lualatex. Any chance to use leaflet with lualatex? I'd rather avoid to install the otf fonts and style files for pdflatex on my box but really need a leporello/flyer.

To make things really strange, my file compiles fine with lualatex under TeXLive2015, but fails under TeXLive2016: Instead of a full leporello, the following minimum example leads to just two columns of text instead of six columns evenly spaced on two A4 pages. Strange, isn't it?

This is an example:

\documentclass{leaflet}
\usepackage{lipsum}
\begin{document}
\lipsum

\lipsum

\lipsum

\lipsum

\lipsum

\lipsum

\lipsum

\lipsum
\end{document}

• I’ve often used leaflet with luatex. Have you tried removing lines like \usepackage[T1]{fontenc} from the manual? Aug 31 '16 at 9:33
• Hmmm. It seems to keep overwriting the first two pages. As a work-around, you can get a flyer by using the nocombine option of the leaflet class, and then making another document, using the article class and the landscape option, with \usepackage{pdfpages} and \includepdf[nup=3x1, pages={5,6,1}]{output.pdf}, \includepdf[nup=3x1, pages={2,3,4}]{output.pdf}. Aug 31 '16 at 19:21
• Option nocombine leads to a pdf with all columns of the leporello on their own pages, as expected. Older versions of leaflet.cls also cause the wrong output otherwise with current TeXLive, so this looks like a regression in lualatex (or one of the packages included by leaflet.cls ...). Sep 1 '16 at 9:06

# Obsolete with actual leaflet version

This answer became obsolete with the actual leaflet 1.1b (2017-03-17) on CTAN.

I found a patch to use leaflet.cls with lualatex in TeXlive 2016.

Below a MWE.

It redefine a part of leaflet.cls (version v1.1a), my modification is marked with insertion start to insertion end

\documentclass[english]{leaflet}
\makeatletter
\@ifundefined{Gin@driver}{}%
{%
\ifx\Gin@driver\@empty\else%
\filename@parse{\Gin@driver}\@tempswafalse%
\def\reserved@a{dvips}%
\ifx\filename@base\reserved@a\@tempswatrue\fi%
\def\reserved@a{dvipdfm}%
\ifx\filename@base\reserved@a\@tempswatrue\fi%
\if@tempswa
\ClassInfo{leaflet}{Generating code for dvips}%
\def\LL@pagesize@specials#1#2{%
\@tempdima=#1\@tempdimb=#2%
\AtBeginDvi{\special{papersize=\the\@tempdima,\the\@tempdimb}}}%
\fi
\def\reserved@a{pdftex}%
\ifx\filename@base\reserved@a
\ClassInfo{leaflet}{Generating code for pdfTeX}%
\def\LL@pagesize@specials#1#2{%
\@tempdima=#1\@tempdimb=#2%
\pdfpagewidth\@tempdima\pdfpageheight\@tempdimb}%
\fi
\def\reserved@a{xetex}%
\ifx\filename@base\reserved@a
\ClassInfo{leaflet}{Generating code for XeTeX}%
\def\LL@pagesize@specials#1#2{%
\@tempdima=#1\@tempdimb=#2%
\pdfpagewidth\@tempdima\pdfpageheight\@tempdimb}%
\fi
%% insertion start %%%%%%%%%
\def\reserved@a{luatex}%
\ifx\filename@base\reserved@a
\RequirePackage{luatex85}
\ClassInfo{leaflet}{Generating code for LuaTeX}%
\def\LL@pagesize@specials#1#2{%
\@tempdima=#1\@tempdimb=#2%
\pdfpagewidth\@tempdima\pdfpageheight\@tempdimb}%
\fi
%% insertion end %%%%%%%%%
\def\reserved@a{vtex}%
\ifx\filename@base\reserved@a
\ClassInfo{leaflet}{Generating code for VTeX}%
\def\LL@pagesize@specials#1#2{%
\@tempdima=#1\@tempdimb=#2%
\mediawidth\@tempdima\mediaheight\@tempdimb}%
\fi
\fi
}
\makeatother
\usepackage{lipsum}
\begin{document}
\lipsum

\lipsum

\lipsum

\lipsum

\lipsum

\lipsum

\lipsum

\lipsum
\end{document}


It works in my installation, but I don't really know what I made :)