페이지 색상만 편집하는 방법

페이지 색상만 편집하는 방법
\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}

관련 정보