2

today I have a question regarding the paracol package which is somewhat related to the one I have recently asked, Packages tableof and paracol: multiple tables of content don't work, but it is more about paracol than about tableof.

It seems like paracol doesn't like Chapters. When I only put sections in the paracol environment, everything works fine (thanks to all that helped me achieve a nice table of content!), but as soon as I add chapters, all goes wrong. Please see this example for a good result without chapters:

\documentclass[10pt,a4paper,parskip]{scrreprt}    
\usepackage[english, ngerman]{babel}     
\usepackage[T1]{fontenc}    

\usepackage{paracol}
\usepackage{tableof}
\AtBeginDocument{\tofOpenTocFileForWrite}

\usepackage{selinput}
\SelectInputMappings{adieresis={ä},germanbls={ß},}

\begin{document}
\part{Erster Teil\\ First Part}

\begin{paracol}{2}
     \centerline{\textbf{Deutsch}}
     \tableoftaggedcontents{d}{}
\switchcolumn
    \centerline{\textbf{English}}
    \tableoftaggedcontents{e}{}
\end{paracol}
%
\begin{paracol}{2}
%\toftagthis{d}
%\chapter{Das erste Kapitel}
Ein bißchen deutscher Text, der das erste Kapitel einleitet, bevor es mit dem
ersten Abschnitt losgeht.
\switchcolumn
%\toftagthis{e}
%\chapter{The first chapter}
A little bit of english text supposed to prepare the reader for the first section.
\switchcolumn
\toftagthis{d}
\section{Der erste Abschnitt im ersten Kapitel}
Der Text zum ersten Abschnitt.
\switchcolumn
\toftagthis{e}
\section{The first section of the first chapter}
Text in the first section.
\toftagthis{d}
\section{Der zweite Abschnitt im ersten Kapitel}
Text im zweiten Abschnitt.
\switchcolumn
\toftagthis{e}
\section{The second section in the first chapter}
Text belonging to the second section.
\end{paracol}
\begin{paracol}{2}
%\toftagthis{d}
%\chapter{Das zweite Kapitel}
\toftagthis{d}
\section{Der erste Abschnitt im zweiten Kapitel}
Das zweite Kapitel beginnt mit diesem Abschnitt.
\switchcolumn
%\toftagthis{e}
%\chapter{The second chapter}
\toftagthis{e}
\section{The first section of the second chapter}
The second chapter starts with this section.
\end{paracol}
\end{document}

And this happens when I add the chapters (by removing the %s):

\documentclass[10pt,a4paper,parskip]{scrreprt}    
\usepackage[english, ngerman]{babel}     
\usepackage[T1]{fontenc}    

\usepackage{paracol}
\usepackage{tableof}
\AtBeginDocument{\tofOpenTocFileForWrite}

\usepackage{selinput}
\SelectInputMappings{adieresis={ä},germanbls={ß},}

\begin{document}
\part{Erster Teil\\ First Part}

\begin{paracol}{2}
     \centerline{\textbf{Deutsch}}
     \tableoftaggedcontents{d}{}
\switchcolumn
    \centerline{\textbf{English}}
    \tableoftaggedcontents{e}{}
\end{paracol}
%
\begin{paracol}{2}
\toftagthis{d}
\chapter{Das erste Kapitel}
Ein bißchen deutscher Text, der das erste Kapitel einleitet, bevor es mit dem
ersten Abschnitt losgeht.
\switchcolumn
\toftagthis{e}
\chapter{The first chapter}
A little bit of english text supposed to prepare the reader for the first section.
\switchcolumn
\toftagthis{d}
\section{Der erste Abschnitt im ersten Kapitel}
Der Text zum ersten Abschnitt.
\switchcolumn
\toftagthis{e}
\section{The first section of the first chapter}
Text in the first section.
\toftagthis{d}
\section{Der zweite Abschnitt im ersten Kapitel}
Text im zweiten Abschnitt.
\switchcolumn
\toftagthis{e}
\section{The second section in the first chapter}
Text belonging to the second section.
\end{paracol}
\begin{paracol}{2}
\toftagthis{d}
\chapter{Das zweite Kapitel}
\toftagthis{d}
\section{Der erste Abschnitt im zweiten Kapitel}
Das zweite Kapitel beginnt mit diesem Abschnitt.
\switchcolumn
\toftagthis{e}
\chapter{The second chapter}
\toftagthis{e}
\section{The first section of the second chapter}
The second chapter starts with this section.
\end{paracol}
\end{document}

The whole output gets puzzled and the english chapter heading jumps to the left-hand german column.

I tried hard not to mix up the columns, but I cannot see a faulty \switchcolumn or alike. Does anybody know about problems with chapters in paracol?

Best regards and many thanks in advance!

tableofconfusion

P.S.: If you answer, take your time, I will be on holidays for two weeks.

  • First line got lost, it MUST read: – tableofconfusion Sep 23 '16 at 12:57
  • DEAR ALL, today... – tableofconfusion Sep 23 '16 at 12:58
  • I certainly wouldn't have expected that it works. \chapter starts a new page so what should be the result? – Ulrike Fischer Sep 23 '16 at 13:15
  • Of course you're right! I overlooked that. But this means that it is virtually impossible to write a book with paracol with chapter captions aligned on top, so I shouldn't use scrbook or scrreprt. Is there an easy way to tell Latex not to start a new page with chapter? – tableofconfusion Sep 23 '16 at 18:43
3

Here is a solution.

Note that for leftcolumn we need to use \switchcolumn and \flushpage for rightcolumn.

No clearpage used so floats at the end of chapter may cause problem.

\documentclass[10pt,a4paper,parskip]{scrreprt} 
\usepackage{mwe}%  just for the example

\usepackage{paracol}
\usepackage{etoolbox}
\makeatletter
\patchcmd\scr@startchapter{\if@openright\cleardoublepage\else\clearpage\fi}{}{}{}
\patchcmd\scr@@startchapter{\@topnewpage[\@nameuse{@make#1head}{#3}]}{\@nameuse{@make#1head}{#3}}{}{}
\patchcmd\scr@@startschapter{\@topnewpage[\@nameuse{@makes#1head}{#2}]}{\@nameuse{@makes#1head}{#2}}{}{}
\makeatother

\begin{document}

\begin{paracol}{2}
\chapter{Foo1}
\section{section bar1}
\lipsum

\switchcolumn
\chapter{Foo2}
\section{section bar2}
\lipsum[1]

\flushpage
\chapter{Foo11}
\section{section bar11}

\switchcolumn
\chapter{Foo22}
\section{section bar22}
\end{paracol}
\end{document}
  • 1
    Dear touhami, that Looks great! I'll try to implement it in my 100-page document and see what happens with the floats. Thank you! – tableofconfusion Sep 24 '16 at 7:59
  • Does NOT work for book document class. – mmj Jan 10 at 17:52
  • @mmj \scr@startchapter is scr(report,book) (KOMA-script classes) specific command, it's not defined within standard classes. – touhami Jan 10 at 18:31
  • 1
    @mmj i will try :-) – touhami Jan 11 at 13:38
  • 1
    @mmj you need to add \patchcmd\scr@@startschapter{\@topnewpage[\@nameuse{@makes#1head}{#2}]}{\@nameuse{@makes#1head}{#2}}{}{} . – touhami Jan 11 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.