我有这个输出:
问题
我想将标题与表格本身的左上角对齐。
简而言之,我希望它看起来如下所示:
特克斯代码
\documentclass{article}
\usepackage{caption}
\begin{document}
\begin{table}[h]
\captionsetup{labelfont=bf,singlelinecheck=false,
labelsep=newline,skip=2pt,
justification=raggedright}
\caption{Notations used in this paper}
\centering
\begin{tabular}{@{}ll@{}}
\hline
Symbols & Description \\
\hline \textit{$ \mathcal{D}$} & A \\
\end{tabular}
\end{table}
\end{document}
这是代码的输出:
知道如何在 LaTeX 中执行此操作吗?或者提供可能进一步帮助我完成此任务的资源链接。
答案1
目前还不清楚您是否想要:
\documentclass{article}
\usepackage{caption}
\usepackage{threeparttable}
\captionsetup{labelfont=bf,singlelinecheck=false,
labelsep=newline,skip=2pt,
justification=raggedright}
\begin{document}
\begin{table}[h]% Note: restriction h does not mean "here and only here", but
% only "here if it fits and otherwise top".
\centering
\begin{threeparttable}
\caption{Notations used in this paper}
\begin{tabular}{@{}ll@{}}
\hline
Symbols & Description \\
\hline \textit{$ \mathcal{D}$} & A \\
\end{tabular}
\end{threeparttable}
\end{table}
\end{document}
或者
\documentclass{article}
\usepackage{caption}
\captionsetup{labelfont=bf,singlelinecheck=false,
labelsep=newline,skip=2pt,
justification=raggedright}
\begin{document}
\begin{table}[h]% Note: restriction h does not mean "here and only here", but
% only "here if it fits and otherwise top".
\caption{Notations used in this paper}
\begin{tabular}{@{}ll@{}}
\hline
Symbols & Description \\
\hline \textit{$ \mathcal{D}$} & A \\
\end{tabular}
\end{table}
\end{document}
或者
\documentclass{article}
\usepackage{caption}
\usepackage{threeparttable}
\captionsetup{labelfont=bf,singlelinecheck=false,
labelsep=newline,skip=2pt,
justification=raggedright}
\begin{document}
\begin{table}[h]% Note: restriction h does not mean "here and only here", but
% only "here if it fits and otherwise top".
\begin{threeparttable}
\caption{Notations used in this paper}
\begin{tabular}{@{}ll@{}}
\hline
Symbols & Description \\
\hline \textit{$ \mathcal{D}$} & A \\
\end{tabular}
\end{threeparttable}
\end{table}
\end{document}
无论你想要什么,我建议也加载包裹booktabs
并使用\toprule
,\midrule
和 (另外)\bottomrule
代替\hline
。如果描述列应该有几行描述,tabularx
或者xltabular
也可能有用。顺便说一句:用于创建符号、首字母缩略词等列表的包。。