3

I have a document with several \part while I wrote all lower sections in \paragraph. In the ToC all is working as I which, just the \part parts (sorry for the wording...) are displayed in a strange way: LaTeX prints plus 1.0fil in the same line, right at the same spot the the numbering of the part.

Why is that? Does anyone know how to get rid of that? Is my (lengthy) preamble guilty of this?

The best would be to get rid of the numbering of the \part. I'd use \chapter, but in the text section it doesn't have the same formatting as \part (and frankly I haven't been able to understand why).

As you might have understood from why and how I'm writing I'm not a LaTeX pro. I have some understanding of programming, but it didn't help to get me out of this.

Sorry for the long file. I can't abridge it without possibly making it impossible to see what's going on.

Looking forward to any comment.

Here's my test file (most of it is preamble):

\AtBeginDocument{\newcommand{\version}{Version 0.0.1}}
 % support copying from PDF and full text search
% (together with cmap.sty (v.i.):
\input glyphtounicode
\pdfgentounicode=1

\documentclass[%
           ,abstracton % centered headline in abstract
           ,smallheadings % small headlines
          ,headsepline,         % Trennline zum Seitenkopf  
           ]%
           {scrartcl}  % KOMA-Script article class

\usepackage{cmap} % (v.s.)
\usepackage[T1]{fontenc}   % T1 font encoding
\usepackage[utf8]{inputenc} % utf8 input encoding (Linux/Mac), oder "applemac"
\usepackage{%
  ,amsmath %für die schicken Pfeile mit Beschriftung
  ,soul         % underline(, Sperren,  strike through...)
  ,array        % extensions for tables
  ,booktabs     %       "        "      "
  ,supertabular % multi-page tables
  ,longtable    %      "          "    
  ,xcolor       % use colours
  ,colortbl     % colours in table cells
  ,textcomp     % extra (special) signs
  ,natbib       % layout of citations
  ,calc         % calculation with LaTeX results and counters
  ,url          % typeset urls
  ,tocloft      % format tables (TOC, LOF, LOT)
  ,graphicx     % include graphics
  ,paralist     % extra list environments
  ,multicol     % multi-column 
  ,ragged2e     % improve hyphenation with ragged typesetting
  ,fixltx2e     % correct bugs and extends Latex2e
  ,makeidx      % create index
  ,tikz         % \fbox-replacement with tikz and replacement of PSTricks     examples
  ,xspace % Leerzeichen nach Kontrollsequenz, z. B. \latex
    }

\makeindex % generate .idx-file -> MakeIndex
       % or xindy

\usepackage[english,ngerman]{babel} % language support
\usepackage[ngerman]{varioref}      % intelligent cross referencing
% TODO: careful with varioref!
\usepackage[right]{eurosym} % Euro-sign ( Euro-Symbol
                        %  following number)

% page number directly following TOC-entry:
% \section level
\renewcommand{\cftsecleader}{}
\renewcommand{\cftsecafterpnum}{\cftparfillskip}
% \subsection level
\renewcommand{\cftsubsecleader}{}
\renewcommand{\cftsubsecafterpnum}{\cftparfillskip}
% decrease margin in front of TOC entries
\setlength{\cftbeforesecskip}{.4\baselineskip}
\setlength{\cftbeforesubsecskip}{.1\baselineskip}

% Neue Option fürlongtable, um Tabellen > \textwidth auf der Seite
% zu zentrieren unter
% Berücksichtigung des im Rand zur Verfügung stehenden Freiraums. 
\makeatletter
\let\ORG@LT@array\LT@array
\def\LT@array[#1]{%
  \if C#1%
    \setlength{\@tempdima}{\oddsidemargin}
    \addtolength{\@tempdima}{1in}
    \LTleft=0pt plus 1fill minus \@tempdima
    \LTright=\LTleft
    \expandafter\ORG@LT@array\expandafter[\expandafter x\expandafter]%
  \else
    \@ReturnAfterFi{%
      \ORG@LT@array[{#1}]%
    }%
  \fi
}
\long\def\@ReturnAfterFi#1\fi{\fi#1}
\makeatother

\usepackage[T1]{fontenc}
\IfFileExists{tgpagella.sty}{% Palatino
    \usepackage{tgpagella}}{}


%Wenn man MinionPro hat... 
%\usepackage{MinionPro}         % serif: Adobe MinionPro
%\usepackage{MyriadPro}         % sans : Adobe MyriadPro
%\usepackage[scaled=.92]{thesans} % typewriter: TheSansMono
%\linespread{1.05} % slightly increaseleading for MinionPro

\typearea{8} % Satzspiegelberechnung gemäß DIVcalc nach Laden des
             % Schrift-Pakets durchführen

% Optischer Randausgleich und font expansion, letzteres in 3er-Schritten
% bei maximalem Schrumpfen und Ausdehnen um 1,5%
\usepackage{microtype} 
\microtypesetup{stretch=15,shrink=15,step=3}
\usepackage{lmodern}


\usepackage[toc]{multitoc} % TOC in mehreren Spalten setzen

% um Tabellenspalten mit Flattersatz zu setzen, muss \\ vor
% (z.B.) \raggedright geschätzt werden:
\newcommand{\PreserveBackslash}[1]{\let\temp=\\#1\let\\=\temp}
%
% Spalten mit Flattersatz:
% left justified:
\newcolumntype{L}[1]{>{\PreserveBackslash\RaggedRight}m{#1}}
\newcolumntype{M}[1]{>{\PreserveBackslash\RaggedRight}p{#1}}
% right justified (not used in document):
\newcolumntype{R}[1]{>{\PreserveBackslash\RaggedLeft}m{#1}}
\newcolumntype{S}[1]{>{\PreserveBackslash\RaggedLeft}p{#1}}
% centred (not used in document:
\newcolumntype{Z}[1]{>{\PreserveBackslash\Centering}m{#1}}
\newcolumntype{A}[1]{>{\PreserveBackslash\Centering}p{#1}}

% Tabellen mit grauem Header und grauer hline am Ende und entsprechend
% eingestellten Schriften (in diesem Fall nur fett); Verwendung über
% \hdrow (s.u.)
%
% left justified:
\newcolumntype{H}{>{\fontseries{b}\selectfont%
    \columncolor[gray]{.8}[6pt][0pt]}l}
% centred (not used in document):
\newcolumntype{I}{>{\fontseries{b}\selectfont%
    \columncolor[gray]{.8}[6pt][0pt]}c}
% right justified (not used in document):
\newcolumntype{J}{>{\fontseries{b}\selectfont%
    \columncolor[gray]{.8}[6pt][0pt]}r}
%
\newcommand{\hdrow}[2]{%
  \multicolumn{1}{#1@{}}{%
    \raisebox{.1mm}{% Ausrichtung der Beschriftung
      #2%
    }\rule{0pt}{4mm}}% invisible line to increase the headline
} 

% Alternative ohne \multicolumn und \columncolor, direkt über \rowcolor:
%\newcommand{\Hdrow}[1]{\rowcolor[gray]{.8}#1 \\\addlinespace}

\newenvironment{tabelle}[2][c]{         %
  \renewcommand{\arraystretch}{1.2}     % Größere Abstände zwischen Zeilen
  \sffamily\small                                       %         Serifenlose und kleine Schrift
  \begin{longtable}[#1]{#2}
  }
  {\end{longtable}\renewcommand{\arraystretch}{1}% Abstände wieder
                                                 % zurücksetzen 
  \normalfont % reset font
  }

% Auch Abbildung und nicht nur die Nummer wird zum Link (abgeleitet
% aus Posting von Heiko Oberdiek;
% Verwendung: In \abbvref{label} ist ein Beispiel dargestellt
\providecommand*{\abbvrefname}{Abbildung}
\newcommand*{\abbvref}[1]{%
  \hyperref[#1]{\abbvrefname}\vref{#1}%
}

%% Box, die den Rahmen in einem Zug zieht, was zu schöneren Ergebnissen
%% fährt als \fbox:
\newcommand*{\tikzbox}[1]{%
  \tikz[baseline=(tikzbox.base)]
   \node[draw, inner sep=\fboxsep+.5\fboxrule, line width=\fboxrule]
    (tikzbox)
    {#1};%
}

%% Sperrung mit pdfTeX >= 1.40.3
\usepackage{relsize}
% Sperrung und Verkleinerung von Versalien
\newcommand{\versal}[1]{\textscale{0.9}{\textls*[80]{#1}}}
% Sperrung von Gemeinen
\newcommand{\gemein}[1]{\textls*[70]{#1}}

% Seitenstil festlegen:
\usepackage[%
            automark % automatic actualisation of column titles
           ]
{scrpage2}
% Linker Kopf leer:
\ihead{} 
% Zentrierter Kopf:
\chead{typoshort -- Some important typographic rules, \version}
% Schrift in Kolumnentiteln klein und kursiv:
\setkomafont{pagehead}{\normalfont\small\itshape}
% Zeitenzahl in MinionPro:
\setkomafont{pagenumber}{\normalfont}
% Überschriften zentriert, blau und in Serifenschrift:
\addtokomafont{sectioning}{\centering\color{myblue}\rmfamily}
% \caption fett:
\addtokomafont{captionlabel}{\bfseries}
% Label der description-Umgebung in Serifenschrift:
\addtokomafont{descriptionlabel}{\rmfamily}

% footnotes in two columns
\usepackage{dblfnote}
% Keine hochgestellten Ziffern in der Fußnote (KOMA-Script-spezifisch):
\deffootnote[1.5em]{0pt}{1em}{\makebox[1.5em][l]{\bfseries\thefootnotemark}} 
% increase space between footnote paragraphs:
\setlength{\footnotesep}{.85\baselineskip}

\renewcommand{\footnoterule}{}             % no line
\addtolength{\skip\footins}{\baselineskip} % distance text to footnote
% Fuänoten immer ganz unten auf einer \raggedbottom-Seite
\usepackage{fnpos}

\raggedbottom     % Variable Seitenhähen zulassen

\usepackage[%
  breaklinks               % Links überstehender Zeilenumbruch
  ,colorlinks              % coloured links instead of boxes
  ,citecolor=myblue        % colour for citations
  ,linkcolor=myblue        % influences table of contents
  ,urlcolor=myblue         % colour for URLs
  ,bookmarks               % bookmarks for PDF-Viewer
  ,bookmarksnumbered       % numbering for bookmarks
  ,hyperfootnotes=false    % No links to footnotes
  ,pdfpagelabels
  ,pdfstartview=FitH,      % open document "Fit Width"
  ,pdfpagemode=UseOutlines % show bookmarks in viewer
  ,bookmarksopenlevel=2    % Gliederungstiefe der Bookmarks
  ] 
  {hyperref}               % automatic links in PDF and some
                           % hypertext-functionalities 


% Farbdefinitionen:
\definecolor{myblue}{rgb}{0,.1,.6}
\definecolor{myblue2}{rgb}{0,.4,.6}
\definecolor{grau}{gray}{.4}

\usepackage[figure]{hypcap} % Links auf Gleitumgebungen springen nicht
                        % zur Beschriftung, sondern zum Anfang der
                        % Gleitumgebung 
% 3-spaltiger Index
\makeatletter
\renewenvironment{theindex}{%
  \begin{multicols}{3}[\section*{\indexname}][19\baselineskip]%
    \setlength{\parindent}{0pt}\pagestyle{plain}\let\item\@idxitem}
   {\end{multicols}}

% Ränder anpassen
\usepackage{anysize}
\marginsize{2.5cm}{2.5cm}{2.0cm}{2.0cm}  % links, rechts, oben, unten   

% Seitenstyle
\pagestyle{scrheadings}
\clearscrheadfoot
\setheadwidth{textwithmarginpar}
\ihead{HämatoOnko Ultrakurz}    % Titel der Arbeit oben links
\ohead{\pagemark}           % Seitenzahl oben rechts
\renewcommand{\baselinestretch}{1.1}

%Inhaltsverzeichnis soll \paragraph zeigen...
\setcounter{tocdepth}{5}
\usepackage{blindtext}
% TOC Styles
\usepackage[tocflat]{tocstyle}
\usetocstyle{allwithdot} 

\usepackage{enumitem}  %Reduziert space zwischen \items;                   

\setlist{nolistsep}

%\usepackage{paralist}  % Alternative für engere Listen, 
\makeatother

\usepackage{ellipsis}       % Korrekte Abstände um \dots (als letztes
            % Paket laden)
%---------------------------------------------------------------------
% Text
%---------------------------------------------------------------------


\begin{document}

\ifpdf
    \DeclareGraphicsExtensions{.pdf,.jpg,.png}
\else
    \DeclareGraphicsExtensions{.eps}
\fi

\title{HämatoOnko Ultrakurz}

\maketitle

\tableofcontents            % Inhaltsverzeichnis

\part{Allgemeines}

\paragraph{Hauptfunktionen der Zellen der Hämatopoiese}

\begin{itemize}
\item Thrombozyten:  Gerinnung
\item Leukozyten:  Spezifische und unspezifische Immunantwort
\item Erythrozyten: $O_{2}$-Transport
\end{itemize}

100 ml Blut enthalten ca. 15g Hb und 20 ml $O_{2}$. 1 g Hb
kann also 1,3 ml $O_{2}$ binden.

\part{Entwicklung}


\paragraph{Entwicklung und Reifung der Blutzellen}p

Alle drei Reihen von Blutzellen entwickeln sich (normalerweise im Knochenmark)     aus hämatopoeischen Stammzellen. Faktoren, die die Entwicklung lenken und beeinflussen sind: 

\begin{itemize}
\item der Stammzellfaktor SCF\footnote{Auch stem cell factor, Kit-Ligand oder     steel factor. Hämatopoietischer Wachstumsfaktor.}
  \item die Wachstumsfaktoren G-CSF\footnote{Colony stimulating factor: Zytokine, die das Wachtstum stimulieren (Wachstumsfaktoren). G: Granulozyten, M: Makrophagen, GM: Granulozyten+Makrophagen}, M-CSF, GM-CSF
\item   Interleukin\footnote{Zu den Zytokinen zählende Peptidhormone, die     körpereigene Botenstoffe der Zellen des Immunsystems.} 3 und 6
 \item  Erythropoetin und Thrombopoetin\footnote{Auch Meg-CSF (Megakaryozyten) oder PGF (platelet growth factor) genannt.}.
\end{itemize}


\end{document}
4
  • 1
    tocstyle together with \addtokomafont{sectioning}{\centering} provoke the described behavior.
    – user4686
    Commented Apr 5, 2014 at 17:36
  • I recommend you post this question with the MWE in my answer on the d.c.t.tex usenet (german language) forum because the author of both KOMA-script and tocstyle is active there.
    – user4686
    Commented Apr 5, 2014 at 18:21
  • A suggestion: Do us a favour and change your username to something more telling than "user1234".
    – Speravir
    Commented Apr 7, 2014 at 0:29
  • BTW your code is not a minimal working example (MWE) at all. As you obviously are a German speaker you could also read Was ist ein Minimalbeispiel?.
    – Speravir
    Commented Apr 7, 2014 at 0:34

2 Answers 2

2

I have informed Markus Kohm by e-mail yesterday. He already has mailed back, and now I’m a bit upset that I did not think myself on this before writing mail …

The reason is that you’ve misused \setkomafont for a command that does not change font properties, but the alignment. Read what is written in scrguien.pdf (you could, of course, also read scrguide.pdf) in section for \setkomafont and companions (emphasis by me):

Theoretically, all possible statements including literal text could be used as commands. You should, however, absolutely limit yourself to those statements that really switch only one font attribute. […] Color switching commands […] are also acceptable. The behavior when using other commands, especially those that make redefinitions or generate output, is not defined. Strange behavior is possible and does not represent a bug.

Instead you should use the dedicated commands \raggedpart and \raggedsection.

See the following almost minimal example. Note, that apart from adding the two commands above and removing not needed packages I made some more changes – instead of your \typearea I used the documentclass option DIV; instead of deprecated smallheadings I used the documented option, instead of anysize I used the more recent and better adjustable geometry; instead of scrpage2 (not yet deprecated, but it will with next main KOMA-Script version 3.13) I used its successor scrlayer-scrpage. I also added an option to tocstyle, but that’s just a design decision and so a matter of taste. \setheadwidth{textwithmarginpar} is deactivated, because it did not work well, it would have probably needed more fine tuning.

\documentclass[%
  ,DIV=8          % calculation of type area
  ,headings=small % small headlines
  ,headsepline    % Trennline zum Seitenkopf
]{scrartcl}  % KOMA-Script article class

\usepackage{fixltx2e}

\usepackage[
  ,hmargin=2cm
  ,vmargin=2.5cm
]{geometry}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{lmodern}
\usepackage{tgpagella}% overwrites only \rmdefault of "lmodern"

\input glyphtounicode
\pdfgentounicode=1

\usepackage[english,ngerman]{babel} % language support

\usepackage{xcolor}
\definecolor{myblue}{RGB}{0,25,150}

\usepackage{ragged2e}

% Optischer Randausgleich und font expansion, letzteres in 3er-Schritten
% bei maximalem Schrumpfen und Ausdehnen um 1,5%
\usepackage{microtype}
\microtypesetup{stretch=15,shrink=15,step=3}

% Seitenstil festlegen:
\usepackage[%
  automark % automatic actualisation of column titles
]{scrlayer-scrpage}
% Seitenstyle
\pagestyle{scrheadings}
\clearscrheadfoot
%\setheadwidth{textwithmarginpar}
\ihead{HämatoOnko Ultrakurz} % Linker Kopf
\chead{} % Zentrierter Kopf
\ohead{\pagemark} % Seitenzahl oben rechts
% Schrift in Kolumnentiteln klein und kursiv:
\setkomafont{pagehead}{\normalfont\small\itshape}
\setkomafont{pagenumber}{\normalfont}

% TOC Styles
\usepackage[tocflat,toctextentriesindented]{tocstyle}% toctext... added
\usetocstyle{allwithdot}

\usepackage[toc]{multitoc} % TOC in mehreren Spalten setzen

%Inhaltsverzeichnis soll \paragraph zeigen...
\setcounter{tocdepth}{5}

% Überschriften zentriert, blau und in Serifenschrift:
\addtokomafont{sectioning}{\color{myblue}\rmfamily}
\renewcommand*{\raggedpart}{\Centering}
\renewcommand*{\raggedsection}{\Centering}

\renewcommand{\baselinestretch}{1.1}

\begin{document}

%\title{HämatoOnko Ultrakurz}
%\date{Sunday. bloody Sunday}
%\maketitle

\tableofcontents

\part{Allgemeines}

\section{Hämatopoiese}

\paragraph{Hauptfunktionen der Zellen der Hämatopoiese}

100\,ml~Blut enthalten ca.~15\,g~Hb und 20\,ml~$O_{2}$. 1\,g~Hb
kann also 1,3\,ml~$O_{2}$ binden.

\part{Entwicklung}

\section{Blutzellen}

\paragraph{Entwicklung und Reifung der Blutzellen}

Alle drei Reihen von Blutzellen entwickeln sich (normalerweise im Knochenmark)
aus hämatopoeischen Stammzellen. Faktoren, die die Entwicklung lenken und beeinflussen sind:

\end{document}

output of example code

1
  • Thanks a lot @Speravir and @jfbu! Meanwhile I came up with a kind-of-a-solution as well, concerning the command <p> %\addtokomafont{sectioning{\centering\color{myblue}\rmfamily}, where leaving out "centering" produces a very nice index: <p> \addtokomafont{sectioning}{\color{myblue}\rmfamily} <p>. Thanks to all!
    – Michael
    Commented Apr 7, 2014 at 17:56
0

The problem comes from the interaction between

\addtokomafont{sectioning}{\centering}

and the loading of package tocstyle. I am not familiar with KOMA-script hence can't tell if \centering is a kosher argument to \addtokomafont{sectioning}. Anyhow, tocstyle does things (seemingly requiring some typesetting in a box to measure things) which results at some point in the following definition:

> \tocstyle@l@part=macro:
->\@dottedtocline {-1}{-21.90005pt plus 1.0fil}{21.90005pt}.

Also, \let\l@part\tocstyle@l@part is done. Clearly the glue specification -21.90005pt plus 1.0fil is not something \@dottedtocline expects as second argument (it sets the paragraph indentation to that value, and this must a dimension not a glue).

Thus, this \centering interacts badly with tocstyle redefinition of the toc line styles. But perhaps it was illegal to pass \centering as argument to \addtokomafont{sectioning} anyhow?


For people interested to investigate this question here is a MWE:

\documentclass{scrartcl}  % KOMA-Script article class

\addtokomafont{sectioning}{\centering}

\usepackage{tocstyle}

\begin{document}
\tableofcontents   

\part{Allgemeines}

\part{Entwicklung}

\end{document}

bug in toc

3
  • Great, thanks! When I leave %\usepackage[tocflat]{tocstyle} %\usetocstyle{allwithdot} out the Index seems to work properly, but my lesser sections (\paragraph) are now aligned right. Would you be willing to suggest something concerning the alignment of the index? When commenting the \addtokomafont lines concerning the index I would loose my nice formatting. Thanks again, Michael
    – Michael
    Commented Apr 5, 2014 at 18:31
  • Jean-François, see my answer. Your doubts were right ("… if \centering is a kosher argument …").
    – Speravir
    Commented Apr 7, 2014 at 3:01
  • @Speravir well done!
    – user4686
    Commented Apr 7, 2014 at 5:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .