[Tex/LaTex] Koma-Script (scrbook): twocolumn formatting and wide equation problem

koma-scriptscrbooktwo-column

I use scrbook class (see bellow) in my book and sometimes I need typeset wide equation.

\documentclass[%
    ,fontsize=12pt    % 
    ,a3paper         % pagesize
    ,twocolumn 
]{scrbook}
\areaset[5mm]{250mm}{350mm}
\unsettoc{toc}{twocolumn}

Is it possible to partially switch between one and two column formatting? I tried to use the library widetext, but I'm afraid that it is not a part of the MiKTeX distribution. I would like to typeset wide equation in the text, not only at a bottom or top side. Is it possible?

MNWE: (added wide equation; for \setchaptertoc see KOMA-Script (scrbook): onecolumn table of contents & minitoc in twocolumn document)

\documentclass[twocolumn]{scrbook}
\usepackage[nohints]{minitoc}
\usepackage{amsmath, amsthm, amssymb, amsfonts, amsbsy}
\usepackage{bigints}
\usepackage{mathtools}
\mtcsetrules{minitoc}{off}
\usepackage{lipsum}

\newcommand*{\setchaptertoc}{%
  \setchapterpreamble{
  \vspace{1.85\baselineskip} % workaround for removed rule
  \smash{\makebox[\linewidth]{\hrulefill}} % workaround for removed rule
  \vspace{-1.85\baselineskip} % workaround for removed rule
  \minitoc
  \vspace{-1.15\baselineskip} % workaround for removed rule
  \smash{\makebox[\linewidth]{\hrulefill}} % workaround for removed rule
  \vspace{1.15\baselineskip} % workaround for removed rule
}}
\newcommand{\dd}[1]{\hspace{2pt}d#1}

\begin{document}
\dominitoc
\tableofcontents

\setchaptertoc
\chapter{One}
\lipsum[1]
    \begin{equation}\label{fyz:fey_eq_elstat18}
      E_x(x_1, y_1, z_1) = 
        \int\limits_{\substack{\text{all}\\\text{area}}}\varrho(x_2, y_2, z_2)
        \frac{x_1-x_2}{[(x_1-x_2)^2+(y_1-y_2)^2+(z_1-z_2)^2]^{\frac{3}{2}}}\dd{x_2}\dd{y_2}\dd{z_2}
    \end{equation} 
\lipsum[1]    
\section{One, one}
\lipsum[2]
\subsection{One, one, one}
\lipsum[3]
\section{One, two}
\lipsum[4]

\setchaptertoc
\chapter{Two}
\lipsum[5]
\section{Two, one}
\lipsum[6]
\section{Two, two}
\subsection{two, two, one}
\lipsum[7]

\setchaptertoc
\chapter{Three}
\section{Three, one}
\lipsum[8]
\section{Three, two}
\lipsum[9]
\end{document}

enter image description here

Best Answer

Your problem can be solved with “widetext.sty”. This package mimicing the mechanism with the same name from RevTeX4 was written by Anjishnu Sarkar. Alas, the original home went away. Luckily, we can get a copy from a svn site of Einstein Toolkit, because they have used it for a document (direct link): https://svn.einsteintoolkit.org/documents/Paper_EinsteinToolkit_2010/widetext.sty

Save this package file and put it into your folder for your actual document or, in my eyes better: put into a local TEXMF directory. Since you mentioned MiKTeX in a comment, see Create a local texmf tree in MiKTeX. But if your later want to give away the sources, do not forget to add “widetext.sty”, then.

Here’s an MWE, some explication follows below:

\documentclass[twocolumn]{scrbook}
\usepackage[nohints]{minitoc}
\usepackage{amsmath, amsthm, amssymb, amsfonts, amsbsy}
\usepackage{bigints}
\usepackage{mathtools}
\usepackage{lipsum,kantlipsum}

\usepackage{widetext}% needs packages "flushend" & "cuted" of "sttools"
                     % bundle, which perhaps must separately be installed

\newcommand{\dd}[1]{\hspace{2pt}d#1}

\begin{document}

\chapter{One}
\lipsum[1]
\begin{widetext}
  \begin{equation}\label{fyz:fey_eq_elstat18}
    E_x(x_1, y_1, z_1) = 
      \int\limits_{\substack{\text{all}\\\text{area}}}\varrho(x_2, y_2, z_2)
      \frac{x_1-x_2}{[(x_1-x_2)^2+(y_1-y_2)^2+(z_1-z_2)^2]^{\frac{3}{2}}}\dd{x_2}\dd{y_2}\dd{z_2}
  \end{equation}
\end{widetext}

\kant[1]
\end{document}

example output

I intentionally added kantlipsum, another dummy text package, which produces English text. So you can see, how the columns get broken.

There still seem to exist some issues, though, especially with footnotes and floats, coming from the underlying package cuted. Its documentation says, for footnotes you should use \footnotemark plus \footnotetext, but in tests I was not successfull – the notes were printed much to low inside or on top of the right column below the equation depending on the actual text length, cf. code below (I added only modified parts). With \leavevmode\begin{widetext} the output is not perfect, but much better.
Also see on TeX.SE Problems using widetext.sty (do not overlook comments to answers).

\chapter{One}
Text\footnotemark{}
\lipsum[1]
Text\footnotemark
\addtocounter{footnote}{-1}
\footnotetext{Note \thefootnote}
\stepcounter{footnote}
\footnotetext{Note \thefootnote}

\begin{widetext}
...
\end{widetext}

Text\footnote{Note \thefootnote}
\kant[1]
Text\footnote{Note \thefootnote}