首先,以下问题无法在其他机器上复制。创建 MWE 解决了这个问题,但我必须在论文的背景下解决它,其中包括一个过于复杂而无法在此处完整分享的序言。这是其中列出我正在使用的软件包的部分(其余部分与引用格式有关):
\usepackage[utf8]{inputenc}
\usepackage[english]{babel} % Language
\usepackage[T1]{fontenc}
% ===== BASIC SETTINGS ======
% {{{
\usepackage{microtype} % For improved full justification
\usepackage{wrapfig}
\usepackage{lscape}
\usepackage{rotating}
\usepackage{epstopdf}
%\usepackage{hyperref} % For clickable references
\usepackage{bookmark} % For bookmarks
\usepackage{comment} % For the "comment" environment
\usepackage{graphicx} % For including images
\usepackage{verbatim} % Probably also for the "comment" environment
\usepackage{setspace} % For line spacing
\usepackage{booktabs} % For nice tables
\usepackage[flushleft]{threeparttable} % For adding text below the table
\usepackage{Tabbing} % For tabbing functions
\usepackage{longtable} % For extra long tables
\usepackage{subfig} % For subfigures
\usepackage{amsmath} % For math figures
\usepackage{empheq} % For boxes around equations
\usepackage{multicol}
%\usepackage{svg} % Include svg images
%\usepackage{colortbl}
%\usepackage{subcaption}
%\usepackage{caption}
\usepackage{langsci-gb4e}
\usepackage{wasysym}
\usepackage[a4paper, top=20mm, bottom=20mm, left=25mm, right=35mm]{geometry} % For page margins
% }}}
% For colours
%\usepackage{colortbl}
\usepackage[table]{xcolor}
%{\setlength{\tabcolsep}{2.5pt} % Use this for adjusting the margins of coloured rows
\colorlet{shadecolor}{gray!40}
% For Outlines
% {
\usepackage{outlines}
\usepackage{enumitem}
\setenumerate[1]{label=\Roman*.}
\setenumerate[2]{label=\Alph*.}
\setenumerate[3]{label=\arabic*.}
\setenumerate[4]{label=(\arabic*)}
% }
% Global indentation
\usepackage{indentfirst}
% Footnotes
\usepackage[hang]{footmisc} %
\usepackage[indentfirst = false]{quoting} % This one and the one above remove indentation from footnotes, but allow the text to be indented nevertheless
% Header
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
%\renewcommand{\headrulewidth}{0pt} % optional
\fancyhead[L]{\nouppercase{\leftmark}}
\fancyhead[R]{\thepage}
%\fancyfoot[LE,RO]{\thepage}
%\fancyfoot[LO,CE]{Chapter \thechapter}
%\fancyfoot[CO,RE]{Author Name}
% ========= FONT =============
%\usepackage{mathptmx} % Times New Roman
\usepackage[]{libertine} % Linux Libertine (with Old Style numerals)
% ===== LINGUISTICS STUFF ======
\usepackage{tipa}
\usepackage{gb4e} % For linguistic examples, glosses etc.
\noautomath
\counterwithin{xnumi}{section} % the chngcntr way (preferred)
\counterwithin{exx}{section} % reset example counter every chapter
\usepackage[edges, linguistics]{forest} % Tree structures
\usetikzlibrary{matrix,shapes,arrows,positioning}
\usepackage{pgfkeys}
\forestset{
downroof/.style={
for children={
if n=1{
edge path'={
(.parent first) -- (!u.parent anchor) -- (!ul.parent last) -- cycle
}
}{no edge}
}
}
}
每当我尝试编译booktabs
下面的表格时,第一列中都会出现一个黑条,上面应该写着“多样性”。在我的文档中,我有 30 多个遵循相同结构的表格,这是唯一出现此问题的表格。我尝试过删除 \toprule、删除表格的第一行、将表格放在文档中的其他位置等,但都无济于事。黑条要么保留,要么移动到下一行。如果您能提供任何关于如何去除它的建议,我将不胜感激,因为我计划本周提交论文,真的不想在单独的 pdf 编辑器中处理文件。谢谢!
\begin{table}[htbp!]
\centering
\begin{tabular}{@{}llll@{}}
\toprule
Variety & Person & Reference & Total (\%) \\ \midrule
SING & 1 & overt & 586 (12.11\%) \\
& & null & 32 (0.66\%) \\
& 2 & overt & 413 (8.54\%) \\
& & null & 4 (0.08\%) \\
& 3 & overt & 428 (8.85\%) \\
& & null & 28 (0.52\%) \\
& \textit{it} & overt & 25 (0.52\%) \\
& & null & 5 (0.10\%) \\
& \textit{there} & overt & 56 (1.16\%) \\
& & null & 1 (0.02\%) \\ \midrule
Sum & & & 1578 (32.62\%) \\ \midrule
HK & 1 & overt & 603 (13.42\%) \\
& & null & 11 (0.24\%) \\
& 2 & overt & 469 (10.44\%) \\
& & null & 13 (0.29\%) \\
& 3 & overt & 426 (9.48\%) \\
& & null & 42 (0.93\%) \\
& \textit{it} & overt & 28 (0.58\%) \\
& & null & 9 (0.19\%) \\
& \textit{there} & overt & 63 (1.30\%) \\
& & null & 0 (0.00\%) \\ \midrule
Sum & & & 1664 (34.39\%) \\ \midrule
GB & 1 & overt & 745 (16.59\%) \\
& & null & 9 (0.20\%) \\
& 2 & overt & 304 (6.77\%) \\
& & null & 0 (0.00\%) \\
& 3 & overt & 361 (8.03\%) \\
& & null & 18 (0.40\%) \\
& \textit{it} & overt & 61 (1.26\%) \\
& & null & 2 (0.04\%) \\
& \textit{there} & overt & 96 (1.98\%) \\
& & null & 0 (0.00\%) \\ \midrule
Sum & & & 1586 (32.99\%) \\ \midrule
Total & & & 4838 (100\%) \\ \bottomrule
\end{tabular}
\caption{A caption}\label{table:iv-1}
\end{table}
答案1
- 请考虑我的评论。
- 将您的代码片段合并到文档中并供文档类使用后
article
,我无法重现您的问题(通过最新版本的 MiKTeX 测试)。 - 下面是 MWE(最小工作示例)的一个例子,它重现了您的问题(我的工作正常!),正如我们期望的那样,您提供而不是推送不完整的代码片段。
- MWE 的要求可能创建 MWE 可能需要一些工作/反复试验,但它也有助于隔离和识别问题。更多信息请参阅什么是 MWE。
不过,我会用不同的方式来编写你的表格,这样(在我看来)可以生成更美观、更易读的表格:
MWE(最小工作示例):
\documentclass{article}
\usepackage[a4paper,
vmargin={20mm, 20mm},
hmargin={25mm, 35mm}
]{geometry} % For page margins
\usepackage[]{libertine} % Linux Libertine (with Old Style numerals)
\usepackage[table]{xcolor}
\usepackage{booktabs}
\usepackage{siunitx} % <--- new
\usepackage{lipsum} % new, added for dummy text filler
\begin{document}
\lipsum[66] % dummy text
\begin{table}[htbp!]
\centering
\begin{tabular}{@{} lll S[table-format=4.0]
S[table-format=2.2] @{}}
\toprule
Variet & Person & Reference & {Total}& {(\%)} \\
\midrule
SING & 1 & overt & 586 & 12.11 \\
& & null & 32 & 0.66 \\
& 2 & overt & 413 & 8.54 \\
& & null & 4 & 0.08 \\
& 3 & overt & 428 & 8.85 \\
& & null & 28 & 0.52 \\
& \textit{it} & overt & 25 & 0.52 \\
& & null & 5 & 0.10 \\
& \textit{there}& overt & 56 & 1.16 \\
& & null & 1 & 0.02 \\
\midrule
Sum & & & 1578 & 32.62 \\
\midrule
HK & 1 & overt & 603 & 13.42 \\
& & null & 11 & 0.24 \\
& 2 & overt & 469 & 10.44 \\
& & null & 13 & 0.29 \\
& 3 & overt & 426 & 9.48 \\
& & null & 42 & 0.93 \\
& \textit{it} & overt & 28 & 0.58 \\
& & null & 9 & 0.19 \\
& \textit{there}& overt & 63 & 1.30 \\
& & null & 0 & 0.00 \\
\midrule
Sum & & & 1664 & 34.39 \\
\midrule
GB & 1 & overt & 745 & 16.59 \\
& & null & 9 & 0.20 \\
& 2 & overt & 304 & 6.77 \\
& & null & 0 & 0.00 \\
& 3 & overt & 361 & 8.03 \\
& & null & 18 & 0.40 \\
& \textit{it} & overt & 61 & 1.26 \\
& & null & 2 & 0.04 \\
& \textit{there}& overt & 96 & 1.98 \\
& & null & 0 & 0.00 \\
\midrule
Sum & & & 1586 & 32.99 \\
\midrule
Total & & & 4838 & 100.00\\
\bottomrule
\end{tabular}
\caption{A caption}\label{table:iv-1}
\end{table}
\lipsum[1-5] % dummy text
\end{document}
此 MWE 可用于定义您的文档样式。仅添加所需的包(您真的需要所有包吗?),注意每个包仅加载一个。