multicol
或者memoir
更受欢迎。\columnseprule
据我了解,负责在列之间绘制一条垂直实线。有没有一种简约的方法来实现以下功能?
-----pretext---
###### : ######
###### : ######
###### : ######
###### : ######
###### : ######
###### : ######
-----posttext--
答案1
答案2
multicol
这是使用所要求的包的初步版本:
\documentclass{memoir}
\usepackage{multicol}
\usepackage{etoolbox}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usepackage{lipsum}
%
\newcounter{mymulticol}
\setlength\columnsep{20pt}
%
\makeatletter
\def\LR@dotcolumn@boxes{%
\process@cols\mult@gfirstbox{%
\ifdim\dp\count@>\dimen\tw@
\global\dimen\tw@\dp\count@ \fi
\mc@col@status@write
\box\count@\hss{\columnseprulecolor\tikzmark{middle-\themymulticol}\vrule
\@width\columnseprule}\hss}%
\ifdim\dp\mult@rightbox>\dimen\tw@
\global\dimen\tw@\dp\mult@rightbox \fi
\mc@lastcol@status@write
\box\mult@rightbox\stepcounter{mymulticol}\tikzmark{end-\themymulticol}%
}
\newcommand\LRdotmulticolcolumns
{\let\mc@align@columns
\LR@dotcolumn@boxes}
\LRdotmulticolcolumns
\AtBeginEnvironment{multicols}{\stepcounter{mymulticol}\tikzmark{start-\themymulticol}}
\AtEndEnvironment{multicols}{%
\raisebox{0pt}[0pt][0pt]{\tikz[remember picture,overlay]{
\draw[dotted]
([yshift=-17pt]{{pic cs:middle-\themymulticol}|-{pic cs:start-\themymulticol}}) --
([yshift=-2pt]{{pic cs:middle-\themymulticol}|-{pic cs:end-\themymulticol}});
}}}
\makeatother
\begin{document}
\lipsum[4]
\begin{multicols}{2}
\lipsum[4]
\end{multicols}
\lipsum[4]
\begin{multicols}{2}
\lipsum[4]
\end{multicols}
\lipsum[4]
\end{document}
结果:
代码需要运行两次才能使虚线到达最终位置
结果: