Multicols:编号列

Multicols:编号列

我只是想在每列下有一个列号,就像页码一样。

\documentclass[paper=A3, landscape]{scrartcl}

\usepackage{multicol}
\usepackage{blindtext}

\begin{document}
\begin{multicols}{4}
  \blinddocument{}
\end{multicols}
\end{document}

... 而不是页码。将不会有\pageref对列号的引用 ( )。

答案1

对于单个页面:

\documentclass[paper=A3, landscape]{scrartcl}

\usepackage{multicol}
\usepackage{blindtext}

\begin{document}
\begin{multicols}{4}
  \blinddocument{}
\end{multicols}
\columnwidth=\dimexpr \textwidth-3\columnsep\relax% recompute
\columnwidth=0.25\columnwidth
\noindent
\makebox[\columnwidth]{1}\hspace{\columnsep}%
\makebox[\columnwidth]{2}\hspace{\columnsep}%
\makebox[\columnwidth]{3}\hspace{\columnsep}%
\makebox[\columnwidth]{4}\par
\end{document}

对于每一页:

\documentclass[paper=A3, landscape]{scrartcl}

\usepackage{multicol}
\usepackage{blindtext}
\usepackage{everypage}

\newcounter{column}

\AddEverypageHook{\ifdim\columnwidth<\textwidth
  \ifodd\value{page}\rlap{\hspace{\oddsidemargin}%
      \raisebox{\dimexpr-\topmargin-\headheight-\headsep-\textheight-0.5\footskip}[0pt][0pt]%
      {\makebox[\columnwidth]{\stepcounter{column}\thecolumn}\hspace{\columnsep}%
       \makebox[\columnwidth]{\stepcounter{column}\thecolumn}\hspace{\columnsep}%
       \makebox[\columnwidth]{\stepcounter{column}\thecolumn}\hspace{\columnsep}%
       \makebox[\columnwidth]{\stepcounter{column}\thecolumn}}}%
  \else\rlap{\hspace{\evensidemargin}%
      \raisebox{\dimexpr-\topmargin-\headheight-\headsep-\textheight-0.5\footskip}[0pt][0pt]%
      {\makebox[\columnwidth]{\stepcounter{column}\thecolumn}\hspace{\columnsep}%
       \makebox[\columnwidth]{\stepcounter{column}\thecolumn}\hspace{\columnsep}%
       \makebox[\columnwidth]{\stepcounter{column}\thecolumn}\hspace{\columnsep}%
       \makebox[\columnwidth]{\stepcounter{column}\thecolumn}}}%
  \fi%
\fi}

\begin{document}
\begin{multicols}{4}
  \blinddocument{} \blindtext
\end{multicols}
\end{document}

相关内容