在多列文本中,在相应列的左侧显示诗句编号

在多列文本中,在相应列的左侧显示诗句编号

我有两栏文本,其中包含按顺序编号的多个诗句。想象一下,像下面这样的文本以两栏的形式流入页面。

1 Text for verse one that belongs to first verse. 2 Text for verse two that belongs to second verse. 3 Text for verse three that belongs to third verse. 4 Text for verse four that belongs to fourth verse. 5 Text for verse five that belongs to fifth verse.

现在,我不想在诗句文本旁边显示诗句编号,而是希望诗句编号出现在其所属列的左侧(类似于 marginpar)。

因此,按照期望进行操作即可……

1 Text for verse one    |   belongs to third 
  that belongs to first | 4 verse. Text for
2 verse. Text for verse |   verse four that
  two that belongs to   |   belongs to fourth
3 second verse. Text    | 5 verse. Text for
  for verse three that  |   verse five that...

这种情况可能吗?我正在查看 Tikz 包,但无法确定定位。希望得到一些指导和帮助。

我正在使用 {multicol} 包进行双列布局。

答案1

如果您的文本中没有任何大对象,则可以使用\vadjust和的组合\strut(以获得标准行深)。顺便说一句,\v这不是一个好主意,因为该命令已经存在(它是一个检查重音,所以您的诗句最好不要用需要它的语言 ;-)。

\documentclass{article}

\usepackage{multicol}
\setlength\columnsep{3em}   % open up the column sep a bit

\makeatletter
\renewcommand\v[1]{\leavevmode
   \@bsphack                                %                  try to keep the spacing ok
   \strut
   \def\strutdepth{\dp\strutbox}%                   this varies depending on fontsize 
   \vadjust{\kern-\strutdepth      %                   hopefully back to baseline now ;-)
                  \vtop to\strutdepth{%                   and this gets us back to the depth in the end
                                \baselineskip\strutdepth  %
                                \vss 
                                \llap{\scriptsize #1\quad }%
                                \null                                   % using a null box adds the right amount of baselineskip
                                                                          % (even if #1 is something with a depth)
                         }%
                 }%
  \@esphack
}
\makeatother

\begin{document}

\begin{multicols}{3}
\v1 Text for verse one that belongs to first verse. \v2 Text for verse two that 
belongs to second verse. \v3 Text for verse three that belongs to third verse. 
\v4 Text for verse four that belongs to fourth verse. 
\v5 Text for verse five that belongs to fifth verse.

\end{multicols}

\end{document}

这给你(当然这可以进一步修饰):

在此处输入图片描述

抱歉,这个镜头……当然不是由 LaTeX 制作的,我才注意到,太晚了 :-)

相关内容