1

In my document I use 2 columns and 3 columns. I want to change only the width of the 3 columns with \setcolumnwith{}. The 2 columns should be unaffected.

\documentclass[parskip=full]{scrartcl}

\usepackage{blindtext}

\usepackage{paracol}

\begin{document}

  \begin{paracol}{2} % this is what I want
      \Blindtext[1]
    \switchcolumn
      \Blindtext[1]
  \end{paracol}

\setcolumnwidth{2cm,3cm,4cm} % this should only affect the 3 column

  \begin{paracol}{3} % this is what I want
      \blindtext
    \switchcolumn[1]
      \blindtext
    \switchcolumn[2]
      \blindtext
  \end{paracol}

  \begin{paracol}{2} % WRONG!
      \Blindtext[1]
    \switchcolumn
      \Blindtext[1]
  \end{paracol}

  \begin{paracol}{3} % this is what I want
      \blindtext
    \switchcolumn[1]
      \blindtext
    \switchcolumn[2]
      \blindtext
  \end{paracol}

\end{document}

1 Answers1

2

It's possible to switch temporarily to a two-column mode by setting \columnratio{0.5} in a group.

\documentclass[parskip=full]{scrartcl}

\usepackage{blindtext}
\usepackage{xcolor}
\usepackage{paracol}

\begin{document}

  \begin{paracol}{2} % this is what I want
      \Blindtext[1]
    \switchcolumn
      \Blindtext[1]
  \end{paracol}

\setcolumnwidth{2cm,3cm,4cm} % this should only affect the 3 column


\begin{paracol}{3} % this is what I want
  \blindtext
  \switchcolumn[1]
  \blindtext
  \switchcolumn[2]
  \blindtext
\end{paracol}

\begingroup
\columnratio{0.5}
\begin{paracol}{2} % WRONG!
  \color{red}
  \Blindtext[1]
  \switchcolumn
  \Blindtext[1]
\end{paracol}
\endgroup

\begin{paracol}{3} % this is what I want
  \blindtext
  \switchcolumn[1]
  \blindtext
  \switchcolumn[2]
  \blindtext
\end{paracol}

\end{document}

enter image description here

Update

\documentclass[parskip=full]{scrartcl}

\usepackage{blindtext}
\usepackage{xcolor}
\usepackage{paracol}

\makeatletter
\newcommand{\setlocalcolumnwidth}[1]{%
  \let\oldratio\pcol@columnratioleft
  \setcolumnwidth{#1}%
}
\newcommand{\restorelocalcolumnwidth}{%
  \let\pcol@columnratioleft\oldratio%
}
\makeatother

\begin{document}

\columnratio{0.5}% Explicitly store the 0.5 ratio
\begin{paracol}{2} % this is what I want
  \Blindtext[1]
  \switchcolumn
  \Blindtext[1]
\end{paracol}


\setlocalcolumnwidth{2cm,3cm,4cm} % this should only affect the 3 column
\begin{paracol}{3} % this is what I want
  \blindtext
  \switchcolumn[1]
  \blindtext
  \switchcolumn[2]
  \blindtext
\end{paracol}
\restorelocalcolumnwidth


\begin{paracol}{2} % Works
  \color{red}
  \Blindtext[1]
  \switchcolumn
  \Blindtext[1]
\end{paracol}

\begin{paracol}{3} % this is what I want
  \blindtext
  \switchcolumn[1]
  \blindtext
  \switchcolumn[2]
  \blindtext
\end{paracol}

\begin{paracol}{2} % Works
  \color{red}
  \Blindtext[1]
  \switchcolumn
  \Blindtext[1]
\end{paracol}


\end{document}