使用 tocloft 对齐表格列表中的长表格标题

使用 tocloft 对齐表格列表中的长表格标题

我正在使用该tocloft包,以便 Table 一词显示在表格列表中的数字之前。当我这样做时,带有长标题的表格会换行到下一行,但不会对齐。这是我正在使用的代码。

\documentclass [12pt] {article}
\usepackage{times, url}
\usepackage[left=1.5in,top=1in,bottom=1in,right=1in,footskip=0.5in]{geometry}
\usepackage{float}
\usepackage{booktabs,threeparttable}
\usepackage[subfigure]{tocloft}
\usepackage{subfigure}
\usepackage[justification=centering]{caption} 
\renewcommand{\cfttabfont}{Table }


\begin{document} 

\listoftables  

\begin{table}[htbp]
\begin{threeparttable}
\captionsetup{font=normalsize}
\caption{Summary Statistics for Structural Housing Characteristics.  Central Kentucky Data, 2000-2011. N=142,164.}
\centering
\footnotesize
\label{table:sumstatsfull}
\begin{tabular}{lcccc} \hline
Variable & Mean & Std. Dev. & Min & Max \\ \hline
\end{tabular}
\end{threeparttable}
\end{table}

\end{document}
`

I want the Table to precede the table number but I want the caption to be aligned like it is when the code below is used

`
\documentclass [12pt] {article}
\usepackage{times, url}
\usepackage[left=1.5in,top=1in,bottom=1in,right=1in,footskip=0.5in]{geometry}
\usepackage{float}
\usepackage{booktabs,threeparttable}
\usepackage[subfigure]{tocloft}
\usepackage{subfigure}
\usepackage[justification=centering]{caption} 
%\renewcommand{\cfttabfont}{Table }


\begin{document} 

\listoftables  

\begin{table}[htbp]
\begin{threeparttable}
\captionsetup{font=normalsize}
\caption{Summary Statistics for Structural Housing Characteristics.  Central Kentucky Data, 2000-2011. N=142,164.}
\centering
\footnotesize
\label{table:sumstatsfull}
\begin{tabular}{lcccc} \hline
Variable & Mean & Std. Dev. & Min & Max \\ \hline
\end{tabular}
\end{threeparttable}
\end{table}

\end{document}

答案1

\cfttabfont旨在用于引入标题和前面数字的字体属性的变化,因此使用它添加一些字符串会产生不良的副作用,就像您注意到的那样。

添加单词“Table”和一个空格\cfttabpresnum,然后使用\cfttabnumwidth来增加为数字保留的空间:

\documentclass[12pt]{article}
\usepackage{times, url}
\usepackage[left=1.5in,top=1in,bottom=1in,right=1in,footskip=0.5in]{geometry}
\usepackage{float}
\usepackage{booktabs,threeparttable}
\usepackage[subfigure]{tocloft}
\usepackage{subfigure}
\usepackage[justification=centering]{caption} 

\newlength\mylen
\renewcommand\cfttabpresnum{Table }
\settowidth\mylen{\cfttabpresnum\cfttabaftersnum}
\addtolength\cfttabnumwidth{\mylen}

\begin{document} 

\listoftables  

\begin{table}[htbp]
\begin{threeparttable}
\captionsetup{font=normalsize}
\caption{Summary Statistics for Structural Housing Characteristics.  Central Kentucky Data, 2000-2011. N=142,164.}
\centering
\footnotesize
\label{table:sumstatsfull}
\begin{tabular}{lcccc} \hline
Variable & Mean & Std. Dev. & Min & Max \\ \hline
\end{tabular}
\end{threeparttable}
\end{table}

\end{document}

在此处输入图片描述

如果希望“表格”刷新到左边距,请添加

\setlength\cfttabindent{0pt}

相关内容