假设我有一个像这样的标题页
\documentclass[12pt]{book}
\usepackage{lmodern}
\usepackage[left=2.50cm, right=2.54cm, top=2.54cm, bottom=2.54cm]{geometry}
\usepackage{graphicx}
\begin{document}
\begin{titlepage}
\parbox[t]{0.93\textwidth}{
\parbox[t]{0.91\textwidth}{
\raggedleft
\fontsize{50pt}{80pt}\selectfont
The duck who wanted to be a prince
}
}
\begin{figure}[!htb]
\centering
\includegraphics[width = 50mm]{example-image-duck}
\end{figure}
\end{titlepage}
\newpage ~
\end{document}
如何才能使第二页及后续页面保持白色,而其背景颜色为白色呢?
答案1
您可以在标题页之后切换回白色:
\documentclass[12pt]{book}
\usepackage{lmodern}
\usepackage[left=2.50cm, right=2.54cm, top=2.54cm, bottom=2.54cm]{geometry}
\usepackage{graphicx}
\usepackage{xcolor}
\begin{document}
\begin{titlepage}
\pagecolor{red}
\parbox[t]{0.93\textwidth}{
\parbox[t]{0.91\textwidth}{
\raggedleft
\fontsize{50pt}{80pt}\selectfont
The duck who wanted to be a prince
}
}
\begin{figure}[!htb]
\centering
\includegraphics[width = 50mm]{example-image-duck}
\end{figure}
\AddToHookNext{shipout/after}{\pagecolor{white}}
\end{titlepage}
\newpage ~
\end{document}
或者你可以使用 tikz 在标题页后面放置一个大的彩色矩形:
\documentclass[12pt]{book}
\usepackage{lmodern}
\usepackage[left=2.50cm, right=2.54cm, top=2.54cm, bottom=2.54cm]{geometry}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\begin{titlepage}
\begin{tikzpicture}[overlay, remember picture]
\fill[red] (current page.south west) rectangle (current page.north east);
\end{tikzpicture}
\parbox[t]{0.93\textwidth}{
\parbox[t]{0.91\textwidth}{
\raggedleft
\fontsize{50pt}{80pt}\selectfont
The duck who wanted to be a prince
}
}
\begin{figure}[!htb]
\centering
\includegraphics[width = 50mm]{example-image-duck}
\end{figure}
\end{titlepage}
\newpage ~
\end{document}
答案2
我的回答类似的问题也适用于你的情况:
\documentclass[12pt]{book}
\usepackage{lmodern}
\usepackage[left=2.50cm, right=2.54cm, top=2.54cm, bottom=2.54cm]{geometry}
\usepackage{xcolor}
\usepackage{graphicx}
\AddToHook{env/titlepage/begin}{\pagecolor{green}}
\AddToHook{env/titlepage/after}{\nopagecolor}
\begin{document}
\begin{titlepage}
\parbox[t]{0.93\textwidth}{
\parbox[t]{0.91\textwidth}{
\raggedleft
\fontsize{50pt}{80pt}\selectfont
The duck who wanted to be a prince
}
}
\begin{figure}[!htb]% figure environment does not really make sense here
\centering
\includegraphics[width = 50mm]{example-image-duck}
\end{figure}
\end{titlepage}
\newpage ~
\end{document}
或者使用旧的 LaTeX:
\documentclass[12pt]{book}
\usepackage{lmodern}
\usepackage[left=2.50cm, right=2.54cm, top=2.54cm, bottom=2.54cm]{geometry}
\usepackage{xcolor}
\usepackage{graphicx}
\begin{document}
\begin{titlepage}
\pagecolor{green}
\parbox[t]{0.93\textwidth}{
\parbox[t]{0.91\textwidth}{
\raggedleft
\fontsize{50pt}{80pt}\selectfont
The duck who wanted to be a prince
}
}
\begin{figure}[!htb]
\centering
\includegraphics[width = 50mm]{example-image-duck}
\end{figure}
\end{titlepage}
\nopagecolor
\newpage ~
\end{document}
两者的结果是:
顺便说一句:figure
标题页上没有标题的环境实际上毫无意义。您应该删除\begin{figure}[!htb]
和\end{figure}
或figure
用center
环境替换环境(并删除\centering
)。