Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Anhang mit \autoref als Anhang bezeichnen

216 views
Skip to first unread message

Christian Bruckhoff

unread,
Sep 11, 2009, 9:59:36 AM9/11/09
to
Hallo.

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}

Philipp Stephani

unread,
Sep 11, 2009, 11:04:01 AM9/11/09
to
Christian Bruckhoff schrieb:
> Hallo.
>
> 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?

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.

Christian Bruckhoff

unread,
Sep 14, 2009, 4:41:30 AM9/14/09
to
Hallo.

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:

Philipp Stephani

unread,
Sep 14, 2009, 6:58:57 AM9/14/09
to
Christian Bruckhoff schrieb:

> Hallo.
>
> 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?

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.

0 new messages