3

In defined a document with a conditional background, this should place ornaments only in \mainmatter pages and exclude the title page. These are the lines with the relevant code:

\usepackage[utf8]{inputenc} 
\usepackage[italian]{babel}
\usepackage[T1]{fontenc} 
\usepackage{verse}
\usepackage{background}
\usepackage[object=vectorian]{pgfornament}
\usepackage{svg}
\usepackage{wallpaper}
\usepackage[osf]{libertine}

\usetikzlibrary{backgrounds, calc}

\makeatletter%
\newcommand{\editor}[1]{%
    \def\@editor{#1}%
}

\newcommand{\theeditor}{%
    \@editor%
}
\makeatother

\newcommand{\eachpageornament}{%
    \begin{tikzpicture}[remember picture, overlay, color=LimeGreen]%
        \transparent{0.75}{%
            \node[anchor=north west](CNW) at (current page.north west){\pgfornament[width=2cm]{61}};%
            \node[anchor=north east](CNE) at (current page.north east){\pgfornament[width=2cm,symmetry=v]{61}};%
            \node[anchor=south west](CSW) at (current page.south west){\pgfornament[width=2cm,symmetry=h]{61}};%
            \node[anchor=south east](CSE) at (current page.south east){\pgfornament[width=2cm,symmetry=c]{61}};%
            \pgfornamenthline{CNW}{CNE}{north}{87}%
            \pgfornamenthline{CSW}{CSE}{south}{87}%
            \pgfornamentvline{CNW}{CSW}{west}{87}%
            \pgfornamentvline{CNE}{CSE}{east}{87}%
        }%
    \end{tikzpicture}
}

\newcommand{\plogo}{%
    \includegraphics[width = 30mm]{logo.png}%
}

\newcommand{\psignature}{%
    \begin{flushright}
        \def\svgwidth{40mm}%
        \input{signature.pdf_tex}%
    \end{flushright}
}

\newcommand{\myback}{%
    \begin{vplace}[0.7]
        \begin{center}
            \includegraphics[width = 60mm]{logo_red.png}%
        \end{center}    
    \end{vplace}
}

\newcommand{\mytitle}{
    \thispagestyle{empty}%
    \ThisCenterWallPaper{1.1}{sfondo}%
    \begin{tikzpicture}[remember picture, overlay]{%
        \transparent{0.95}\node [rectangle, rounded corners, fill=LimeGreen, anchor=south west, minimum width=6cm, minimum height=8cm] (box) at (-0.5,-10) (box){};}%
        \node[anchor=west, xshift=-2.0cm, yshift=-1cm, text width=4cm] at (box.north){\large \textit{\theeditor}};%
        \node[anchor=west, xshift=-2.0cm, yshift=-3.5cm, text width=4cm] at (box.north){\huge \thetitle};%
        \node[anchor=west, xshift=-2.0cm, yshift=-6cm, text width=4cm] at (box.north){\large \theauthor};%
    \end{tikzpicture}
    \newpage
}

\makeatletter
\backgroundsetup{%
    contents={%
        \if@mainmatter%
            \eachpageornament \thepage%
        \else%
        \ifnum\value {page}=1%
        \else%
            \eachpageornament \thepage%
        \fi%
        \fi%
    },
    position=current page.north east,
    angle=0,
    scale=1,
    opacity=1
}
\makeatother

\renewcommand{\poemtoc}{section}
\renewcommand{\poemtitlefont}{\normalfont\large\itshape\centering} 

\pagestyle{plain}

\setcounter{tocdepth}{2}

This's working even if the condition is somewhat redundant (in my opition).

Now I need to add a back cover page with editor logo (but also a blank page is fine) but without ornaments ... I tought to do so modifying the conditional background but as long as I can see I'm not able to do so. I tried to modify the condition in several ways but all I got are compilation errors. This's the document structure:

\documentclass[dvipsnames,a5paper,twoside,openright,italian,12pt]{memoir}

\input{defines}

\author{Me}
\date{2016}
\title{Title}
\editor{Editor}

\begin{document}

\frontmatter

\mytitle

\tableofcontents

\include{Preface}

\mainmatter

\include{Chapter01}

\include{Chapter02}

\backmatter

\newpage
\thispagestyle{empty}
\myback

\end{document}

How can I fix this? I need a condition to exclude ornaments from the back cover page and I nedd this page to be an even page so it can be the last page on a booklet.

  • I noticed that option openright interferes forcing the back cover page to open in the right and thus forcing latex to place extra page(s) to force it to be in a odd page that obviously lead it to be NOT in the back cover. – weirdgyn Aug 22 '16 at 12:39
1

the placement in the even page can be achieved with this code:

\clearpage \ifodd\value{page}\hbox{}\newpage\fi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.