在定义具有条件背景的文档时,应仅在\mainmatter
页面中放置装饰物,而不包括标题页。以下是包含相关代码的行:
\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}
即使条件有些多余(在我看来),它仍然有效。
现在我需要添加一个带有编辑器徽标的封底页(空白页也可以),但没有装饰...我想通过修改条件背景来实现这一点,但只要我能看见,我就无法这样做。我尝试了几种方法修改条件,但得到的都是编译错误。这是文档结构:
\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}
我该如何解决这个问题?我需要一个条件来排除封底页中的装饰,并且我需要这一页是偶数页,这样它就可以成为小册子的最后一页。
答案1
可以使用以下代码实现偶数页的放置:
\clearpage \ifodd\value{page}\hbox{}\newpage\fi