Discussion:
Problem: nameref, autoref, caption und label
(zu alt für eine Antwort)
Jörg H.
2007-08-07 05:52:27 UTC
Permalink
Hallo zusammen,
autoref funktioniert nicht korrekt, wenn folgendes Minimalbeispiel
verwendet wird:


\documentclass[draft]{report}
\usepackage{nameref}
\usepackage{hyperref}


\begin{document}
\begin{figure}[htb]
\caption{\label{lbl}f}
\end{figure}
\autoref{lbl}
\end{document}



\nameref{} wird an einer anderen Stelle außerhalb des Minimalbeispiels
verwendet, daher wird das Paket nameref benötigt. Beheben lässt sich
das Problem, wenn man

\caption{f}\label{lbl}

schreibt oder die final-Option verwendet. Meine Frage ist in diesem
Zusammenhang, ob dieses Konstrukt einen Nachteil bringt. Ich bevorzuge
das Konstrukt aus dem Minimalbeispiel, weil die Marke immer mit der
Bildunterschrift verbunden ist; möglicherweise ein irrationale
Präferenz. Gibt es einen guten Grund an \label{} innerhalb von
\caption{} festzuhalten?

Grüße,
Jörg
Heiko Oberdiek
2007-08-07 07:06:47 UTC
Permalink
Post by Jörg H.
Hallo zusammen,
autoref funktioniert nicht korrekt, wenn folgendes Minimalbeispiel
\documentclass[draft]{report}
\usepackage{nameref}
\usepackage{hyperref}
Du hast die Funktionalität mit draft weitgehend ausgeschaltet.

\usepackage[final]{hyperref}

Viele Grüße
Heiko <***@uni-freiburg.de>
Jörg H.
2007-08-07 07:32:50 UTC
Permalink
Post by Heiko Oberdiek
Post by Jörg H.
Hallo zusammen,
autoref funktioniert nicht korrekt, wenn folgendes Minimalbeispiel
\documentclass[draft]{report}
\usepackage{nameref}
\usepackage{hyperref}
Du hast die Funktionalität mit draft weitgehend ausgeschaltet.
\usepackage[final]{hyperref}
Hallo Heiko,
danke für den Tipp (funktioniert), aber sollte - ich will mich nicht
richtig beschweren, weil ich hyperref gerne benutze - es bei der
Verwendung von draft (ohne zusätzliche Option final bei Paket hyperref}
u.U. nicht zu einem Fehler kommen?

Grüße,
Jörg
Heiko Oberdiek
2007-08-07 07:57:43 UTC
Permalink
Post by Jörg H.
Post by Heiko Oberdiek
\usepackage[final]{hyperref}
danke für den Tipp (funktioniert), aber sollte - ich will mich nicht
richtig beschweren, weil ich hyperref gerne benutze - es bei der
Verwendung von draft (ohne zusätzliche Option final bei Paket hyperref}
u.U. nicht zu einem Fehler kommen?
Warum? hyperref kennt sowohl draft als auch final.

Viele Grüße
Heiko <***@uni-freiburg.de>
Jörg H.
2007-08-07 08:58:02 UTC
Permalink
Post by Heiko Oberdiek
Post by Jörg H.
Post by Heiko Oberdiek
\usepackage[final]{hyperref}
danke für den Tipp (funktioniert), aber sollte - ich will mich nicht
richtig beschweren, weil ich hyperref gerne benutze - es bei der
Verwendung von draft (ohne zusätzliche Option final bei Paket hyperref}
u.U. nicht zu einem Fehler kommen?
Warum? hyperref kennt sowohl draft als auch final.
Hmm,
aber dieses Beispiel bricht bei mir mit einer Fehlermeldung ab:

\documentclass[final]{report}
\usepackage{nameref}
\usepackage[draft]{hyperref}


\begin{document}

\begin{figure}[htb]
\caption{\label{lbl}}
\end{figure}

\autoref{lbl}


\end{document}


Fehlermeldung:
! Use of \***@link@ doesn't match its definition.
\***@write ***@protect \edef \***@a {
\write #1{#3}}\***@a ...
l.12 \autoref{lbl}


.log-Datei

This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6) (format=pdflatex
2007.8.6) 7 AUG 2007 10:53
entering extended mode
\write18 enabled.
%&-line parsing enabled.
**namereftest.tex
(./namereftest.tex
LaTeX2e <2005/12/01>
Babel <v3.8h> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, arabic, basque, bulgarian, coptic, welsh, czech, slovak, german, ng
erman, danish, esperanto, spanish, catalan, galician, estonian, farsi, finnish,
french, greek, monogreek, ancientgreek, croatian, hungarian, interlingua, ibyc
us, indonesian, icelandic, italian, latin, mongolian, dutch, norsk, polish, por
tuguese, pinyin, romanian, russian, slovenian, uppersorbian, serbian, swedish,
turkish, ukenglish, ukrainian, loaded.
(/usr/local/texlive/2007/texmf-dist/tex/latex/base/report.cls
Document Class: report 2005/09/16 v1.4f Standard LaTeX document class
(/usr/local/texlive/2007/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2005/09/16 v1.4f Standard LaTeX file (size option)
)
\***@part=\count79
\***@chapter=\count80
\***@section=\count81
\***@subsection=\count82
\***@subsubsection=\count83
\***@paragraph=\count84
\***@subparagraph=\count85
\***@figure=\count86
\***@table=\count87
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/local/texlive/2007/texmf-dist/tex/latex/hyperref/nameref.sty
Package: nameref 2007/05/29 v2.31 Cross-referencing by name of section

(/usr/local/texlive/2007/texmf-dist/tex/latex/oberdiek/refcount.sty
Package: refcount 2006/02/20 v3.0 Data extraction from references (HO)
)
\***@section@level=\count88
LaTeX Info: Redefining \ref on input line 236.
LaTeX Info: Redefining \pageref on input line 236.
)
(/usr/local/texlive/2007/texmf-dist/tex/latex/hyperref/hyperref.sty
Package: hyperref 2007/06/14 v6.76i Hypertext links for LaTeX

(/usr/local/texlive/2007/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 1999/03/16 v1.13 key=value parser (DPC)
\***@toks@=\toks14
)
(/usr/local/texlive/2007/texmf-dist/tex/latex/oberdiek/hycolor.sty
Package: hycolor 2007/04/11 v1.1 Code for color options of hyperref/bookmark (H
O)
)
\@linkdim=\dimen103
\***@linkcounter=\count89
\***@pagecounter=\count90

(/usr/local/texlive/2007/texmf-dist/tex/latex/hyperref/pd1enc.def
File: pd1enc.def 2007/06/14 v6.76i Hyperref: PDFDocEncoding definition (HO)
)
(/usr/local/texlive/2007/texmf-dist/tex/generic/oberdiek/etexcmds.sty
Package: etexcmds 2007/05/06 v1.0 Providing prefix for e-TeX command names (HO)


(/usr/local/texlive/2007/texmf-dist/tex/generic/oberdiek/infwarerr.sty
Package: infwarerr 2007/06/14 v1.1 Providing info/warning/message (HO)
))
(/usr/local/texlive/2007/texmf/tex/latex/config/hyperref.cfg
File: hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
)
(/usr/local/texlive/2007/texmf-dist/tex/latex/oberdiek/kvoptions.sty
Package: kvoptions 2007/06/11 v2.7 Connects package keyval with LaTeX options (
HO)
)
Package hyperref Info: Option `final' set `true' on input line 2537.
Package hyperref Info: Option `draft' set `true' on input line 2537.
Package hyperref Info: Hyper figures OFF on input line 2571.
Package hyperref Info: Link nesting OFF on input line 2576.
Package hyperref Info: Hyper index ON on input line 2579.
Package hyperref Info: Plain pages OFF on input line 2586.
Package hyperref Info: Backreferencing OFF on input line 2591.

Implicit mode ON; LaTeX internals redefined
Package hyperref Info: Bookmarks ON on input line 2741.
(/usr/local/texlive/2007/texmf-dist/tex/latex/ltxmisc/url.sty
\Urlmuskip=\muskip10
Package: url 2005/06/27 ver 3.2 Verb mode for urls, etc.
)
LaTeX Info: Redefining \url on input line 2909.
\***@menulength=\count91
\***@Width=\dimen104
\***@charsize=\dimen105
\***@toks=\toks15
\***@toks=\toks16
Package hyperref Info: Hyper figures OFF on input line 3393.
Package hyperref Info: Link nesting OFF on input line 3398.
Package hyperref Info: Hyper index ON on input line 3401.
Package hyperref Info: backreferencing OFF on input line 3408.
Package hyperref Info: Link coloring OFF on input line 3413.
\***@abspage=\count92
\***@Item=\count93
\***@Hfootnote=\count94
)
*hyperref using default driver hpdftex*
(/usr/local/texlive/2007/texmf-dist/tex/latex/hyperref/hpdftex.def
File: hpdftex.def 2007/06/14 v6.76i Hyperref driver for pdfTeX
\***@listcount=\count95
)
(./namereftest.aux)
\openout1 = `namereftest.aux'.

LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.


Package hyperref Warning: draft mode on.

Package hyperref Info: Link coloring OFF on input line 6.
LaTeX Info: Redefining \ref on input line 6.
LaTeX Info: Redefining \pageref on input line 6.
! Use of \***@link@ doesn't match its definition.
\***@write ***@protect \edef \***@a {
\write #1{#3}}\***@a ...
l.12 \autoref{lbl}

?
! Use of \***@link@ doesn't match its definition.
\***@write ... #1{#3}}\***@a \endgroup
\***@nobreak \ifvmode \nobr...
l.12 \autoref{lbl}

? x

Here is how much of TeX's memory you used:
2356 strings out of 94073
34248 string characters out of 1162985
85378 words of memory out of 1500000
5689 multiletter control sequences out of 10000+50000
3640 words of font info for 14 fonts, out of 1200000 for 2000
645 hyphenation exceptions out of 8191
26i,3n,21p,171b,161s stack positions out of 5000i,500n,6000p,200000b,5000s
No pages of output.
PDF statistics:
4 PDF objects out of 1000 (max. 8388607)
0 named destinations out of 1000 (max. 131072)
17 words of extra memory for PDF output out of 10000 (max. 10000000)
Dominik Waßenhoven
2007-08-07 09:06:41 UTC
Permalink
Post by Jörg H.
Post by Heiko Oberdiek
hyperref kennt sowohl draft als auch final.
Hmm,
\documentclass[final]{report}
\usepackage{nameref}
\usepackage[draft]{hyperref}
\begin{document}
\begin{figure}[htb]
\caption{\label{lbl}}
\end{figure}
\autoref{lbl}
\end{document}
Ich würde draft und final genau andersherum setzen, dann funktioniert es
auch:

\documentclass[draft]{report}
\usepackage{nameref}
\usepackage[final]{hyperref}

\begin{document}
\begin{figure}[htb]
\caption{\label{lbl}}
\end{figure}

\autoref{lbl}

\end{document}

Gruß,
Dominik.-
--
DE-TeX-FAQ: http://www.dante.de/faq/de-tex-faq
Minimalbeispiel: http://www.minimalbeispiel.de
JabRef-Handbuch: http://kuerzer.de/jabref-handbuch
Jörg H.
2007-08-07 09:12:55 UTC
Permalink
On 2007-08-07 11:06:41 +0200, =?ISO-8859-1?Q?Dominik_Wa=DFenhoven?=
Post by Jörg H.
Post by Jörg H.
Post by Heiko Oberdiek
hyperref kennt sowohl draft als auch final.
Hmm,
\documentclass[final]{report}
\usepackage{nameref}
\usepackage[draft]{hyperref}
\begin{document}
\begin{figure}[htb]
\caption{\label{lbl}}
\end{figure}
\autoref{lbl}
\end{document}
\documentclass[draft]{report}
\usepackage{nameref}
\usepackage[final]{hyperref}
\begin{document}
\begin{figure}[htb]
\caption{\label{lbl}}
\end{figure}
\autoref{lbl}
\end{document}
Gruß,
Dominik.-
Hallo Dominik,
funktioniert bei mir auch (und hatte ich auch probiert), aber... wenn
hyperref mit draft umgehen kann, dann dürfte/sollte meines Erachtens
der Fehler nicht auftreten. Mein letztes Minimalbeispiel sollte nach
meinem Verständnis (und so hatte ich Heiko auch verstanden) in der
Theorie funktionieren.

Grüße,
Jörg
Heiko Oberdiek
2007-08-07 09:25:38 UTC
Permalink
Post by Jörg H.
\usepackage[draft]{hyperref}
\autoref{lbl}
Wird in nächster Version behoben sein.

Viele Grüße
Heiko <***@uni-freiburg.de>
Jörg H.
2007-08-08 08:49:44 UTC
Permalink
Post by Heiko Oberdiek
Post by Jörg H.
\usepackage[draft]{hyperref}
\autoref{lbl}
Wird in nächster Version behoben sein.
Super.

Loading...