2

I have a longtable in my file that spans several pages. However \caption is appearing several times in my index. The table title also appears on all pages of the table. How can I fix it so that it appears only once?

How is it:

enter image description here

Short code:

{\tiny
\begin{longtable}{|L{2.4cm}|L{2.5cm}|L{3.2cm}|L{1.8cm}|L{1.8cm}|L{1.5cm}|L{2cm}|L{3.5cm}|}
\caption{Tabela de indicadores atualizada com os indicadores identificados}\\
\hline
\rowcolor[HTML]{44546A} 
\textbf{\textcolor{white}{Dimensão}} &  
\textbf{\textcolor{white}{Macroindicador}} &
\textbf{\textcolor{white}{Indicador}} &
\textbf{\textcolor{white}{Unidade}} & \textbf{\textcolor{white}{Abrangência}} &  \textbf{\textcolor{white}{Fonte}} & \textbf{\textcolor{white}{Disponibilidade}} & \textbf{\textcolor{white}{Link}} \\ \hline
\endhead
%
%

\cellcolor[HTML]{3FD0FF}Agroclimatologia & Temperatura & Temperatura máxima na hora anterior & $^{\circ}\mathrm{C}$ & BRASIL & INMET & disponível (planilha) & {\color[HTML]{0000EE} \url{ https://portal.inmet.gov.br/dadoshistoricos}} \\ \hline
\cellcolor[HTML]{3FD0FF}Agroclimatologia & Temperatura & Temperatura mínima na hora anterior & $^{\circ}\mathrm{C}$ & BRASIL & INMET & disponível (planilha) & {\color[HTML]{0000EE} \url{ https://portal.inmet.gov.br/dadoshistoricos}} \\ \hline

\caption*{Fonte: Autor (2021).}
\end{longtable}
}
1
  • Welcome to TeX.SE.
    – Mico
    Commented Feb 9, 2022 at 15:28

1 Answer 1

1

Currently, you have a single \endhead statement; therefore, the same information -- including the caption material -- gets placed on every page spanned by the longtable.

As a remedy, I suggest that you employ separate \endfirsthead and \endhead directives. For the \endhead part, don't use \caption{...} but, instead, something like

\multicolumn{8}{@{}l}{\tablename~\thetable, contínua}

Some sample code:

\documentclass{article} % or some other suitable document class
\usepackage[a4paper,margin=1.5cm]{geometry} % choose suitable page parameters
%% (the remainder of this preamble is mostly guesswork)
\usepackage[portuguese]{babel}
\usepackage[T1]{fontenc}
\usepackage[table]{xcolor}

\usepackage{array}      % for \newcolumntype macro
\usepackage{ragged2e}   % for \RaggedRight macro
\newcolumntype{L}[1]{>{\RaggedRight\hspace{0pt}}p{#1}}

\usepackage{longtable}
\setlength{\LTcapwidth}{\textwidth}

\begin{document}

\listoftables

\clearpage
\addtocounter{table}{3} % just for this example

\begin{longtable}{|L{2.0cm}|L{2.5cm}|L{1.6cm}|L{1.8cm}| 
                   L{1.3cm}|L{1.5cm}|L{2.0cm}|L{1.5cm}|}

\caption{Indicadores atualizada com os indicadores identificados}\\
\hline
\rowcolor[HTML]{44546A} 
\textbf{\textcolor{white}{Dimensão}} &  
\textbf{\textcolor{white}{Macroindicador}} &
\textbf{\textcolor{white}{Indicador}} &
\textbf{\textcolor{white}{Unidade}} & 
\textbf{\textcolor{white}{Abrangência}} &  
\textbf{\textcolor{white}{Fonte}} & 
\textbf{\textcolor{white}{Disponibilidade}} & 
\textbf{\textcolor{white}{Link}} \\ 
\hline
\endfirsthead

\multicolumn{8}{@{}l}{\tablename~\thetable, contínua}\\[0.5ex]
\hline
\rowcolor[HTML]{44546A} 
\textbf{\textcolor{white}{Dimensão}} &  
\textbf{\textcolor{white}{Macroindicador}} &
\textbf{\textcolor{white}{Indicador}} &
\textbf{\textcolor{white}{Unidade}} & 
\textbf{\textcolor{white}{Abrangência}} &  
\textbf{\textcolor{white}{Fonte}} & 
\textbf{\textcolor{white}{Disponibilidade}} & 
\textbf{\textcolor{white}{Link}} \\ 
\hline
\endhead

\hline
\multicolumn{8}{r@{}}{\footnotesize(Continua na próxima página)}\\
\endfoot

\hline
\multicolumn{8}{c}{Fonte: Autor (2021).}
\endlastfoot

% body of 'longtable'

\end{longtable}

% remainder of paper

\end{document}
1
  • Worked perfectly. Thank you very much!
    – Raffa Bass
    Commented Feb 9, 2022 at 16:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .