[Tex/LaTex] Pagebreak on \twocolumn and \onecolumn

floatspage-breakingtwo-column

Although spending quite some time searching for a solution to my problem, i haven't come across a fitting one. I am basically trying to fit a nomenclature into a two column environment. The clue is, that the nomenclature should be a frame covering both columns (i.e. one column), which i produce using \onecolumn and \twocolumn commands, respectively.
Those two commands use a \newpage call which i want to prevent. An this is the point where i am stuck right now. I've experimented with wrapping the text before and after the nomenclature in \begin{multicols}{2}, which produces the effect i want, but this moves all images out of place to the end of the document. Even here i found some solutions like not using any figure environments, but i wonder if there is a cleaner solution where i don't have to rewrite most of the figures.
Here is an example of my Latex-file:

\documentclass[authoryear,final,5p,times,twocolumn,draft]{elsarticle}

\usepackage{lipsum}

\usepackage{nomencl}
\usepackage[skins,breakable, most]{tcolorbox}
\usepackage{multicol}

\usepackage[utf8x]{inputenc} %Umlaute
\usepackage{stfloats}
\usepackage{eurosym}
\usepackage{subfig}
\usepackage{graphicx}
\usepackage[american]{babel} 

\renewcommand{\nomname}{Nomenclature} 

\makenomenclature

\begin{document}

\section{Section 1}
\lipsum[1-20]
\begin{figure}
    \centering
    \includegraphics[width=\linewidth]{example-image-a}
\end{figure}

\onecolumn
\begin{tcolorbox}[blanker, 
width=.42\textwidth,
before skip=1cm,
after skip=1cm,
breakable,
sharp corners=all,
%break at=.93\textheight,
break at=.93\textheight/.93\textheight/.3\textheight,
reset box array,
store to box array,]
        \input{nomenclature}
        \printnomenclature
\end{tcolorbox}

\begin{tcboxeditemize}[%
    blanker,
    raster columns=2, 
    sharp corners, 
    halign=center, 
    raster valign=top]{%
    breakable,
    enhanced,
    sharp corners=all,
    colback=white
    }
\tcbitem\consumeboxarray{1}
\tcbitem\consumeboxarray{2}
\tcbitem\consumeboxarray{3}
\tcbitem\consumeboxarray{4}
\end{tcboxeditemize}

\twocolumn
\begin{figure}[h]
    \centering
    \includegraphics[width=\linewidth]{example-image-b}
\end{figure}

\section{Section 2}
\lipsum[1-20]

\end{document}

nomenclatur.tex:

\lipsum[1-10]

EDIT:
i made some Progress, thanks to this thread Chapter without pagebreak? (In twocolumn document.) by redefining \onecolumn and \twocolumn commands

\def\twocolumn{%
  \global\columnwidth\textwidth 
  \global\advance\columnwidth-\columnsep 
  \global\divide\columnwidth\tw@ 
  \global\hsize\columnwidth
  \global\linewidth\columnwidth\global\@twocolumntrue 
  \global\@firstcolumntrue\col@number\tw@\@ifnextchar[\@topnewpage\@floatplacement
}

But now my regular text goes inside my nomenclature in the second column.
enter image description here

Best Answer

You can use multicols if you replace the figure [h] environment with a minipage.

I tried using \afterpage to fake a figure [t], but it split the columns onto different pages.

\documentclass[authoryear,final,5p,times,draft]{elsarticle}

\usepackage{lipsum}

\usepackage{nomencl}
\usepackage[skins,breakable, most]{tcolorbox}
\usepackage{multicol}

\usepackage[utf8x]{inputenc} %Umlaute
\usepackage{stfloats}
\usepackage{eurosym}
\usepackage[caption = false]{subfig}
\usepackage{graphicx}
\usepackage[american]{babel} 

\renewcommand{\nomname}{Nomenclature} 

\makenomenclature

\makeatletter
\newenvironment{myfigure}{\par\vskip\intextsep
\noindent\minipage{\columnwidth}%
\def\@captype{figure}\ignorespaces}{\endminipage\par\vskip\intextsep}
\makeatother

\begin{document}
\onecolumn
\begin{multicols}{2}
\section{Section 1}
\lipsum[1-20]
\begin{myfigure}
    \centering
    \includegraphics[width=\linewidth]{example-image-a}
\end{myfigure}
\end{multicols}

\begin{tcolorbox}[blanker, 
width=.42\textwidth,
before skip=1cm,
after skip=1cm,
breakable,
sharp corners=all,
%break at=.93\textheight,
break at=.93\textheight/.93\textheight/.3\textheight,
reset box array,
store to box array,]
        \lipsum[1-10]
        \printnomenclature
\end{tcolorbox}

\begin{tcboxeditemize}[%
    blanker,
    raster columns=2, 
    sharp corners, 
    halign=center, 
    raster valign=top]{%
    breakable,
    enhanced,
    sharp corners=all,
    colback=white
    }
\tcbitem\consumeboxarray{1}
\tcbitem\consumeboxarray{2}
\tcbitem\consumeboxarray{3}
\tcbitem\consumeboxarray{4}
\end{tcboxeditemize}

\begin{multicols}{2}
\begin{myfigure}
    \centering
    \includegraphics[width=\linewidth]{example-image-b}
\end{myfigure}

\section{Section 2}
\lipsum[1-20]
\end{multicols}
\end{document}

An ideal solution is possible using flowfram, but you have to set up the pages by hand in the preamble. Note, I had to remove a paragraph to get the figure to fit on page 2.

\documentclass[authoryear,final,5p,times,draft]{elsarticle}

\usepackage{lipsum}

\usepackage{nomencl}
\usepackage[skins,breakable, most]{tcolorbox}

\usepackage[utf8x]{inputenc} %Umlaute
\usepackage{stfloats}
\usepackage{eurosym}
\usepackage[caption = false]{subfig}
\usepackage{graphicx}
\usepackage[american]{babel} 

\renewcommand{\nomname}{Nomenclature} 

\makenomenclature

\usepackage{flowfram}
\twocolumn[1,2]
\onecolumn[3]
\onecolumninarea[4]{\textwidth}{3.5in}{0pt}{\dimexpr\textheight-3.5in}
\twocolumninarea[4]{\textwidth}{\dimexpr\textheight-3.75in}{0pt}{0pt}
\twocolumn[5]
\twocolumninarea[6]{\textwidth}{4in}{0pt}{\dimexpr\textheight -4in}

\begin{document}
\sloppy
\section{Section 1}
\lipsum[1-19]
\begin{figure}
    \centering
    \includegraphics[width=\linewidth]{example-image-a}
\end{figure}

\framebreak

\begin{tcolorbox}[blanker, 
width=.42\textwidth,
before skip=1cm,
after skip=1cm,
breakable,
sharp corners=all,
%break at=.93\textheight,
break at=.93\textheight/.93\textheight/.3\textheight,
reset box array,
store to box array,]
        \lipsum[1-10]
        \printnomenclature
\end{tcolorbox}

\begin{tcboxeditemize}[%
    blanker,
    raster columns=2, 
    sharp corners, 
    halign=center, 
    raster valign=top]{%
    breakable,
    enhanced,
    sharp corners=all,
    colback=white
    }
\tcbitem\consumeboxarray{1}
\tcbitem\consumeboxarray{2}
\tcbitem\consumeboxarray{3}
\tcbitem\consumeboxarray{4}
\end{tcboxeditemize}

\framebreak

\begin{figure}[h]
    \centering
    \includegraphics[width=\linewidth]{example-image-b}
\end{figure}

\section{Section 2}
\lipsum[1-20]

\end{document}