PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Part I soll auch im Inhaltsverzeichnis "Part I" heißen



Tim77
17-03-2009, 08:27
Hallo,

ich habe es mit den folgenden gefundenen Schnipseln hinbekommen, Part zu unterstreichen und die Seitenzahl wegzulassen:



%% Linie
\newcommand*{\orig@l@part}{}
\let\orig@l@part\l@part
\renewcommand*{\l@part}[2]{%
\orig@l@part{#1}{#2}
\hrulefill\par% oder was auch immer
}

%% Keine Seitenzahl
\makeatletter
\let\partbackup\l@part
\renewcommand*\l@part[2]{\partbackup{#1}{}}
\makeatother


Meine erste Frage ist: Kann man das evtl. zusammenfassen?

Die viel wichtigere Frage ist: Ich würde gerne statt

"I Prelude"

dort wirklich

"PART I Prelude"

stehen haben. Ist das möglich? Und wenn ja: Wo hake ich mich da ein?

krihaa
17-03-2009, 08:47
Hallo,

so?
\documentclass{scrbook}
%% Linie und keine Seitenzahl
\makeatletter
\newcommand*{\orig@l@part}{}
\let\orig@l@part\l@part
\renewcommand*{\l@part}[2]{%
\orig@l@part{Part #1}{#2}
\hrulefill\par% oder was auch immer
}\let\partbackup\l@part
\renewcommand*\l@part[2]{\partbackup{#1}{}}
\makeatother

\begin{document}
\tableofcontents
\part{Prelude}
\chapter{Intro}

\end{document}
Gruß

Tim77
17-03-2009, 08:59
Wow, danke! Das funktioniert super! Als nächstes würde ich gern schauen wie es aussieht, wenn Part nicht unterstrichen ist, sondern die komplette Zeile stattdessen grau hinterlegt ist.

Wie würde man das machen? Mit einer mbox?

krihaa
17-03-2009, 10:04
Es gibt bestimmt auch ein Paket für solche Wünsche, aber so geht es auch.

\documentclass[ngerman]{scrbook}
\usepackage{babel,xcolor}

\makeatletter
\newcommand*{\orig@l@part}{}
\let\orig@l@part\l@part
\renewcommand*{\l@part}[2]{%
\orig@l@part{%
\rlap{\textcolor{gray!30}{\rule[-0.25cm]{\textwidth}{0.75cm}}}% Farbe, ggf. Laengen anpassen
Part #1}{#2}
%\hrulefill\par% Linie
}\let\partbackup\l@part% Keine Seitenzahl
\renewcommand*\l@part[2]{\partbackup{#1}{}}
\makeatother

\begin{document}
\tableofcontents
\part{Prelude}
\chapter{Intro}

\end{document}
Gruß

Tim77
17-03-2009, 10:29
Danke. Sieht super aus! Wenn Dir (oder jemand anderem) ein fertiges Paket einfällt, mit dem man das erreichen kann, kann man das ja in diesem Thread für die Nachwelt aufheben.

Ich hab die Farben und Abstände etwas angepasst und bin sehr zufrieden.

Tim77
17-03-2009, 14:59
So, habe es jetzt 1mm eingerückt und die Farben geändert (weiss auf grau). Falls es jemanden interessiert:


\makeatletter
\newcommand*{\orig@l@part}{}
\let\orig@l@part\l@part
\renewcommand*{\l@part}[2]{%
\orig@l@part{%
\rlap{\textcolor{gray!80}{\rule[-0.15cm]{\textwidth}{0.60cm}}}% Grau unterlegen. Farbe, ggf. Laengen anpassen
\textcolor{gray!00}{\hspace*{1mm} Part #1}}{#2}
%\hrulefill\par% Linie
}\let\partbackup\l@part% Keine Seitenzahl
\renewcommand*\l@part[2]{\partbackup{#1}{}}
\makeatother

TeXBjoern
18-03-2009, 12:13
Sieht sehr gut aus. Danke, dass Du ein Beispielbild gezeigt hast, so findet man sehr schnell heraus, ob man das selbst Gesuchte/Gewünschte gerade vor sich hat. Der Thread ist jedenfalls in meiner Linkliste gespeichert :)
Vielen Dank, euch beiden.

Tim77
09-07-2011, 14:47
Ich hol den Thread mal wieder hervor:

Ich hab jetzt den Code von krihaa in ein Minimalbeispiel eingebunden und noch ein "\Large" eingefügt. Leider erhalte ich bei vielen Parts eine verrutschte Darstellung (s. Screenshot). Am liebsten wäre mir ein:

Part VII - This is a part

--

\documentclass[]{scrbook}

\usepackage{lipsum}

%% Linie und keine Seitenzahl
\makeatletter
\newcommand*{\orig@l@part}{}
\let\orig@l@part\l@part
\renewcommand*{\l@part}[2]{%
\orig@l@part{\Large Part #1}{#2}
%\hrulefill\par% oder was auch immer
%\hrulefill% oder was auch immer
}\let\partbackup\l@part
\renewcommand*\l@part[2]{\partbackup{#1}{}}
\makeatother

\title{My Book}
\author{The Author}
\date{\today}

% Hier beginnt das eigentliche Dokument.
\begin{document}
\maketitle

\tableofcontents

\part{This is a part}
\chapter{This is a chapter}
\lipsum

\section{This is a section}
\lipsum

\chapter{This is a chapter}
\lipsum

\section{This is a section}
\lipsum

\part{This is a part}
\chapter{This is a chapter}
\lipsum

\section{This is a section}
\lipsum

\chapter{This is a chapter}
\lipsum

\section{This is a section}
\lipsum

\part{This is a part}
\chapter{This is a chapter}
\lipsum

\section{This is a section}
\lipsum

\chapter{This is a chapter}
\lipsum

\section{This is a section}
\lipsum

\part{This is a part}
\chapter{This is a chapter}
\lipsum

\section{This is a section}
\lipsum

\chapter{This is a chapter}
\lipsum

\section{This is a section}
\lipsum

\part{This is a part}
\chapter{This is a chapter}
\lipsum

\section{This is a section}
\lipsum

\chapter{This is a chapter}
\lipsum

\section{This is a section}
\lipsum

\part{This is a part}
\chapter{This is a chapter}
\lipsum

\section{This is a section}
\lipsum

\chapter{This is a chapter}
\lipsum

\section{This is a section}
\lipsum

\part{This is a part}
\chapter{This is a chapter}
\lipsum

\section{This is a section}
\lipsum

\chapter{This is a chapter}
\lipsum

\section{This is a section}
\lipsum

\part{This is a part}
\chapter{This is a chapter}
\lipsum

\section{This is a section}
\lipsum

\chapter{This is a chapter}
\lipsum

\section{This is a section}
\lipsum

\end{document}

mechanicus
09-07-2011, 15:18
Hi,


\documentclass[]{scrbook}
\addtokomafont{partentry}{\Large Part~}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\l@part}{%
\setlength{\@tempdima}{2em}%
}{%
\setlength{\@tempdima}{3em}%
}
\makeatother
\title{My Book}
\author{The Author}
\date{\today}
\begin{document}
\maketitle

\tableofcontents

\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\end{document}
\documentclass{scrartcl}
\usepackage{pstricks-add}

\begin{document}
\psset{,cornersize=absolute,linewidth=0.4cm}

\begin{pspicture}(0,0)(4,4)
\psgrid
\psline[linecolor=blue](0,0)(4,0)(4,4)
\psline[linecolor=yellow](0,0.4)(3.6,.4)(3.6,4)
\end{pspicture}
\qquad
\begin{pspicture}(0,0)(4,4)
\psgrid
\psset{linearc=2cm}
\psline[linecolor=blue](0,0)(4,0)(4,4)
\psline[linecolor=yellow](0,0.4)(3.6,.4)(3.6,4)
\end{pspicture}
\qquad
\begin{pspicture}(0,0)(4,4)
\psgrid
\psset{linearc=2cm}
\psline[linecolor=blue](0,0)(4,0)(4,4)
\psset{linearc=1.6cm}
\psline[linecolor=yellow](0,0.4)(3.6,.4)(3.6,4)
\end{pspicture}
\end{document}



Gruß
Marco

Tim77
10-07-2011, 08:43
Vielen Dank! Das klappt ja sehr gut. Jetzt würde ich als nächstes gerne noch die Seitenzahlen hinter dem Part entfernen. Geht das auch so einfach?

mechanicus
10-07-2011, 09:51
Hi,


\documentclass[]{scrbook}
\addtokomafont{partentry}{\Large Part~}


\usepackage{etoolbox}
\makeatletter
\setkomafont{partentrypagenumber}{\hfil\nobreak\@g obble}
\patchcmd{\l@part}{%
\setlength{\@tempdima}{2em}%
}{%
\setlength{\@tempdima}{3em}%
}
\makeatother

\title{My Book}
\author{The Author}
\date{\today}
\begin{document}
\maketitle
\tableofcontents
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\end{document}

Entscheidende Zeile

\setkomafont{partentrypagenumber}{\hfil\nobreak\@g obble}

Gruß
Marco

Tim77
10-07-2011, 12:03
Vielen Dank. Ich versuch gerade, damit auch die Beschriftung zu ändern:

- "Part - " vor den Zähler.
- Den Punkt hinter dem Zähler entfernen.
- Ein bisschen mit dem Schriftformat experimentieren.

Ich hab gehofft, mit partentry komm ich da weiter, aber das hier klappt leider nicht:

\usepackage{etoolbox}
\makeatletter
\setkomafont{partentrypagenumber}{\hfil\nobreak\@g obble}
\setkomafont{partentry}{\bf\Large \sf }
\patchcmd{\l@part}{%
\setlength{\@tempdima}{2em}%
}{%
\setlength{\@tempdima}{3em}%
}
\makeatother

mechanicus
10-07-2011, 12:19
Hi,

was genau klappt nicht und was genau passt nicht? Es heißt zudem nicht \bf sondern \bfseries. Siehe veraltete Befehle.

Marco

Tim77
10-07-2011, 12:28
Wie Du siehst, hab ich eine Zeile für den partentry hinzugefügt:


...
\setkomafont{partentry}{\bfseries \Large \sf }
...

\bfseries bewirkt aber nichts. \Large und \sf schon.

Außerdem hab ich leider keine Ahnung, wie ich den Text modifiziere, also zB ein "Part - " vor die Nummerierung schreibe und den "." dahinter weg lasse.

mechanicus
10-07-2011, 12:58
Hi,

aber wie sieht der Code insgesamt aus. setkomafont überschreibt alle bisherigen Einstellungen (auch die von addkomafont).

Marco

Tim77
10-07-2011, 13:12
Hier alles schrift-spezifische (ich nutze xelatex):


\usepackage{textcomp}
\usepackage{fontspec}
\usepackage{xltxtra}

\defaultfontfeatures{Mapping=tex-text}
\linespread{1.1}
\setmainfont{Palatino}
\setmonofont{Consolas}
\newcommand{\handwriting}{\fontspec{Handwriting - Dakota}}


\usepackage{etoolbox}
\makeatletter
\setkomafont{partentrypagenumber}{\hfil\nobreak\@g obble}
\setkomafont{partentry}{\bfseries \Large \sf }
\patchcmd{\l@part}{%
\setlength{\@tempdima}{2em}%
}{%
\setlength{\@tempdima}{3em}%
}
\makeatother

mechanicus
10-07-2011, 13:21
Hier alles schrift-spezifische (ich nutze xelatex):


\usepackage{textcomp}
\usepackage{fontspec}
\usepackage{xltxtra}

\defaultfontfeatures{Mapping=tex-text}
\linespread{1.1}
\setmainfont{Palatino}
\setmonofont{Consolas}
\newcommand{\handwriting}{\fontspec{Handwriting - Dakota}}


\usepackage{etoolbox}
\makeatletter
\setkomafont{partentrypagenumber}{\hfil\nobreak\@g obble}
\setkomafont{partentry}{\bfseries \Large \sf }
\patchcmd{\l@part}{%
\setlength{\@tempdima}{2em}%
}{%
\setlength{\@tempdima}{3em}%
}
\makeatother
Hi,

jetzt hast du aber keine Anweisung drin, die Part ins Inhaltsverzeichnis verschiebt? Da fehlt also irgendwas?

Gruß
Marco

Tim77
10-07-2011, 13:34
Versteh ich nicht. Ist Part bei scrbook nicht standardmäßig im Inhaltsverzeichnis?

mechanicus
10-07-2011, 13:38
Versteh ich nicht. Ist Part bei scrbook nicht standardmäßig im Inhaltsverzeichnis?
Ich meine das Wort "Part" ;)

Tim77
10-07-2011, 13:40
Ich meine das Wort "Part" ;)

Ach so. Ja, das stimmt. Ich hab leider keine Ahnung, wo diese hinkommt.

mechanicus
10-07-2011, 13:42
Ach so. Ja, das stimmt. Ich hab leider keine Ahnung, wo diese hinkommt.
ich habe doch oben geschrieben:

\addkomafont{partentry}{\Large\bfseries\sffamily Part~}
das brauchst du wohl?

Tim77
10-07-2011, 14:02
Ah, super. Ich hab ein setkomafont draus gemacht


\usepackage{etoolbox}
\makeatletter
\setkomafont{partentrypagenumber}{\hfil\nobreak\@g obble}
\setkomafont{partentry}{\Large\bfseries\sffamily Part~}
\patchcmd{\l@part}{%
\setlength{\@tempdima}{2em}%
}{%
\setlength{\@tempdima}{3em}%
}
\makeatother

Allerdings fehlt jetzt noch das " - " hinter der römischen Nummer. Dafür sollte der Punkt weg.

mechanicus
10-07-2011, 14:28
Hi,

wir sollten uns angewöhnen, wieder mit Minimalbeispielen zu arbeiten. Man verliert sonst schnell den Überblick ;)


\documentclass[]{scrbook}
\usepackage{etoolbox}
\makeatletter
\setkomafont{partentrypagenumber}{\hfil\nobreak\@g obble}
\setkomafont{partentry}{%
\renewcommand*\autodot{\hfill--\quad\null}%
\Large\bfseries\sffamily Part~}
\patchcmd{\l@part}{%
\setlength{\@tempdima}{2em}%
}{%
\setlength{\@tempdima}{5.5em}%
}
\makeatother

\title{My Book}
\author{The Author}
\date{\today}
\begin{document}
\maketitle
\tableofcontents
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\part{This is a part}
\chapter{This is a chapter}
\section{This is a section}
\chapter{This is a chapter}
\section{This is a section}
\end{document}

Tim77
10-07-2011, 14:51
Danke. Kannst Du mir sagen, welche Abstände hier genau gesetzt werden?

\setlength{\@tempdima}{2em}%
}{%
\setlength{\@tempdima}{5.5em}%

mechanicus
10-07-2011, 14:59
Danke. Kannst Du mir sagen, welche Abstände hier genau gesetzt werden?

\setlength{\@tempdima}{2em}%
}{%
\setlength{\@tempdima}{5.5em}%

Die Breite der Box, welche "Part <NUMMER> --" enthält.

Marco