# Create two-page altenating 'front' and 'back' backgrounds

I need to loop a list of names in a CSV file, and for each new name (row), create a page using a background "front" and add the name in the right side, say ~75% from left.

Then create a new page, with just the background "back" since we would print as double-sided paper.

Here's what I have so far, except from 3rd page onwards, it seems to merge both front and back backgrounds onto the same page.

\documentclass[12pt, a5paper,landscape]{memoir} % Use memoir for vplace

\usepackage[utf8]{inputenc} % required for characters like: ÃŽ Ã§ etc.
\usepackage{color}
\usepackage{wallpaper} % For background image frame

% Load database 'names' from file 'namelist.csv'

\begin{document}
\color{white}
\pagestyle{empty}

% For each record (line) in database 'names'
\DTLforeach{names}
{\firstname=First, \lastname=Last}{
{
\begin{vplace}[1.4]
\raggedleft{\bfseries\MakeUppercase{\firstname}} {\bfseries\MakeUppercase{\lastname}}
\end{vplace}
\vspace{\fill}
\leavevmode\thispagestyle{empty}\newpage
\clearpage
}
{
\vspace{\fill}
\leavevmode\thispagestyle{empty}\newpage
\clearpage
\newpage
\cleardoublepage
}
}

\end{document}


Reading from CSV works fine, adding a background - for just say front and outputting - was working fine before but I needed to add the new 2nd page in-between for the 'back' background. I tried adding \vspace{\fill} around and using different variations of \clearpage vs \newpage but still get weird output for 3rd page (5th page etc.).

Here is a solution that should do what you need. The changes:

• \pagestyle{empty} in the preamble saves you from \thispagestyle{empty} on every page.

• As you already discovered, you have to use \ThisTileWallPaper instead of \TileWallPaper.

• Put the name into a box of width zero, centered. After that you have only to position this center, e.g. with \hspace*, and the name will extend to both sides symmetrically.

\hspace*{12.1cm}\makebox[0pt]{First Name Second Name}

• To position the name vertically, add \vspace*{3cm} above.

.

\documentclass[12pt,a5paper,landscape]{memoir} % Use memoir for vplace
\usepackage[utf8]{inputenc} % required for characters like: ÃŽ Ã§ etc.
\usepackage{color}
\usepackage{wallpaper} % For background image frame

% Load database 'names' from file 'namelist.csv'
\pagestyle{empty}
\begin{document}
\color{white}

% For each record (line) in database 'names'
\DTLforeach{names}
{\firstname=First, \lastname=Last}%
\vspace*{3cm}
\hspace*{12.1cm}\makebox[0pt]{%
\begin{tabular}{c}
\bfseries\MakeUppercase{\firstname} \MakeUppercase{\lastname}\\[3mm]
Some more stuff\\[3mm]
Even more of it
\end{tabular}%
}
\clearpage
\mbox{}\clearpage
}

\end{document}

• Ah that works well - I had tested vpace but now with the * character. Thanks a lot @gernot ! – dan2k3k4 Feb 13 '17 at 22:28
• @dan2k3k4 You are welcome. Good luck with the event. Sounds interesting, in a great surrounding. – gernot Feb 13 '17 at 22:37
• Thanks :) mmm what if I want to add new lines of text ? something like: \vspace*{\fill} then \hspace*{12.1cm}\makebox[0pt]{\bfseries\MakeUppercase{\newtext}} doesn't really allow for actual vertical position? but I guess I just do it without \fill – dan2k3k4 Feb 13 '17 at 22:39
• @dan2k3k4 I have modified the solution a bit, with a suggestion how to add more stuff. – gernot Feb 13 '17 at 22:46

Ah ok I seem to have found out I needed to use \ThisTileWallPaper and not \TileWallPaper - now I just need to correctly position the text to be 'centered' around the 75% mark (from far left being 0%... 50% being default center... etc.) \raggedleft doesn't really fix that problem for me but it helps for now.

\documentclass[12pt, a5paper,landscape,twoside]{memoir} % Use memoir for vplace

\setlength{\pdfpagewidth}{\paperwidth}
\setlength{\pdfpageheight}{\paperheight}

\usepackage[utf8]{inputenc} % required for characters like: ÃŽ Ã§ etc.
\usepackage{color}
\usepackage{wallpaper} % For background image frame

% Load database 'names' from file 'namelist.csv'

\begin{document}
\color{white}
\pagestyle{empty}
% For each record (line) in database 'names'
\DTLforeach{names}{\firstname=First, \lastname=Last}{
{