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.
Best Answer
You can use
multicols
if you replace the figure [h] environment with aminipage
.I tried using
\afterpage
to fake a figure [t], but it split the columns onto different pages.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.