I am working a new document class for my personal use. So I am writing a command to generate a title page. I have several issues (this code doesn't produce any errors) :
- First issue : I want to delete the header
Contentsbut I can't use :
\makeatletter
\@starttoc{toc}
\makeatother
Since the command is embedded in a \newcommand statement. It raises errors if I try to use it. I tried the different solutions I found here: How to hide the table of content's heading? and https://latex.org/forum/viewtopic.php?t=8151. None of them worked.
EDIT: This issue is solved. I need to redefine \contentsname after \begin{document}.
- Second issue : If I set a pagecolor when calling the function, the setting is not taken into account and the page remains white.
Here is the full code of the MWE:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{lipsum}
% Packages used in this command :
\usepackage[most]{tcolorbox}
\usepackage{tikz}
\usepackage[object=vectorian]{pgfornament}
\usepackage{xcolor}
\usepackage{pagecolor}
\usepackage[paperheight=21cm,paperwidth=14.85cm,textheight=16cm,textwidth=13.85cm,inner=0.5cm,outer=0.5cm,top=2cm,twoside,showframe,verbose]{geometry}
\newcommand{\myTitlepage}[4]{
\pagenumbering{gobble} % No page number on this titlepage
\thispagestyle{empty}
\newpagecolor{#4} % Changing page color
\newgeometry{paperheight=21cm,paperwidth=14.85cm,top=2cm,left=1cm,right=1cm,bottom=0.5cm}
\begin{titlepage}
\begin{center}
\large #3 -- \today\[2cm]
% Title
{\begin{minipage}\linewidth
\centering
\vskip10pt
\resizebox{\textwidth}{!}{#1}\[1cm]
\pgfornament[width=0.5\textwidth]{68}
\vskip6pt
\end{minipage}}
\vskip10pt
\large #2\
\vspace{1cm}
\begin{tcolorbox}[
breakable,enhanced,title={Table des matières},
colframe=black,colback=white,colbacktitle=white,
fonttitle=\bfseries,coltitle=black,attach boxed title to top center=
{yshift=-0.25mm-\tcboxedtitleheight/2,yshifttext=2mm-\tcboxedtitleheight/2},
boxed title style={boxrule=0.5mm,
frame code={ \path[tcb fill frame] ([xshift=-4mm]frame.west)
-- (frame.north west) -- (frame.north east) -- ([xshift=4mm]frame.east)
-- (frame.south east) -- (frame.south west) -- cycle; },
interior code={ \path[tcb fill interior] ([xshift=-2mm]interior.west)
-- (interior.north west) -- (interior.north east)
-- ([xshift=2mm]interior.east) -- (interior.south east) -- (interior.south west)
-- cycle;} }]
% TOC display
\tableofcontents
\end{tcolorbox}
\vfill
\end{center}
\restorepagecolor
\end{titlepage}
}
\begin{document}
\myTitlepage{A Title}{An Author (me)}{Header}{yellow!25!white}
\section{A section}
\lipsum[1]
\end{document}
How can I solve those two issues please ?
