
Ich möchte die Verweise auf einen Anhangsabschnitt für einen Teil meines Dokuments ändern: Ich möchte „Anhang A.1“ im Haupttext und „Abschnitt A.1“ im Anhang.
Ich habe Folgendes versucht:
\documentclass{scrartcl}
\usepackage{cleveref}
\begin{document}
\cref{foo} and \cref{bar}
\appendix
\crefname{subappendix}{section}{sections}
\section{Foo}\label{foo}
\cref{foo} and \cref{bar}
\subsection{Bar}\label{bar}
\end{document}
Ich habe eine Ausgabe wie die folgende erwartet:
Anhang A und Anhang A.1
Ein Foo
Anhang A undAbschnitt A.1
A.1 Balken
Aber ich bekomme im Anhang auch „Anhang A.1“.
Es scheint, als ob ich es nur \crefname
in der Präambel verwenden kann und es sich auf das gesamte Dokument auswirkt. Gibt es eine Möglichkeit, den Referenznamen nur für den Anhang zu ändern?
Antwort1
Das apptools
Paket führt relevante Konditionalsätze ein \IfAppendix
und \ifappendix
:
\documentclass{scrartcl}
\usepackage{cleveref}
\usepackage{apptools}
\crefname{subappendix}{\IfAppendix{section}{appendix}}{\IfAppendix{sections}{appendices}s}
\begin{document}
\cref{foo} and \cref{bar}
\appendix
\section{Foo}\label{foo}
\cref{foo} and \cref{bar}
\subsection{Bar}\label{bar}
\end{document}