在乳胶中将表格的标题调整到表格的左上角

在乳胶中将表格的标题调整到表格的左上角

我有这个输出:

在此处输入图片描述

问题

我想将标题与表格本身的左上角对齐。

简而言之,我希望它看起来如下所示:

在此处输入图片描述

特克斯代码

\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也可能有用。顺便说一句:用于创建符号、首字母缩略词等列表的包。

相关内容