我是 Latex 的新手,并且正在使用 Overleaf 来编写我的文档。
我已经设法正确获取子表,但无法获取子表标题的括号,例如 (a): X (b): Y。相反,我得到的是 a: X b: Y。
\documentclass[10pt]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{csquotes}% Recommended
\usepackage{graphicx}
\usepackage{caption}
\usepackage[justification=centering]{caption}
\usepackage{subcaption} %multiple images in figure
\usepackage[labelformat=simple]{subcaption}
\renewcommand\thesubfigure{(\alph{subfigure})}
\usepackage{float}
\usepackage{chngcntr}
\usepackage{enumitem} %Indent lists
\usepackage{siunitx} %SI Units
\usepackage{booktabs,siunitx}
\setlength{\parskip}{10pt plus 1pt minus 1pt} %Line after each paragraph
\usepackage{unicode-math}
\usepackage{fixltx2e}% for \textsubscript
\usepackage[fleqn]{amsmath}
\usepackage{boldline}
\usepackage{array}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
%\newcommand{\mysection}[2]{\setcounter{section}{#1}\addtocounter{section}{-1}\section{#2}}
\usepackage{comment}
\usepackage[noadjust]{cite}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
top=20mm,
}
\usepackage{multirow}
\usepackage{soul}
\usepackage{caption}
\usepackage[dvipsnames]{xcolor}
...
\begin{document}
....
\begin{table}[h]
\caption{Bla bla bla. Something value:}
\begin{subtable}{.5\linewidth}
\centering
\caption{:\SI{1}{\meter}}
\begin{tabular}{|c|c|}
\hline
Distance & Speed \\
\hline
6 & 10.00 \\
5 & 10.00 \\
4 & 10.00 \\
3 & 10.00 \\
2 & 10.00 \\
1 & 10.00 \\
\hline
\end{tabular}
\end{subtable}%
\begin{subtable}{.5\linewidth}
\centering
\caption{:\SI{4.5}{\meter}}
\begin{tabular}{|c|c|}
\hline
Distance & Speed \\
\hline
6 & 10.00 \\
5 & 10.00 \\
4 & 10.00 \\
3 & 10.00 \\
2 & 10.00 \\
1 & 10.00 \\
\hline
\end{tabular}
\end{subtable}
\end{table}
...
我已经关注https://www.overleaf.com/learn/latex/How_to_Write_a_Thesis_in_LaTeX_(第 3 部分):图表、子图和表格并看着我怎样才能让两张桌子并排?但仍然没有成功。有什么帮助吗?
答案1
- 您的文档序言存在严重问题:
- 许多包使用不同的选项加载两次
- 软件包加载顺序错误,软件包之间存在冲突
- 正如@Bernard 指出的,问题在于你的定义
subcaption
:相反
\usepackage[labelformat=simple]{subcaption}
你可能正在寻找默认设置subcaption
(请参阅下面的 MWE)
\documentclass[10pt]{article}
\usepackage{geometry}
\geometry{a4paper,
total={170mm,257mm},
left=20mm,top=20mm,
}
\usepackage[english]{babel}
\usepackage[fleqn]{amsmath}
\usepackage{unicode-math} % xelatex
\usepackage[justification=centering]{caption}
\usepackage{subcaption} % <---
\usepackage{array, boldline, booktabs, multirow}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\begin{document}
\begin{table}[ht]
\caption{Bla bla bla. Something value:}
\begin{subtable}{.5\linewidth}
\centering
\caption{:\SI{1}{\meter}}
\begin{tabular}{|c|c|}
\hline
Distance & Speed \\
\hline
6 & 10.00 \\
5 & 10.00 \\
4 & 10.00 \\
3 & 10.00 \\
2 & 10.00 \\
1 & 10.00 \\
\hline
\end{tabular}
\end{subtable}%
\begin{subtable}{.5\linewidth}
\centering
\caption{:\SI{4.5}{\meter}}
\begin{tabular}{|c|c|}
\hline
Distance & Speed \\
\hline
6 & 10.00 \\
5 & 10.00 \\
4 & 10.00 \\
3 & 10.00 \\
2 & 10.00 \\
1 & 10.00 \\
\hline
\end{tabular}
\end{subtable}
\end{table}
\end{document}
这就是你要找的吗?