\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}