年表的枚举方法

年表的枚举方法

我要制作一个按时间顺序排列的列表,其中包含数十个条目。此外,每个条目的日期必须位于相邻文本的下方一点。

我以前的想法是使用该longtable包,它会生成我正在寻找的类型的条目,但没有“拉伸”来确保每页包含从页面最顶部到最底部的条目。

无论如何,我的 MWE 代码如下。

\documentclass[12pt]{article}

\hoffset 10pt \voffset -55pt
\oddsidemargin 17pt \evensidemargin 18pt \topmargin 35pt
\headheight 25pt \textheight 8.25in \textwidth 5.75in
\headsep 40pt \marginparwidth 35pt

\usepackage{longtable}
\usepackage{array}
\usepackage[lf]{electrum}
\usepackage{pgfpages}
\pgfpagesuselayout{2 on 1}
\begin{document}
%\renewcommand*{\arraystretch}{1.5}

\large
\begin{longtable}{m{4.75cm} m{9.5cm}}
\flushright{\vspace{-83pt} {\bf Aug. 25, 1905 ---}} & A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. \\[10pt] 
\flushright{\vspace*{-64pt} {\bf Aug. 27, 1905 ---}} & A description of an event. A description of an event. A description of an event. A description of an event. \\[10pt]
\flushright{\vspace{-133pt} \bf Apr. 5, 1912 ---} & A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. \\[10pt]
\flushright{\vskip -114pt {\bf May 8, 1913 ---}} & A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. \\[10pt]
\flushright{\vspace{-81pt} {\bf Sept. 30, 1914 ---}} & A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. \\[10pt] 
\flushright{\vspace*{-64pt} {\bf Jan. 20, 1918 ---}} & A description of an event. A description of an event. A description of an event. A description of an event. \\[10pt]
\flushright{\vspace{-137pt} \bf Aug. 2, 1925 ---} & A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. \\[10pt]
\flushright{\vskip -109pt {\bf Dec. 12, 1928 ---}} & A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. 
\end{longtable}
\end{document}

输出结果如下:

在此处输入图片描述

再次,条目的外观基本上是我想要的,但我一直找不到自动拉伸它们的方法。\renewcommand*{\arraystretch}{1.5}似乎只适用于单个页面。

此外,代码很麻烦,因为它对每个条目进行单独的垂直调整,而当条目很多时​​,这是不可行的。

因此,我想出了以下使用的“基本”代码enumerate,我可以稍后修改它以实现我想要的自动页面拉伸。

\documentclass{book}
\usepackage{lipsum}
\usepackage[lf]{electrum}
\begin{document}
\large
\begin{enumerate}
\item[\textbf{Sept. 1, 1910 ---}] A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. %\lipsum[2]
\end{enumerate}
\end{document}

产生

在此处输入图片描述

这似乎是一个更可行的解决方案,因为我知道如何在页面上普遍拉伸多个条目;但是,我不知道如何重新定位日期以使其出现在相邻文本顶部的下方一点。

问题:使用enumerate我所描述的包是否是使用 编写的繁琐代码的最佳替代方案longtable?如果是这样,我该如何修改代码,enumerate以便我可以将日期重新定位到默认位置以下一点。(此外,如果有更可行的方法来采用该longtable方法,或者有更好的方法来同时使用这两种方法---请提供建议。)

谢谢。

答案1

枚举环境最适合自动拉伸。

我建议使用enumitem允许您定义标签的外观(以及更多内容)的包:

\documentclass{book}
\usepackage{lipsum}
\usepackage[lf]{electrum}
\usepackage{enumitem}
\begin{document}
\large

\SetLabelAlign{crono}{\raisebox{-1ex}[0pt][0pt]{\makebox[0pt][r]{\textbf{#1 ---}}}}

\begin{description}[align=crono, itemindent=0pt, leftmargin=1cm, rightmargin=0cm, parsep=2ex]

\item[Sept. 1, 1910] A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. %\lipsum[2]

\item[September 1, 1910] A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. %\lipsum[2]
\end{description}
\end{document}

在此处输入图片描述

在上面的代码中,enumitem命令SetLabelAlign用于格式化标签。

答案2

一个功能强大的新表管理软件包是tabularray。包括一个 longtable 环境。

主要的优点tabularray是将表格的内容与行、列的样式分开。

通过这种方式,可以非常轻松快捷地更改和尝试新样式,而无需触及单元格内容。

看看最终的代码是多么简单,将列宽调整到适合文本区域的宽度,将第一列的字体设为粗体,并稍微降低日期。

请注意,一行完成后即进行分页。

X

\documentclass[12pt]{article}

\hoffset 10pt \voffset -55pt
\oddsidemargin 17pt \evensidemargin 18pt \topmargin 35pt
\headheight 25pt \textheight 8.25in \textwidth 5.75in
\headsep 40pt \marginparwidth 35pt

%\usepackage{longtable}
%\usepackage{array}
%\usepackage[lf]{electrum}
\usepackage{pgfpages}
\pgfpagesuselayout{2 on 1}

\usepackage{tabularray} % added
\usepackage{adjustbox} % added <<<<<<<<<<

\begin{document}

\begin{longtblr}
    [caption = {A Long Long Long Long Long Long Long Table},
    ]
{       colspec = {X[-1,r]X[l]}, % auto adjust columns widths   
        width = \linewidth, % width of the table
        abovesep =20pt, % space above the row
        column{1} = {preto=\bfseries\begin{adjustbox}{raise=-1ex}}, % lower cell by 1ex
        column{1} = {appto=\end{adjustbox}},
}   
Aug. 25, 1905 ---   & A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. \\
Aug. 27, 1905 ---   & A description of an event. A description of an event. A description of an event. A description of an event. \\
Apr. 5, 1912 ---    & A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. \\
May 8, 1913 ---     & A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. \\
Sept. 30, 1914 ---  & A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. \\ 
Jan. 20, 1918 ---   & A description of an event. A description of an event. A description of an event. A description of an event. \\
Aug. 2, 1925 ---    & A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. \\
Dec. 12, 1928 ---   & A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event.  \\
Apr. 24, 1946 ---   & A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event.\\
Jan. 11, 1988 ---   & A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event. A description of an event.A description of an event. A description of an event. A description of an event.\\
\end{longtblr}

相关内容