\twocolumn 和 \onecolumn 上的分页符

\twocolumn 和 \onecolumn 上的分页符

虽然花了相当多的时间来寻找解决问题的方法,但我还没有找到合适的方法。我基本上是想将一个命名法放入两列环境中。线索是,命名法应该是一个覆盖两列(即一列)的框架,我分别使用\onecolumn\twocolumn命令生成它。这两个命令使用我想要避免的 \newpage 调用。这就是我现在陷入困境的地方。我尝试用 在命名法之前和之后换行文本\begin{multicols}{2},这产生了我想要的效果,但是这会将所有图像移出文档的末尾。即使在这里,我也找到了一些解决方案,例如不使用任何图形环境,但我想知道是否存在更清晰的解决方案,让我不必重写大多数图形。这是我的 Latex 文件的一个示例:

\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[caption = false]{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}

命名法.tex:

\lipsum[1-10]

编辑: 感谢这个帖子,我取得了一些进展没有分页符的章节?(在双栏文档中。)通过重新定义 \onecolumn 和 \twocolumn 命令

\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
}

但现在我的常规文本进入了第二列的命名法内。 在此处输入图片描述

答案1

multicols如果您将图形 [h] 环境替换为 ,则可以使用minipage

我尝试使用它\afterpage来伪造一个图形 [t],但它将列分成不同的页面。

\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}

使用 flowfram 可以实现理想的解决方案,但您必须在序言中手动设置页面。请注意,我必须删除一个段落才能使图表适合第 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}

相关内容