\documentclass{report}
\usepackage[dvipsnames]{xcolor}
\usepackage[margin=1in]{geometry}
\usepackage{afterpage}
\usepackage{tikz}
\usetikzlibrary{fadings}
\usepackage{geometry,tikz}
\usetikzlibrary{calc}
\usepackage[placement=bottom,scale=1,opacity=1]{background}
\backgroundsetup{contents={%
\begin{tikzpicture}
\fill [red] (current page.north west) rectangle ($(current page.north east)!.25!(current page.south east)$) coordinate (a);
\fill [blue] (current page.south west) rectangle (a);
\end{tikzpicture}}}
\usepackage{kantlipsum}
\usepackage{pagecolor,afterpage}
\usepackage{lipsum}
\begin{document}
\DeclareFixedFont{\titlefont}{T1}{put}{b}{}{1.01in}
\DeclareFixedFont{\subtitlefont}{T1}{ppl}{b}{}{0.5in}
\DeclareFixedFont{\subsubtitlefont}{T1}{ppl}{b}{}{0.3in}
\afterpage{\restoregeometry}
\newgeometry{left=1.5cm, right=1cm,top=1cm, bottom=1cm}
\definecolor{mytan}{HTML}{F6D5A8}
\pagecolor{SpringGreen}\afterpage{\nopagecolor}
\thispagestyle{empty}
\begin{center}
\titlefont\textcolor{yellow}{Notes}
\vspace{4cm}\\
\subsubtitlefont{Benjamín Garcés}
\vspace{1cm}\\
\subtitlefont{RING THEORY}
\vspace{1cm}\\
\subsubtitlefont{First Edition}
\end{center}
\newpagecolor{red}
\afterpage{\afterpage{\restorepagecolor}}
\chapter{Introduction to Module Theory}
\end{document}
我正在尝试创建一个带有颜色的首页。我发现此代码能够将页面的一半涂成一种颜色,将另一半涂成另一种颜色,问题是所有后续页面都是这样的,而我希望它们是白色的。我试过了\newpagecolor
,\pagecolor{white}
但没用。
答案1
如果您有相对较新的 TeX,everypage
则已被弃用,您应该使用新的钩子。
请注意,您的字体设置和包涉及多个冲突:您需要解决这些冲突,否则它们会给您带来麻烦。
\documentclass[11pt]{report}
\usepackage[T1]{fontenc}% for pdfTeX or TeX only
% \usepackage{unicode-math}% for luaTeX or xeTeX only
\usepackage[dvipsnames]{xcolor}
\usepackage[spanish,es-noshorthands]{babel}
\usepackage[left=2cm,right=2cm,bottom=2cm,top=1.5cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{kantlipsum}% don't load in your real document
\begin{document}
\pagecolor{SpringGreen}% not sure where you want this as it ends up behind the blocks of blue and red
\AddToHookNext {shipout/background}
{%
\begin{tikzpicture}[remember picture,overlay]
\fill [red] (current page.north west) rectangle ($(current page.north east)!.25!(current page.south east)$) coordinate (a);
\fill [blue] (current page.south west) rectangle (a);
\end{tikzpicture}%
}%
\AddToHookNext {shipout/after}
{%
\nopagecolor%\restoregeometry
}
\DeclareFixedFont{\titlefont}{T1}{put}{b}{n}{1.01in}% pdfTeX or TeX
\DeclareFixedFont{\subtitlefont}{T1}{ppl}{b}{n}{0.5in}% pdfTeX or TeX
\DeclareFixedFont{\subsubtitlefont}{T1}{ppl}{b}{n}{0.3in}% pdfTeX or TeX
\begin{center}
\titlefont\textcolor{yellow}{NOTES}
\vspace{4cm}\\
\subsubtitlefont{Benjamín Garcés}
\vspace{1cm}\\
\subtitlefont{ADVANCED RING THEORY}
\vspace{1cm}\\
\subsubtitlefont{First Edition}
\end{center}
\clearpage
\kant[1-5]% this is the sole purpose of loading kantlipsum
\end{document}