Final Update (2018-05-18)
Version 1.34 of
paracolwith the fix related to this question is availabe on CTAN now.
- I use a KOMA document class in combination with the
paracolpackage. - The final purpose of the document is a bilingual document (two languages, two synchronized columns).
- In my real document, I color the heading of level
subparagraph(here I use red). \addtokomafont{subparagraph}{\color{red}} - My problem is that the color of the
subparagraphon some page break circumstances produces that the normal text is also colored. - I have trouble narrowing down the problem and making the code minimal: Different page break and the problem/effect is gone.
% Dokumentenklasse inkl. Optionen
\documentclass[
fontsize = 12pt
,headings = small
,parskip = true
,numbers = noendperiod
,chapterprefix = true
]{scrbook}
%% Seitenlayout
\usepackage[
%showframe = true,
showframe = false,
]{geometry}
% Seiten-Dimensionen
\geometry{paperwidth = 300mm} % Format 16:9
\geometry{paperheight = 168.75mm} % Format 16:9
\geometry{margin = 15mm}
\geometry{marginparsep = 2mm}
\geometry{marginparwidth = 8mm}
\geometry{footskip = 14mm}
% Color Support
\usepackage{xcolor}
% paracol
\usepackage{paracol}
\setlength{\columnseprule}{1pt}
\setlength{\columnsep}{2em}
\addtokomafont{subparagraph}{\color{red}}
% http://texwelt.de/wissen/fragen/10289/wie-andere-ich-die-abstande-uberunter-section-subsection-subsubsection
\RedeclareSectionCommand[
beforeskip = 0\baselineskip,
afterskip = 1\baselineskip,
innerskip = 0\baselineskip]{chapter}
\RedeclareSectionCommand[
beforeskip = 0\baselineskip,
afterskip = 0.25\baselineskip]{section}
\RedeclareSectionCommand[
beforeskip = 0\baselineskip,
afterskip = 1sp]{subparagraph}
%% Dummy-Texte
\usepackage{blindtext}
\begin{document}
\chapter{Chapter Heading}
% ### ### ###
\begin{paracol}{2}
% --- --- ---
\begin{leftcolumn*}
% --- ---
\section{Section Heading Left}
\subparagraph{Subparagraph Heading Left}
% ---
\blindtext
\vspace{10mm}
% ---
% --- ---
\end{leftcolumn*}
% --- --- ---
% --- --- ---
\begin{rightcolumn}
% --- ---
\section*{Section Heading Right}
\subparagraph*{Subparagraph Heading Right (Without Numbering)}
% ---
\blindtext
% ---
% --- ---
\end{rightcolumn}
% --- --- ---
\begin{leftcolumn*}
% --- ---
\section{Section Heading Left}
\subparagraph*{Subparagraph Heading Right (Without Numbering)}
% ---
\blindtext
% ---
% --- ---
\end{leftcolumn*}
% --- --- ---
% --- --- ---
\begin{rightcolumn}
% --- ---
\section*{Section Heading Right (Without Numbering)}
\subparagraph*{Subparagraph Heading Right (Without Numbering)}
% ---
\blindtext
% ---
% --- ---
\end{rightcolumn}
% --- --- ---
\end{paracol}
% ### ### ###
\end{document}
Now I edit one line of code, e. g. comment \geometry{margin = 15mm} and get no red normal text:
% Dokumentenklasse inkl. Optionen
\documentclass[
fontsize = 12pt
,headings = small
,parskip = true
,numbers = noendperiod
,chapterprefix = true
]{scrbook}
%% Seitenlayout
\usepackage[
%showframe = true,
showframe = false,
]{geometry}
% Seiten-Dimensionen
\geometry{paperwidth = 300mm} % Format 16:9
\geometry{paperheight = 168.75mm} % Format 16:9
%\geometry{margin = 15mm}
\geometry{marginparsep = 2mm}
\geometry{marginparwidth = 8mm}
\geometry{footskip = 14mm}
% Color Support
\usepackage{xcolor}
% paracol
\usepackage{paracol}
\setlength{\columnseprule}{1pt}
\setlength{\columnsep}{2em}
\addtokomafont{subparagraph}{\color{red}}
% http://texwelt.de/wissen/fragen/10289/wie-andere-ich-die-abstande-uberunter-section-subsection-subsubsection
\RedeclareSectionCommand[
beforeskip = 0\baselineskip,
afterskip = 1\baselineskip,
innerskip = 0\baselineskip]{chapter}
\RedeclareSectionCommand[
beforeskip = 0\baselineskip,
afterskip = 0.25\baselineskip]{section}
\RedeclareSectionCommand[
beforeskip = 0\baselineskip,
afterskip = 1sp]{subparagraph}
%% Dummy-Texte
\usepackage{blindtext}
\begin{document}
\chapter{Chapter Heading}
% ### ### ###
\begin{paracol}{2}
% --- --- ---
\begin{leftcolumn*}
% --- ---
\section{Section Heading Left}
\subparagraph{Subparagraph Heading Left}
% ---
\blindtext
\vspace{10mm}
% ---
% --- ---
\end{leftcolumn*}
% --- --- ---
% --- --- ---
\begin{rightcolumn}
% --- ---
\section*{Section Heading Right}
\subparagraph*{Subparagraph Heading Right (Without Numbering)}
% ---
\blindtext
% ---
% --- ---
\end{rightcolumn}
% --- --- ---
\begin{leftcolumn*}
% --- ---
\section{Section Heading Left}
\subparagraph*{Subparagraph Heading Right (Without Numbering)}
% ---
\blindtext
% ---
% --- ---
\end{leftcolumn*}
% --- --- ---
% --- --- ---
\begin{rightcolumn}
% --- ---
\section*{Section Heading Right (Without Numbering)}
\subparagraph*{Subparagraph Heading Right (Without Numbering)}
% ---
\blindtext
% ---
% --- ---
\end{rightcolumn}
% --- --- ---
\end{paracol}
% ### ### ###
\end{document}
I know that the code is not minimal enough to pass a MWE test. I have trouble providing it.
Update: Numbered SubParagraph
I made my "MWE" too minimal: I forgot that I have numbered subparagraph . When I incorporate David's code in the originally provided example then I get the desired behaviour.
When I have numbered subparagraph, then the number is not colored.
% Dokumentenklasse inkl. Optionen
\documentclass[
fontsize = 12pt
,headings = small
,parskip = true
,numbers = noendperiod
,chapterprefix = true
]{scrbook}
%% Seitenlayout
\usepackage[
%showframe = true,
showframe = false,
]{geometry}
% Seiten-Dimensionen
\geometry{paperwidth = 300mm} % Format 16:9
\geometry{paperheight = 168.75mm} % Format 16:9
\geometry{margin = 15mm}
\geometry{marginparsep = 2mm}
\geometry{marginparwidth = 8mm}
\geometry{footskip = 14mm}
% Color Support
\usepackage{xcolor}
% paracol
\usepackage{paracol}
\setlength{\columnseprule}{1pt}
\setlength{\columnsep}{2em}
% subparagraph is numberes
\setcounter{secnumdepth}{5}
% Code from David
% -------------------------
\makeatletter
\def\zzz{%
\long\def\sectionlinesformat##1##2##3##4{%
\@hangfrom {\hskip ##2##3}{\textcolor{red}{##4}}}}
\makeatother
\addtokomafont{subparagraph}{\zzz}
%\addtokomafont{subparagraph}{\color{red}}
% -------------------------
% http://texwelt.de/wissen/fragen/10289/wie-andere-ich-die-abstande-uberunter-section-subsection-subsubsection
\RedeclareSectionCommand[
beforeskip = 0\baselineskip,
afterskip = 1\baselineskip,
innerskip = 0\baselineskip]{chapter}
\RedeclareSectionCommand[
beforeskip = 0\baselineskip,
afterskip = 0.25\baselineskip]{section}
\RedeclareSectionCommand[
beforeskip = 0\baselineskip,
afterskip = 1sp]{subparagraph}
%% Dummy-Texte
\usepackage{blindtext}
\begin{document}
\chapter{Chapter Heading}
% ### ### ###
\begin{paracol}{2}
% --- --- ---
\begin{leftcolumn*}
% --- ---
\section{Section Heading Left}
\subparagraph{Subparagraph Heading Left}
% ---
\blindtext
\vspace{10mm}
% ---
% --- ---
\end{leftcolumn*}
% --- --- ---
% --- --- ---
\begin{rightcolumn}
% --- ---
\section*{Section Heading Right}
\subparagraph*{Subparagraph Heading Right (Without Numbering)}
% ---
\blindtext
% ---
% --- ---
\end{rightcolumn}
% --- --- ---
\begin{leftcolumn*}
% --- ---
\section{Section Heading Left}
\subparagraph{Subparagraph Heading Right (Without Numbering)}
% ---
\blindtext
% ---
% --- ---
\end{leftcolumn*}
% --- --- ---
% --- --- ---
\begin{rightcolumn}
% --- ---
\section*{Section Heading Right (Without Numbering)}
\subparagraph*{Subparagraph Heading Right (Without Numbering)}
% ---
\blindtext
% ---
% --- ---
\end{rightcolumn}
% --- --- ---
\end{paracol}
% ### ### ###
\end{document}
Update (2018-04-27)
I contacted the author of KOMA (Markus Kohm, Germany) and here's summary of what he recommended.
- Better use
\sboxinstead of\setbox.- Or use
\color@begingroupand\color@endgroupwhen using\setbox.- The definition of
\sboxshows how it should/could be done.- In the case of
paracol(mad box tricks that span multiple pages) you need to take care of color stack.I also contacted the author of the
paracolpackage (Hiroshi Nakashima, Japan). He wants to look into it.I also contacted Heike Oberdiek, the author of color-stack-related packages. He won't be able to look into it in detail though.
Update (2018-05-03)
The author of the
paracolpackage replied and it doesn't look good for me :). In short: color is a problem (in rare cases like mine) for the current version ofparacol.I investigated your problem to find the following. (1) The root cause is in paracol (i.e., not in KOMA). (2) Fixing the bug in paracol is extremely tough, though I'll try it in future.
Here I show you a little bit lengthy explanation of each issue above.
(1) Root Cause Text coloring is one of toughest implementation issues of paracol because, for example, we have to color some page-crossing lines in left column without interference with coloring in right column. The coloring mechanism in paracol usually works well, but in some unusual cases like your MWE it fails to color texts properly. More specifically, we face a trouble in the following case. (a) A sequence of non-breakable lines is given when a page has too small room to have them as a whole. In your case, the sequence consists of the heading of Section 1.2, that of subparagraph and first two lines of the ordinary paragraph. (b) The sequence has colored paragraphs. In your case, section heading and subparagraph heading are colored (with black and red) and are one-line paragraphs. (c) The sequence could be broken into two pages and the second page
would start with a colored paragraph, if it were breakable. In
your case, TeX would find a page-break point between the section
and subparagraph headings. When paracol's coloring mechanism sees such a sequence, it inserts a page-break point into the sequence inappropriately, and misunderstands that the coloring of the first line of the second page (subparagraph heading) has started in the first page to cause an improper coloring (reddening all texts following the subparagraph heading).(2) (Nearly) Perfect Fix Since the problem you faced reveals that the fundamental idea of paracol's coloring mechanism is inappropriate, fixing the bug requires to redesign the mechanism completely even if it is possible. I have an idea for the fix and will examine its feasibility, but I cannot be sure when, or even whether, the fix is incorporated into a future release of paracol.
Update (2018-05-08)
The author of the
paracolpackage generated a new version (1.34) which will be publicly available in the coming weeks. I got the chance to test it now and with my current actual document: It works within my current document!Final Update (2018-05-18)
Version 1.34 of
paracolwith the fix related to this question is availabe on CTAN now.



\color{red}with\textcolor{red}– touhami Apr 09 '18 at 16:32\newcommand*\colorblack{\color{black}}\addtokomafont{subparagraph}{\color{red}\aftergroup\colorblack}. It works at least in the MWE you gave. – Skillmon Apr 09 '18 at 18:04paracol(parcolumnsalso has it's problems: https://tex.stackexchange.com/questions/155012, see e. g. comment from karlkoeller). – Dr. Manuel Kuehner Apr 10 '18 at 07:30