我是 LaTeX 新手,正在尝试使用 scrbook 文档类在文档中创建表格。此文档没有其他内容,但第一页本身有一个表格。当我编译时,我收到此错误:“段落中的 \hbox 未满(不良程度 10000)”。
我的代码如下:
\documentclass[12pt,%font size 12
paper =a4,%a4 size paper
final,%final, not draft
twoside = semi,%print two side of the paper
openright,%open new chapter on right page
titlepage = firstiscover,
leqno,%equation number on left
fleqn,
chapterprefix, %Write "Chapter" before chapter name
appendixprefix, %write "Appendix" before appendix name
headsepline, %horizontal line below header
footsepline, %horizontal line above footer
listof = nottotoc,%don't include list of table and list of figures in TOC
parskip = full,
captions = tableheading]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[british]{babel}%use British English
\usepackage{csquotes}
\setcaptionalignment{c}
\begin{document}
\chapter{Introduction}
\begin{table}[htbp]
\centering
\caption{\begin{center}
My Introductory Table
\end{center}}
\label{tbl:sample}
\begin{tabular}{cc}
\hline
Heading 1 & Heading 2\\
\hline
Item 1 & Item 2 \\
Item 3 & Item 4 \\
Item 5 & Item 6 \\
Item 7 & Item 8\\
\hline
\end{tabular}
\end{table}
\end{document}
在所需的输出中,我希望所有表格及其各自的标题都保持居中对齐。我该怎么做?
答案1
center
发布的代码没有给出框不足的警告,但是由于标题内部放错了位置,它会因错误而停止。如果您删除它,您仍然会得到居中的标题,并且不会出现错误或警告。
\documentclass[12pt,%font size 12
paper =a4,%a4 size paper
final,%final, not draft
twoside = semi,%print two side of the paper
openright,%open new chapter on right page
titlepage = firstiscover,
leqno,%equation number on left
fleqn,
chapterprefix, %Write "Chapter" before chapter name
appendixprefix, %write "Appendix" before appendix name
headsepline, %horizontal line below header
footsepline, %horizontal line above footer
listof = nottotoc,%don't include list of table and list of figures in TOC
parskip = full,
captions = tableheading]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[british]{babel}%use British English
\usepackage{csquotes}
\setcaptionalignment{c}
\begin{document}
\chapter{Introduction}
\begin{table}[htbp]
\centering
\caption{My Introductory Table}
\label{tbl:sample}
\begin{tabular}{cc}
\hline
Heading 1 & Heading 2\\
\hline
Item 1 & Item 2 \\
Item 3 & Item 4 \\
Item 5 & Item 6 \\
Item 7 & Item 8\\
\hline
\end{tabular}
\end{table}
\end{document}