PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Hyperref und addtoContents



procrash
11-04-2008, 13:00
Hallo Gurus,

sobald ich hyperref in mein Dokument einbinde bekomme ich folgende Fehlermeldung:

argument of contensline has an extra }

Ich habe den Fehler nun auf folgende Codestelle im Tex Dokument rediziert:


\newcommand\mypart[1]{ % aussehen Inhalte Seite Parts ohne Nummerierung
\refstepcounter{part}
\part*{\textcolor{gray}{#1}}
\phantomsection
\addtocontents{toc}{\protect\contentsline{part}{\h space{0.85cm}\textcolor{gray}{\LARGE{\textbf{#1}}} }{}}
\part*{}
}


Das Problem scheint am addtocontents Kommando zu liegen, die mir diesen Punkt ins Inhaltverzeichnis aufnimmt.

Jetzt hab ich im Netz an mehreren Stellen gelesen dass man vor addtocontents ein phantomsection setzen sollte damit das mit hyperref funktioniert.

Tex spuckt mir allerdings immer noch die Fehlermeldung aus. Irgendwelche Ideen woran es liegen könnte???

rais
11-04-2008, 22:19
Moin moin,


sobald ich hyperref in mein Dokument einbinde bekomme ich folgende Fehlermeldung:

argument of contensline has an extra }

das kann ich nicht verifizieren, aber: \contentsline wird afaik vom hyperref-Paket um einen Parameter erweitert...
Es steht Dir natürlich frei, ein komplettes Minimalbeispiel (http://www.minimalbeispiel.de) zu erstellen, welches das von Dir beschriebene Verhalten auch demonstriert.;)

BTW: Wozu benutzt Du zweimal \part* in Deinem \mypart?

MfG

procrash
13-04-2008, 22:37
Hi,

hoffentlich greifst du dir nicht gleich an den Kopf, aber das zweite part*{} ist dazu da eine Leerseite zu erzeugen. Da ich ein zweiseitiges Layout habe wollte ich dadurch erreichen das die Rückseite bei parts immer frei bleibt.
clearpage und cleardoublepage oder newpage funktionierten leider nich. Deswegen der dreckige Hack.

Ich erstelle euch mal ein Minimalbeispiel das man das verhalten sieht...

procrash
14-04-2008, 08:39
So wie versprochen mein Minimalbeispiel:

Wie euch beim setzen auffallen wird sind die Nummerierungen im Inhaltsverzeichnis nicht 2 seitig. Außerdem wenn ich das Paket hyperref einbinde bekomme ich im 2ten setzdurchlauf Fehler



\documentclass[11pt, twoside,a4paper,headsepline,tocleft, liststotocnumbered]{scrreprt}

\usepackage{amsmath}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}

\usepackage{colortbl}
\usepackage{xcolor}
\pagestyle{fancy}
\definecolor{numbersGrey}{rgb}{0.8,0.8,0.8}


\makeatletter
\renewcommand*{\@evenfoot}{
\set@tempdima@hw\hss\hb@xt@ \@tempdima{\vbox{
\if@fsl \hrule \vskip 3\p@ \fi
\hb@xt@ \@tempdima{{\pnumfont\color{numbersGrey}\hspace{-0.3cm}\rule[-0.07cm]{0.6cm}{0.4cm} \color{black}\thepage\hfil}}}}}
\renewcommand*{\@oddfoot}{
\set@tempdima@hw\hb@xt@ \@tempdima{\vbox{
\if@fsl \hrule \vskip 3\p@ \fi
\hb@xt@ \@tempdima{{\pnumfont\hfil\color{numbersGrey}\rule[-0.07cm]{0.6cm}{0.4cm} \color{black}\thepage}}}}\hss}
\makeatother

\fancyfoot[LO]{\color{numbersGrey}\rule[-0.07cm]{0.6cm}{0.4cm} \color{black}\thepage}
\fancyfoot[RE]{\color{numbersGrey}\rule[-0.07cm]{0.6cm}{0.4cm} \color{black}\thepage}


\fancypagestyle{headings}{%
\fancyhf{} % clear all header and footer fields
\fancyfoot[LO]{\leftmargin=-\marginparwidth \color{numbersGrey}\rule[-0.07cm]{0.6cm}{0.4cm} \color{black}\thepage}
\fancyfoot[RE]{\color{numbersGrey}\rule[-0.07cm]{0.6cm}{0.4cm} \color{black}\thepage}

\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}}

\renewcommand*{\chapterpagestyle}{headings}
\renewcommand*{\partpagestyle}{headings}

\numberwithin{chapter}{part}
\renewcommand\thechapter{\arabic{chapter}}


\newcommand\mypart[1]{ % aussehen Inhalte Seite Parts ohne Nummerierung
\refstepcounter{part}
\part*{\textcolor{gray}{#1}}
%\phantomsection
\addtocontents{toc}{\protect\contentsline{part}{\h space{1.1cm}\textcolor{gray}{\LARGE{\textbf{#1}}}} {}}
\part*{}
}

\addto\captionsngerman{ % aussehen Inhalsverzeichnis Überschrift
\renewcommand{\contentsname}{
\hspace{-0.67cm}
\color{lightgray}
\protect\rule[-0.25cm]{1cm}{1cm}\hspace{0.2cm}\color{black}Inhalte
}}


\setcounter{tocdepth}{3} % Nummerierungstiefe 3


%\usepackage{hyperref}
%\hypersetup{breaklinks=true}

% Parts in Kapitel Nummerierungen
\makeatletter
\renewcommand*\thepart{\@arabic\c@part}
\renewcommand*\thechapter{\thepart.\@arabic\c@chap ter}
\makeatother

\begin{document}

\lhead{}
\rhead{}
\cfoot{}
\rfoot{}
% TODO: HIER LEERSEITE EINFÜGEN
\rfoot{}
\lfoot{}
\cleardoublepage
\small
\renewcommand{\headrulewidth}{0pt}

\tableofcontents% Einleitung und Motivation
\clearpage

\normalsize
\hspace{-0.4cm}\LARGE{Vorwort}\small\\\\ %Zusammenfassung
Iblablablubb
\pagenumbering{arabic}

\setcounter{page}{1}
\mypart{Einleitung}
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\chapter{Motivation} %Vorwort
\mypart{Einleitung}
\chapter{Motivation} %Vorwort
\end{document}

Stefan_K
14-04-2008, 15:02
Hallo Wolfgang,

die Fehlermeldung gibt einen Hinweis, und Rainer gab auch schon einen Rat in diese Richtung: erweitere den Parameter für \addcontentsline:
\addtocontents{toc}{\protect\contentsline{part}... {\LARGE{\textbf{#1}}}}{}{}}

Wegen der Nummerierung, prüf nochmal mal Deine fancy-settings ... ich würde mit scrreprt aber lieber scrpage2 anstelle von fancyhdr verwenden. Falls Du darauf umstellen würdest, erledigt sich das Problem vielleicht nebenher.

Viele Grüße,

Stefan

procrash
22-04-2008, 19:43
Hallo Stefan,

so wie es scheint wird mein komplettes Inhaltsverzeichnis vom Hyperref jetzt an einem Part aufgehängt. Das liegt anscheinend daran das hyperref die Hierarchieordnung nicht zurücksetzt.

Kennt sich jemand von euch etwas mit hyperref aus?

Stefan_K
22-04-2008, 20:51
Hallo Wolfgang,

kannst Du das Problem spezifizieren? Was meinst Du mit 'an einem Part aufgehängt'?
Was ich oben schrieb, habe ich an Deinem angegebenen Minimalbeispiel getestet, das funktionierte. Kannst Du das jetzige Problem anhand Deinem Beispiel, entsprechend modifiziert, zeigen, oder ein neues Beispiel geben?

Stefan

Donalduck
22-04-2008, 22:25
Hat sich wohl erledigt, siehe hier (http://groups.google.de/group/de.comp.text.tex/browse_thread/thread/b1ba8808c6bf4bf0#)

Stefan_K
22-04-2008, 22:56
Hallo Donald,

danke fürs Informieren! Evtl. spare ich mir ein anderes Mal die Überlegungen, wenn damit zu rechnen ist, dass das Problem schon gelöst ist und nur nicht den anderen Bescheid gesagt wurde, denen man die betreffende Frage auch gestellt hat.

Stefan