表格标签底部对齐

表格标签底部对齐

如何将“表格标签”底部对齐到表格标题?请查看 MWE 文件:

\documentclass{article}
\usepackage[format=hang]{caption}

% Create a length
\newlength\caphang
% Set length as wanted
\setlength\caphang{2cm}

% caption.sty allows us to create our own format
% note: this version assumes the caption is only one paragraph!
\DeclareCaptionFormat{hangit}{%
  \hangindent=\caphang\hangafter=1%
  \makebox[\caphang][l]
  {#1#2}#3\par}

\captionsetup{format=hangit, singlelinecheck=no,
labelfont=sf, % if you want the label a different font, etc.
}

\def\dummytext{A figure or table caption mainly consists of three
  parts: the caption label, which says if this object is a ‘Figure’ or
  ‘Table’ and what number is associated with it, the caption text
  itself, which is normally a short description of contents, and the
  caption separator which separates the text from the label.}

\begin{document}
\dummytext

\begin{table}[h]
  \caption{\dummytext}
\end{table}
\setcounter{figure}{123}
\begin{table}[h]
  \caption{\dummytext}
\end{table}
\begin{table}[h]
\caption{\dummytext}
\begin{tabular}{lll}
\hline
one & two &three\\
one & two &three\\
one & two&three\\
one & two&three\\
one & two&three\\
\hline
\end{tabular}
\end{table}
\end{document} 

在此处输入图片描述

答案1

您想要获得的东西违反了印刷规则。不要这样做。

但是,如果您坚持这样做,请参见下面第一个表的示例:

\documentclass{article}
\usepackage[format=hang]{caption}

% Create a length
\newlength\caphang
% Set length as wanted
\setlength\caphang{2cm}

% caption.sty allows us to create our own format
% note: this version assumes the caption is only one paragraph!
\DeclareCaptionFormat{hangit}{%
  \hangindent=\caphang\hangafter=1%
  \makebox[\caphang][l]
  {#1#2}#3\par}

\captionsetup{format=hangit, singlelinecheck=no,
labelfont=sf, % if you want the label a different font, etc.
}

\def\dummytext{A figure or table caption mainly consists of three
  parts: the caption label, which says if this object is a ‘Figure’ or
  ‘Table’ and what number is associated with it, the caption text
  itself, which is normally a short description of contents, and the
  caption separator which separates the text from the label.}

\begin{document}
\dummytext

\begin{table}[h]
  \caption{\parbox[b]{\dimexpr\linewidth-\caphang}{\dummytext}}
\end{table}
\setcounter{figure}{123}
\begin{table}[h]
  \caption{\dummytext}
\end{table}
\begin{table}[h]
\caption{\dummytext}
\begin{tabular}{lll}
\hline
one & two &three\\
one & two &three\\
one & two&three\\
one & two&three\\
one & two&three\\
\hline
\end{tabular}
\end{table}
\end{document} 

在此处输入图片描述

相关内容