![制作一本书籍类文档,在特定部分插页和章节插页上显示特定背景图像](https://linux22.com/image/404448/%E5%88%B6%E4%BD%9C%E4%B8%80%E6%9C%AC%E4%B9%A6%E7%B1%8D%E7%B1%BB%E6%96%87%E6%A1%A3%EF%BC%8C%E5%9C%A8%E7%89%B9%E5%AE%9A%E9%83%A8%E5%88%86%E6%8F%92%E9%A1%B5%E5%92%8C%E7%AB%A0%E8%8A%82%E6%8F%92%E9%A1%B5%E4%B8%8A%E6%98%BE%E7%A4%BA%E7%89%B9%E5%AE%9A%E8%83%8C%E6%99%AF%E5%9B%BE%E5%83%8F.png)
我正在使用 LuaLaTeX 的自定义书籍类准备一份文档。这本书既有章节也有分册,章节和分册末尾会根据需要创建空白页,以便分册和章节的第一页位于右侧。
我想在这些空白页中的特定页面上放置特定的背景图像。我探索了background
和eso-pic
包。我能想到的最接近的是background
包和,我能够在特定部分的所有页面上放置特定图像,包括空白部分。然后我尝试嵌套另一个if
以根据是否pagestyle
为空来选择页面。
下面为第 2 部分的所有页面生成一个特定的背景图像,并为第 3 部分的所有页面生成另一个特定的图像。
根文件如下所示。我尝试添加类文件和前两个包含文件,但帖子的字符限制不允许这样做。
\documentclass[11pt,twoside]{book-based-class}
\usepackage[contents={},pages=some]{background}
\AddEverypageHook{%
\ifnum\value{part}=2\relax
\backgroundsetup{
scale=1,
angle=0,
opacity=0.5,
contents={
\includegraphics{part-image-2}}
}
\fi
\ifnum\value{part}=3\relax
\backgroundsetup{
scale=1,
angle=0,
opacity=0.5,
contents={
\includegraphics{part-image-3}}
}
\fi
\BgMaterial
}
\begin{document}
\frontmatter
\include{./tex/book-test-frontmatter}
\mainmatter
\part{The First Part}
\include{./tex/the-first-chapter}
\include{./tex/the-second-chapter}
\include{./tex/the-third-chapter}
\include{./tex/the-fourth-chapter}
\part{The Second Part}
\include{./tex/the-fifth-chaptery}
\include{./tex/the-sixth-chapter}
\include{./tex/the-seventh-chapter}
\include{./tex/the-eighth-chapter}
\part{The Third Part}
\include{./tex/the-nineth-chapter}
\include{./tex/the-tenth-chapter}
\include{./tex/the-eleventh-chapter}
\part{The Fourht Part}
\include{./tex/the-twelveth-chapter}
\include{./tex/the-thirteenth-chapter}
\part{The Fifth Part}
\include{./tex/the-fourteenth-chapter}
\include{./tex/the-fifteenth-chapter}
\include{./tex/the-sixteenth-chapter}
\include{./tex/the-seventeenth-chapter}
\include{./tex/the-eighteenth-chapter}
\backmatter
\CookbookIndex{}
\end{document}
后来我尝试添加一个嵌套的 if 来测试页面样式是否为empty
真,如果为真则生成一个图像,如果页面样式未empty
使用则不生成任何图像ifthenelse
则不生成任何图像。这没有效果。
我尝试用和替换上面part
的内容chapter
page
适当更改值。但这没有效果。