Ich wᅵrde gerne bei Links durch \autoref auf \section etc. im Anhhang
statt "Abschnitt x.y" gerne "Anhang x.y" raus bekommen. Innerhalb des
Hauptteils solle s natᅵrlich weiter "Abschnitt x.y" heissen.
Ist das mᅵglich? Wann ja, wie?
MfG
Christian
---
\documentclass{minimal}
\usepackage[pdftex]{hyperref}
\begin{document}
\chapter{Doh}
\secion{Mᅵp}
\label{label1}
In \autoref{label} ... % In Abschnitt 1.1 ...
\appendix
\chapter{Foo}
\section{sputnik}
\label{label2}
In \autoref{label2} ... % In Anhang A.1 ...
\end{document}
Der entsprechende Text steht im Makro \sectionautorefname, welches du
umdefinieren kannst:
\documentclass{report}
\usepackage{hyperref}
\begin{document}
\chapter{Doh}
\section{Möp}
\label{label1}
In \autoref{label1} ... % In Abschnitt 1.1 ...
\appendix
\renewcommand*{\sectionautorefname}{Anhang}
\chapter{Foo}
\section{sputnik}
\label{label2}
In \autoref{label2} ... % In Anhang A.1 ...
\end{document}
> \documentclass{minimal}
>
> \usepackage[pdftex]{hyperref}
>
> \begin{document}
>
> \chapter{Doh}
> \secion{Möp}
> \label{label1}
>
> In \autoref{label} ... % In Abschnitt 1.1 ...
>
> \appendix
>
> \chapter{Foo}
> \section{sputnik}
> \label{label2}
>
> In \autoref{label2} ... % In Anhang A.1 ...
>
> \end{document}
Bitte das nächste Mal ein lauffähiges Minimalbeispiel posten.
--
Change “LookInSig” to “tcalveu” to answer by mail.
Das ganze Funktioniert leider nicht mehr, wenn ich zwischen Verlinkungen
des Anhangs und des normalen Teils wechsel (siehe Beispiel).
Ist das auch irgendwie möglich. Mir würde gerade nur die Lösung durch
ein neues Kommando einfallen:
\newommand*{\mycommand}[1]{\renewcommand*{\sectionautorefname}{Anhang}\autoref{#1}\renewcommand*{\sectionautorefname}{Abschnitt}}
Gibts da noch eine bessere Lösung?
MfG
Christian
----------------------
\documentclass{report}
\usepackage{hyperref}
\begin{document}
\chapter{Doh}
\section{Möp}
\label{label1}
In \autoref{label1} ... % In Abschnitt 1.1 ...
In \autoref{label2} ... % In Anhang A.1 ...
\appendix
\renewcommand*{\sectionautorefname}{Anhang}
\chapter{Foo}
\section{sputnik}
\label{label2}
In \autoref{label2} ... % In Anhang A.1 ...
In \autoref{label1} ... % In Abschnitt 1.1 ...
\end{document}
Philipp Stephani schrieb:
Hallo,
folgender Hack sollte funktionieren:
\usepackage{etoolbox}
\usepackage{hyperref}
\makeatletter
\newcommand*{\Hy@sectionstring}{section}
\newcommand*{\Hy@sectapp}{\Hy@sectionstring}
\pretocmd{\appendix}{%
\renewcommand*{\Hy@sectapp}{\Hy@appendixstring}%
}{}{\patch@fail}
\patchcmd{\hyper@makecurrent}{%
\edef\Hy@param{#1}%
}{%
\edef\Hy@param{#1}%
\ifx\Hy@param\Hy@sectionstring
\let\Hy@param\Hy@sectapp
\fi
}{}{\patch@fail}
\newcommand*{\patch@fail}{%
\PackageError{}{Patching failed}{}%
}
\makeatother
Persönlich wäre mir eine Lösung mit zref lieber, aber die
hyperref-Unterstützung steckt wohl noch in den Kinderschuhen.