我的文档中有许多 longtable。除了标题和内容(当然)之外,所有表格中的所有内容都相同。如何避免重复设置 longtable 所需的内容?这可能吗?
生成一个表所需的代码如下。您可以看到设置表需要很多东西。我想避免多次重复这些内容。
\begin{longtable}[h]{M{2.00in}M{0.85in}m{0.55in}m{0.55in}m{0.55in}m{0.55in}}
\caption{First Ministry in Jerusalem} \\
\toprule
Event & Location & Matt. & Mark & Luke & John \\
\midrule
\endfirsthead
\caption{First Ministry in Jerusalem (continued)} \\
\toprule
Event & Location & Matt. & Mark & Luke & John \\
\midrule
\endhead
\bottomrule
\multicolumn{6}{r}{\emph{Continued on next page}}
\endfoot
\bottomrule
\endlastfoot
Content & Goes & Here
\end{longtable}
答案1
序言中是这么说的:
\newenvironment{mylongtable}[1]
{\begin{longtable}{M{2.00in}M{0.85in}m{0.55in}m{0.55in}m{0.55in}m{0.55in}}
\caption{#1} \\
\toprule
Event & Location & Matt. & Mark & Luke & John \\
\midrule
\endfirsthead
\caption{First Ministry in Jerusalem (continued)} \\
\toprule
Event & Location & Matt. & Mark & Luke & John \\
\midrule
\endhead
\bottomrule
\multicolumn{6}{r}{\emph{Continued on next page}}
\endfoot
\bottomrule
\endlastfoot}
{\end{longtable}}
然后你只需写
\begin{mylongtable}{First Ministry in Jerusalem}
<contents>
\end{mylongtable}