1

Is there a way of the second line of the title of the table be right below the start of the first line? Here's my code:

\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}

What I have and what I wish I had:enter image description here

1

The command \cfttabfont is supposed to be some font changing command and it is not for adding stuff before the number. If you want to add stuff before the number, use \cfttabpresnum instead. Also, the format Tabela <num> --- needs more numwidth, so let’s set both \cfttabindent and \cfttabnumwidth via a single call to \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}

LoT

  • It worked really well, thank you. But the line between the first table and the second is greater than the others. Do you know why? – Levy Sep 26 '18 at 1:28
  • 1
    @Levy What do you mean? Which line specifically? – Ruixi Zhang Sep 26 '18 at 1:30
  • 1
    That's odd. I'll search what may be conflicting. – Levy Sep 26 '18 at 1:49
  • 2
    @Levy Could it be the "chapterlistsgap" (usually 10pt) which is inserted at every usage of \chapter into the List of Figures and List of Tables? What document class are you using? – Axel Sommerfeldt Sep 26 '18 at 7:02
  • 1
    @Levy I think Axel is right. Is your Figure 1 in one chapter, while the other three figures are in a different chapter? If they are in two different chapters, a “chapter separation” is inserted (and is usually desired). – Ruixi Zhang Sep 26 '18 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.