如何阻止 multicol 传播某一列的内容?

如何阻止 multicol 传播某一列的内容?

(是的,我见过,但它只能通过在不需要的情况下不使用 multicol 来解决问题)

因此,我对 multicol 的问题是它会拉伸其环境中的内容。我该如何解决这个问题?

示例代码:

\documentclass[
12pt,                        % Font size
a4paper                      % Paper type
]{article}

% Packages
\usepackage[
margin=2.7cm,                % Margin size
marginparwidth=2cm,          % Margin note size
marginparsep=3mm             % Space between margin and text
]{geometry}
\usepackage[utf8]{inputenc}  % UTF-8 support
\usepackage{multicol}        % Spread text on multiple columns
\usepackage{blindtext}       % Filler text

% Basic document info
\title{Testing multicol}
\date{}   % Show no date in the title
\author{} % Empty author to not get a warn about missing author

\begin{document}
\maketitle % Show the title

\begin{multicols*}{2}
 Example text

 some text

 text

 more text

 \columnbreak

 \blindtext
\end{multicols*}
\end{document}

它看起来是这样的: 在此处输入图片描述

答案1

您可以使用\vfill添加胶水,该胶水将以无限的可拉伸性垂直填充页面,这样段落之间添加的其他拉伸将被它覆盖。为了防止被\vfill删除,您需要在它后面添加一些内容,这就是它的\null作用(即“在这里放一个空框”)。

如果您希望每一列都表现出这种行为,那么不仅可以在明确执行的地方使用,还\columnbreak可以使用\raggedcolumns

\documentclass[
12pt,                        % Font size
a4paper                      % Paper type
]{article}

% Packages
\usepackage[
margin=2.7cm,                % Margin size
marginparwidth=2cm,          % Margin note size
marginparsep=3mm             % Space between margin and text
]{geometry}
\usepackage[utf8]{inputenc}  % UTF-8 support
\usepackage{multicol}        % Spread text on multiple columns
\usepackage{blindtext}       % Filler text

% Basic document info
\title{Testing multicol}
\date{}   % Show no date in the title
\author{} % Empty author to not get a warn about missing author

\begin{document}
\maketitle % Show the title

\begin{multicols*}{2}
 Example text

 some text

 text

 more text

 \vfill
 \null
 \columnbreak

 \blindtext
\end{multicols*}
\end{document}
\documentclass[
12pt,                        % Font size
a4paper                      % Paper type
]{article}

% Packages
\usepackage[
margin=2.7cm,                % Margin size
marginparwidth=2cm,          % Margin note size
marginparsep=3mm             % Space between margin and text
]{geometry}
\usepackage[utf8]{inputenc}  % UTF-8 support
\usepackage{multicol}        % Spread text on multiple columns
%\raggedcolumns              % use ragged columns globally
\usepackage{blindtext}       % Filler text

% Basic document info
\title{Testing multicol}
\date{}   % Show no date in the title
\author{} % Empty author to not get a warn about missing author

\begin{document}
\maketitle % Show the title

\begin{multicols*}{2}
  \raggedcolumns % use ragged columns locally in this environment
 Example text

 some text

 text

 more text

 \columnbreak

 \blindtext
\end{multicols*}
\end{document}

两者的结果是:

在此处输入图片描述

相关内容