最小工作示例
\documentclass{article}
\usepackage[hmargin=1cm,vmargin={1.25cm,1cm},
footskip=2\baselineskip]{geometry}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, varwidth}
\usepackage{enumitem}
\newlist{tabitemize}{itemize}{1}% <-- defined new list
\setlist[tabitemize]{nosep, % <-- new list setup
leftmargin = *,
label = $\bullet$,
before = \begin{minipage}[t]{\linewidth}, % <---
after = \end{minipage} % <---
}
\usepackage{lipsum}
\begin{document}
\begin{longtblr}[
caption = {My long table with caption},
label = {tab: },
]{
colspec = {@{} Q[l, wd=6cm] Q[l, wd=8.5cm] @{}},
row {1} = {font=\large\bfseries},
rowhead = 1,
measure = vbox,
}
\toprule
Publications & Publications \\
\midrule
\begin{tabitemize}
\item \textbf{\Large test text left:}
\lipsum[1-1]\footnote{test footnote left}
\end{tabitemize}
& \textbf{\Large test text right:}
\lipsum[5-5]
\begin{tabitemize}
\item \lipsum[1-1]
\item \lipsum[1-1]
\end{tabitemize} \\
\bottomrule
\end{longtblr}
\end{document}
结果
结果截图的一部分如下所示:
问题
可以看出,虽然左右两列都居中对齐,但是第一行的层级却不一致,如何匹配呢(文本居左,文本居右)?
其他问题
答案1
你有两个问题:
- 表体设置为最后一脚。删除命令
\lastfoot
或将其移动到\endhead
命令之后 - 分项列表在列表前插入一些垂直空间(
\topsep
),随后在左列中将该空间向下移动。
以下是改善表格外观的建议。其中解决了使用\endfoot
列表包的补救措施,并\enumitem
定义了用于表格的新列表。
\documentclass{article}
% Change the page layout if you need to
\usepackage[hmargin=1cm,vmargin={1.25cm,1cm},
footskip=2\baselineskip]{geometry}
\usepackage{graphicx}
\usepackage{ragged2e}
\usepackage{array, booktabs, longtable, tabularx}
\renewcommand*{\arraystretch}{1.2}%... and increase the row height
\usepackage{enumitem}
\newlist{tabitemize}{itemize}{1}% <-- defined new list
\setlist[tabitemize]{nosep, % <-- new list setup
leftmargin = *,
label = $\bullet$,
before = \begin{minipage}[t]{\linewidth}, % <---
after = \end{minipage} % <---
}
\usepackage{lipsum}
\begin{document}
\begin{longtable}{@{} >{\RaggedRight}p{6cm}>{\RaggedRight}p{8.5cm} @{}}
\toprule
\textbf{{\large {Publications}}} & \textbf{{\large {Publications}}} \\
\midrule
\endfirsthead
\endhead
\begin{tabitemize}
\item \textbf{\Large test text left:}
\lipsum[1-1]
\end{tabitemize}
& \textbf{\Large test text right:}
\lipsum[5-5]
\begin{tabitemize}
\item \lipsum[1-1]
\item \lipsum[1-1]
\end{tabitemize}
\\
\bottomrule
\end{longtable}
附录:
您可以考虑使用tabularray
包来制作表格。使用它的长表的代码是:
\documentclass{article}
\usepackage[hmargin=1cm,vmargin={1.25cm,1cm},
footskip=2\baselineskip]{geometry}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, varwidth}
\usepackage{enumitem}
\newlist{tabitemize}{itemize}{1}% <-- defined new list
\setlist[tabitemize]{nosep, % <-- new list setup
leftmargin = *,
label = $\bullet$,
before = \begin{minipage}[t]{\linewidth}, % <---
after = \end{minipage} % <---
}
\usepackage{lipsum}
\begin{document}
\begin{longtblr}[
caption = {My long table with caption},
label = {tab: },
]{
colspec = {@{} Q[l, wd=6cm] Q[l, wd=8.5cm] @{}},
row {1} = {font=\large\bfseries},
rowhead = 1,
measure = vbox,
}
\toprule
Publications & Publications \\
\midrule
\begin{tabitemize}
\item \textbf{\Large test text left:}
\lipsum[1-1]
\end{tabitemize}
& \textbf{\Large test text right:}
\lipsum[5-5]
\begin{tabitemize}
\item \lipsum[1-1]
\item \lipsum[1-1]
\end{tabitemize} \\
\bottomrule
\end{longtblr}
\end{document}
结果与以前类似(但稍微好一点)。