答案1
以下示例使用eso-pic
tabular
在文本块的左侧和/或右侧放置数字列表(包含在单列内):
\documentclass{article}
\usepackage{lipsum,eso-pic,xcolor}
% Specify a verbatim list of numbers (or items) to be on the side of the text block
\newcommand{\numberlist}[1][r]{%
\begin{tabular}{#1}
\strut
1 \\ 2 \\ 3 \\ 4 \\ 5 \\ 6 \\ 7 \\ 8 \\ 9 \\ 10 \\
11 \\ 12 \\ 13 \\ 14 \\ 15 \\ 16 \\ 17 \\ 18 \\ 19 \\ 20 \\
21 \\ 22 \\ 23 \\ 24 \\ 25 \\ 26 \\ 27 \\ 28 \\ 29 \\ 20 \\
31 \\ 32 \\ 33 \\ 34 \\ 35 \\ 36 \\ 37 \\ 38 \\ 39 \\ 30 \\
41 \\ 42 \\ 43 \\ 44 \\ 45 \\ 46
\end{tabular}%
}
\newcommand{\numberlistfont}{%
\ttfamily\color{black!50}% Font/colour used for number list
}
% Add number list to the ForeGround of every page
\AddToShipoutPictureFG{%
% Start at the top left of the text block
\AtTextUpperLeft{%
\numberlistfont
% Numbers on left
\makebox[0pt][r]{\raisebox{-\height}{%
\numberlist[r]% Print numbers, right-aligned
}%
\hspace{50pt}% Space between left numbers and text block
}%
\hspace*{\textwidth}% Just to right side of text block
\hspace{3em}% Space between right numbers and text block
\makebox[0pt][l]{\raisebox{-\height}{%
\numberlist[l]% Print numbers, left-aligned
}}%
}%
}
\begin{document}
\sloppy\lipsum[1-50]\lipsum[1-50]
\end{document}
您可以根据注释的代码调整长度和定义。