ConTeXt:分栏(减少平衡损失)

ConTeXt:分栏(减少平衡损失)

我正在尝试防止环境内部的物品出现难看的损坏\startcolumns...\stopcolumns

丑陋的分栏

\setuppapersize[letter]

\setuplayout
    [ topspace=0.5in
    , height=10in
    , backspace=0.75in
    , width=7in
    ]

\setupcolumns[n=3,separator=rule,balance=yes,distance=0.5in]

\define\eachtestpar{\EveryPar{%
    %\clubpenalties  5 10000 10000 10000 100 0%
    %\widowpenalties 5 10000 10000 10000 100 0%
    \keeplinestogether{20}%
}}

\defineitemgroup[test]
    [inner=\eachtestpar]


\starttext

\startcolumns
\startitemize
\item One
\item Two
\item Three
\item Four
\item Five\blank[medium]

      Thus, I came to the conclusion that the designer of a new system must not only be the...

\item Six
\item Seven
\stopitemize
\stopcolumns

\blank[5*big]

\startcolumns
\startitemize
\item One
\item Two
\item Three
\item Four
\item Five\blank[medium]

      Thus, I came to the conclusion that the designer of a new system must not only be the...
      \startitemize
      \item One
      \item Two
      \item Three
      \stopitemize

\item Six
\item Seven
\stopitemize
\stopcolumns

\stoptext

我不想完全阻止中断,但我确实希望惩罚优先于列平衡。不幸的是,\EveryPar使用和只会减少段落和嵌套列表之间的空间(即更丑陋)。\clubpenalties\widowpenalties\keeplinestogether

具体来说:不应出现少于 5 行或 5 个嵌套项目的中断;相反,列应该不平衡。

答案1

首先,不需要换行itemizecolumns环境itemize开箱即用地支持列。

为了将线条牢固地保持在一起,您可以将物品内容包装进去\start...\stopitem并将其打包成\vtop

\setuppapersize[letter]

\setuplayout
    [topspace=0.5in,
     height=10in,
     backspace=0.75in,
     width=7in]

\unexpanded\long\def\vtopitem#1\stopitem{%
  \vtop{%
    \rightskip=\leftskip\relax
    \leftskip=0pt\relax
    #1%
  }%
  \stopitem
}

\starttext

\startitemize[columns][n=3,command=\vtopitem]
\startitem One \stopitem
\startitem Two \stopitem
\startitem Three \stopitem
\startitem Four \stopitem
\startitem Five\blank[medium]

      Thus, I came to the conclusion that the designer of a new system must not only be the...
\stopitem
\startitem Six \stopitem
\startitem Seven \stopitem
\stopitemize

\blank[5*big]

\startitemize[columns][n=3,command=\vtopitem]
\startitem One \stopitem
\startitem Two \stopitem
\startitem Three \stopitem
\startitem Four \stopitem
\startitem Five\blank[medium]

      Thus, I came to the conclusion that the designer of a new system must not only be the...
      \startitemize
      \item One
      \item Two
      \item Three
      \stopitemize
\stopitem
\startitem Six \stopitem
\startitem Seven \stopitem
\stopitemize

\stoptext

在此处输入图片描述

相关内容