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

I'm trying to create a front page with colors. I found this code to be able to paint half of a page with one color and the other half with a different one, the problem is that all the following pages were like this, and I want them to be white. I've tried \newpagecolor, \pagecolor{white} and it hasn't worked for me.

9
  • Pls provide a compilable code with \documentclass[]{}, preambule and \begin{document} ... \end{document} Commented Apr 23, 2024 at 23:00
  • Sorry, i dont know how to copy my code. I updated it there, that's what I have. after that comes just text and finally the end{document} Commented Apr 23, 2024 at 23:06
  • It is advised to remove the multiple uses of packages and then minimize the packages not required. Additionally it appears " cor " is defined twice. One of which is in \newtcbtheorem and the other in \newcommand . Commented Apr 24, 2024 at 0:52
  • 1
    Thanks for the suggestion, do you know how to help me with what I need? Commented Apr 24, 2024 at 0:58
  • Welcome or welcome back or ...! You're missing \end{document}, but you should also try to minimise the code you post here to demonstrate the problem by removing preamble we don't need to reproduce it. Commented Apr 24, 2024 at 2:09

1 Answer 1

4

If you have a relatively recent TeX, everypage is deprecated and you should use the new hooks instead.

Note that your font setup and packages involve multiple conflicts: you need to resolve these or they will bite you.

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

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.