2

Suppose I have a titlepage like

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

How may its background be colored, while the second, and succeeding pages remain white?

1

2 Answers 2

4

You can switch back to white after your title page:

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

Or you could e.g. use tikz to place a big coloured rectangle behind your title page:

\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}
1
  • IMHO it is better to use \nopagecolor instead of \pagecolor{white}, if the driver supports it.
    – cabohah
    Commented May 29, 2023 at 17:05
2

My answer to a similar question does also work in your case:

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

or with an old 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}

Both result in:

enter image description here

BTW: A figure environment without caption at the title page does not really make sense. You should either just remove \begin{figure}[!htb] and \end{figure} or replace the figure environment by a center environment (and remove \centering).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .