我尝试将多个表格对齐为子表格,但是这将(根据我当前的代码)导致在列出表格时对表格进行错误编号。我要么希望将其作为
- 表A
- 表 B
或者
- 表 A 1.1 表 A1 1.2 表 A2 1.3 表 A3
- 表 B2.1...
我如何实现这个目标?
%----------------------------------------------------------------------------
% LAYOUT
%----------------------------------------------------------------------------
\documentclass[
12pt,
a4paper,
headings=standardclasses,
listof=totoc,
numbers=noenddot
]{scrartcl}
\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.00cm, footskip=1cm]{geometry}
\usepackage[onehalfspacing]{setspace}
\usepackage[main=ngerman, english]{babel}
\usepackage[babel, german=quotes]{csquotes}
\usepackage[ngerman]{isodate}
\usepackage[ngerman]{datetime}
%----------------------------------------------------------------------------
% TOC
%----------------------------------------------------------------------------
\KOMAoptions{toc=sectionentrydotfill}
\renewcaptionname{ngerman}{\contentsname}{Inhaltsverzeichnis}
\BeforeTOCHead[toc]{{\pdfbookmark[1]{\contentsname}{toc}}}% TOC in bookmarks
%----------------------------------------------------------------------------
% BIB
%----------------------------------------------------------------------------
\usepackage[
backend=biber,
style=ext-authoryear,
sorting=nyvt,
datamodel=customstyles,
maxnames=25
]{biblatex}
\addbibresource{library.bib}
%----------------------------------------------------------------------------
% FIGURES & TABLES
%----------------------------------------------------------------------------
\renewcommand{\listtablename}{Tabellenverzeichnis}
\renewcommand{\tablename}{Tab.}
\counterwithout{table}{section}
\usepackage{array}
\newcolumntype{P}[1]{>{\raggedleft\arraybackslash}p{#1}}
\renewcommand{\arraystretch}{1.5}
\usepackage{subcaption,booktabs}
\usepackage{arydshln}% draw dash-lines in tables
\usepackage{colortbl}
\setlength\dashlinedash{0.2pt}
\setlength\dashlinegap{1.5pt}
\setlength\arrayrulewidth{0.3pt}
\usepackage{diagbox}% diagonal box
\usepackage{multirow}% multirow for diagonal box
%----------------------------------------------------------------------------
% MAIN
%----------------------------------------------------------------------------
\begin{document}
\listoftables
\addcontentsline{toc}{chapter}{Tabellenverzeichnis}
\renewcommand{\listtablename}{Tabellenverzeichnis}
\renewcommand{\tablename}{Tab.}
\counterwithout{table}{section}
\begin{table}
\caption{TableA}\label{ta:ta1}
\begin{subtable}[t]{0.275\linewidth}
\caption{TableA1}\label{ta:ta1a}
\centering
\begin{tabular}[t]{l}
\toprule
\multicolumn{1}{c}{\textbf{TableA1}} \\
\midrule
a \\ \hdashline
b \\ \hdashline
c \\ \hdashline
d \\ \hdashline
e \\ \hdashline
f \\ \hdashline
g \\ \hdashline
h \\ \hdashline
i \\
\bottomrule
\end{tabular}\smallskip
\end{subtable}
\begin{subtable}[t]{0.275\linewidth}
\caption{TableA2}\label{ta:ta1b}
\centering
\begin{tabular}[t]{l}
\toprule
\multicolumn{1}{c}{\textbf{TableA2}} \\
\midrule
a \\ \hdashline
b \\ \hdashline
c \\ \hdashline
d \\ \hdashline
e \\
\bottomrule
\end{tabular}
\smallskip
\end{subtable}
\begin{subtable}[t]{0.275\linewidth}
\caption{TableA3}\label{ta:ta1c}
\centering
\begin{tabular}[t]{lp{2.5cm}}
\toprule
\multicolumn{2}{c}{\textbf{TableA3}} \\
\midrule
1 & 2 \\
\hdashline
3 & 4 \\
\hdashline
5 & 6 \\
\bottomrule
\end{tabular}
\smallskip
\end{subtable}
\begin{center}
Quelle: XYZ
\end{center}
\end{table}
\begin{table}
\caption{TableB}\label{ta:action}
\begin{subtable}[t]{0.45\linewidth}
\caption{TableB2}\label{ta:TA2a}
\centering
\begin{tabular}[t]{l}
\toprule
\textbf{TA2a} \\
\midrule
nicht \\
\hdashline
einnehmen \\
\hdashline
(be)handeln \\
\hdashline
ausnutzen \\
\hdashline
beschließen \\
\hdashline
konversieren \\
\hdashline
veranlassen \\
\hdashline
Entschluss \\
\hdashline
notwendig sein \\
\hdashline
handeln \\
\bottomrule
\end{tabular}\smallskip
\end{subtable}
\begin{subtable}[t]{0.45\linewidth}
\caption{Table2b}\label{ta:TA2b}
\centering
\begin{tabular}[t]{l}
\toprule
\textbf{TA2b} \\
\midrule
Unheil \\
\hdashline
Katastrophe \\
\hdashline
auf etw. hinauslaufen \\
\hdashline
fallen \\
\hdashline
Unruhe, Verwirrung der Welt \\
\hdashline
Lage, Situation \\
\hdashline
Übel \\
\hdashline
Unfall \\
\hdashline
himmlischer Beistand \\
\bottomrule
\end{tabular}
\smallskip
\end{subtable}
\begin{center}
Quelle: XYZ
\end{center}
\end{table}
\end{document}
答案1
首先,通过删除环境中的所有内容(命令subtable
除外),可以大大缩短 MWE \caption
。还有相当多的软件包与问题无关,事实上,仅使用scrartcl
和即可重新创建行为subcaption
。
使用这个缩短的例子,我们可以看到,添加\KOMAoption{captions}{tableheading}
会产生正确的表格编号:
\documentclass{scrartcl}
\KOMAoption{captions}{tableheading}
\usepackage{subcaption}
\begin{document}
\listoftables
\begin{table}
\caption{TableA}\label{ta:ta1}
\centering
\begin{subtable}[t]{0.275\linewidth}
\caption{TableA1}\label{ta:ta1a}
\end{subtable}
\begin{subtable}[t]{0.275\linewidth}
\caption{TableA2}\label{ta:ta1b}
\end{subtable}
\begin{subtable}[t]{0.275\linewidth}
\caption{TableA3}\label{ta:ta1c}
\end{subtable}
\end{table}
\begin{table}
\caption{TableB}\label{ta:action}
\begin{subtable}[t]{0.45\linewidth}
\caption{TableB2}\label{ta:TA2a}
\end{subtable}
\begin{subtable}[t]{0.45\linewidth}
\caption{Table2b}\label{ta:TA2b}
\end{subtable}
\end{table}
\end{document}