1

I am creating a form which needs to have an overleaf page of notes on the rear of the first page only. So to be in the correct format, there must be a blank page on every odd page except for the first so that it prints correctly.

The form is filled with JSON data and pre-processed by Jinja2, so as an example:

\documentclass[10pt,a4paper]{article}
\usepackage{tabularray}

\begin{document}
\begin{longtblr}{ colspec = {|X|X|}, rowhead = 1, rowfoot = 1} 
\hline
header & header \\
\BLOCK{ for item in products }
\VAR{item.description} & \VAR{item.cost}\\ % Jinja2 will turn this into a long list of items
\BLOCK{ endfor }
\end{longtblr}
\end{document}

So this for loop can span any number of pages, but I need it to skip every odd/even page so that when printed out in duplex format, it prints correctly (first page -> overleaf notes -> second page -> blank -> third page -> blank ...

Thanks for your help, any suggestions or even a complete rethink of how to do it would be super appreciated

3
  • Maybe locally save \newpage as \oldnewpage and redefine \newpage as \oldnewpage\oldnewpage?
    – L.J.R.
    Jul 28, 2021 at 0:51
  • How would you go about putting a \newpage in the middle of a longtblr/longtable? I've tried to \newpage, \vfill, and \vspace{\fill} inside the table so that it skips ahead a page but it breaks the table Jul 28, 2021 at 1:19
  • I have written an answer.
    – L.J.R.
    Jul 28, 2021 at 1:37

1 Answer 1

4

Since tabularray internally uses \newpage command to break pages, we may redefine the command to get what we want:

\documentclass[10pt,a4paper]{article}

\usepackage[paperwidth=8cm,paperheight=5cm,width=7cm,height=4.1cm]{geometry}
\usepackage{tabularray}

\let\oldnewpage=\newpage
\def\firstnewpage{\oldnewpage overleaf notes\oldnewpage}
\def\othernewpage{\oldnewpage\hbox{}\oldnewpage}

\begin{document}
Odd Page \newpage
\begingroup
\def\newpage{\firstnewpage\let\newpage=\othernewpage}
\begin{longtblr}{ colspec = {|X|X|}, rowhead = 1, rowfoot = 1} 
\hline
Header & Header \\
\hline
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
item.description & item.cost \\
\hline
Footer & Footer \\
\hline
\end{longtblr}
\endgroup
\end{document}

enter image description here

3
  • Awesome! Works perfectly. Thank you very much! Jul 28, 2021 at 2:01
  • @ChrisMacdonald Then you may accept this answer by clicking the check mark in the top left corner.
    – L.J.R.
    Jul 28, 2021 at 2:04
  • @L.J.R., its amazing ^^
    – relinquere
    Aug 28, 2022 at 8:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .