
\contentsname
Wenn ich mit anpasse \renewcommand
, stelle ich fest, dass die Existenz von \pagestyle{fancy}
oder \thispagestyle{fancy}
dazu führt, dass die Kompilierung fehlschlägt. Ich kann das nicht verstehen. Warum? Ist das ein Problem von \contentsname
oder des Pakets fancyhdr
?
MWE:
\documentclass{article}
\usepackage{geometry,fancyhdr}
\geometry{showframe}
\begin{document}
\pagestyle{fancy}% This command leads to un-compiled. If this command is commented, or replaced by\pagestyle{plain}, everyting is all right.
\renewcommand\contentsname{%
\LARGE%
\centering%
my\\ content%
}
\tableofcontents
\section{section}
text
\end{document}
PS: Ich habe festgestellt, dass der Fehlergrund auf Makros zurückzuführen ist, \centering
die mit Positionen wie in Zusammenhang stehen. Andere Makros, die nicht mit Positionen wie in Zusammenhang stehen , wirken sich nicht auf \renewcommand\contentsname aus.\\
\color
\Large
Antwort1
\documentclass{article}
\usepackage{geometry,fancyhdr,titlesec,xcolor}
\geometry{showframe}
\begin{document}
\pagestyle{fancy}% This command leads to un-compiled. If this command is commented, or replaced by\pagestyle{plain}, everyting is all right.
\renewcommand\contentsname{%
My \\ content%
}
{
\titleformat*{\section}{\vspace*{-0.5\baselineskip}\centering \LARGE\color{red}}
\tableofcontents
}
\section{section}
text
\end{document}