表格列表中表格标题的长标题

表格列表中表格标题的长标题

有没有办法让表格标题的第二行位于第一行开头的正下方?这是我的代码:

\documentclass[10pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[left = 3cm,right = 2cm,top = 3cm,bottom = 2cm]{geometry}

\usepackage{tocloft}

\renewcommand*{\listtablename}{\hfill\bfseries\normalsize\MakeUppercase{Lista de Tabelas}\hfill}
\renewcommand{\cfttabfont}{Tabela }
\renewcommand{\cfttabaftersnum}{ ---}
\setlength{\cfttabindent}{0pt}

\begin{document}
    \listoftables
    \pagebreak
    \begin{table}
        \centering
        \caption{Some naughty table that has a long title just to show my point that a longe title which takes two lines doesn't continue just below the start of the first line}
        \begin{tabular}{c|c}
            \hline 
            A & B \\ 
            \hline 
            C & D \\ 
            \hline 
        \end{tabular} 
    \end{table}
\end{document}

我拥有的和我希望拥有的:在此处输入图片描述

答案1

该命令\cfttabfont应该是一些字体更改命令,它是不是用于在数字前添加内容。如果您想在数字前添加内容,请使用\cfttabpresnum。此外,格式Tabela <num> ---需要更多numwidth,因此让我们通过一次调用来设置\cfttabindent和。\cfttabnumwidth\cftsetindents

\documentclass[10pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[left = 3cm,right = 2cm,top = 3cm,bottom = 2cm]{geometry}

\usepackage{tocloft}

\renewcommand*{\listtablename}{\hfill\bfseries\normalsize\MakeUppercase{Lista de Tabelas}\hfill}
% Not this:
%\renewcommand{\cfttabfont}{Tabela }
% But this:
\renewcommand{\cfttabpresnum}{Tabela~}
\renewcommand{\cfttabaftersnum}{ ---}
%\setlength{\cfttabindent}{0pt}
% Both \cfttabindent and \cfttabnumwidth need to be changed
\cftsetindents{table}{0pt}{5.5em}% Adjust 5.5em if necessary

\begin{document}
    \listoftables
    \pagebreak
    \begin{table}
        \centering
        \caption{Some naughty table that has a long title just to show my point that a longe title which takes two lines doesn't continue just below the start of the first line}
        \begin{tabular}{c|c}
            \hline 
            A & B \\ 
            \hline 
            C & D \\ 
            \hline 
        \end{tabular} 
    \end{table}
\end{document}

很多

相关内容