1

I tried to rename two tables locally to 'overview' with the captionsetup option of the caption package and finally want them to appear with this new name in the list of tables (LOT). However the name is switched back to 'table' within the LOT. Is there a way to include the changed name to the LOT? I thought about the 'newfloat' package, but sind I want the renamed tables to appear in the List of Tables instead of a separate list, this seems even harder to achieve. (Also in the List of Overviews the two overviews appeared as 'table').

find a reduced example below, any helpt is highly appreciated. Best regards

\documentclass[a4paper, 11pt, draft]{article}

\usepackage{geometry}
\geometry{a4paper, top=2.54cm, left=4.32cm, right=2.29cm, bottom=2.03cm,headsep=10mm, footskip=12mm}  
\usepackage[onehalfspacing]{setspace} 

%language  
\usepackage [ngerman,english]{babel} 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%font
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

%TOC etc
\usepackage{tocloft}
\usepackage{titletoc}
\setlength{\cftfignumwidth}{1.5em} 
\setlength{\cfttabnumwidth}{1.5em}  
\setlength{\cftsubsecindent}{4em}
\setlength{\cftsecnumwidth}{2.5em}
\setlength{\cftsubsecnumwidth}{2.5em}
\renewcommand{\cftfigfont}{Figure }
\renewcommand{\cfttabfont}{Table } 
\renewcommand{\cfttabaftersnumb}{\hspace*{-2em}}
\renewcommand{\cftfigaftersnumb}{\hspace*{-2em}}

\usepackage{tabularx}
\usepackage{caption}
\usepackage{lipsum}


\begin{document}

\listoftables

\lipsum

{
\captionsetup[table]{name=Overview}
\begin{table}
    \caption{some caption to clearly outline what is going on below. Also elongated to see how the caption will float over the table/overview environment, lalala, so long caption, sososo long caption, some more text and even more.}
    \begin{tabularx}{\textwidth}{|rX|}
    \hline
    1. & \textbf{Some Text.} Some more text of this overview. \\
    \hline
    2. & \textbf{Some Text.} Some more text of this overview. \\
    \hline  
    \end{tabularx}
\end{table}
}

{
\setcounter{table}{0}
\begin{table}[ht!]
    \caption{some other caption to clearly outline what is going on below. Also elongated to see how the caption will float over the table/overview environment, lalala, so long caption, sososo long caption, some more text and even more.}
    \begin{tabularx}{\textwidth}{r|X}
    entry 1 & entry 2 \\
    \hline
    A. & 1000 \\
    B. & 2000 \\
    \hline      
    \end{tabularx}
\end{table}
}


\end{document}

1 Answer 1

1

Using the caption package you can define your own caption list formats with

\DeclareCaptionListFormat{name}{code using #1 and #2}

For this example, two formats were defined: (a) for overviews and (b) for normal tables.

b

% !TeX TS-program = pdflatex

\documentclass[a4paper, 11pt, draft]{article}

\usepackage{geometry}
\geometry{a4paper, top=2.54cm, left=4.32cm, right=2.29cm, bottom=2.03cm,headsep=10mm, footskip=12mm}  
\usepackage[onehalfspacing]{setspace} 

%language  
\usepackage [ngerman,english]{babel} 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%font
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

%TOC etc
\usepackage{tocloft}
\usepackage{titletoc}
\setlength{\cftfignumwidth}{1.5em} 
\setlength{\cfttabnumwidth}{1.5em}  
\setlength{\cftsubsecindent}{4em}
\setlength{\cftsecnumwidth}{2.5em}
\setlength{\cftsubsecnumwidth}{2.5em}
\renewcommand{\cftfigfont}{}
\renewcommand{\cfttabfont}{} % Use for font changes changed <<<<<<<<<<<<<<<<<<<<<<<<<<<<
\renewcommand{\cfttabaftersnumb}{\hspace*{-2em}}
\renewcommand{\cftfigaftersnumb}{\hspace*{-2em}}

\usepackage{tabularx}
\usepackage{lipsum}

\usepackage{caption}
%******************************************************* added <<<<<<<<<<<<
\DeclareCaptionListFormat{overviewformat}{Overview~#1~#2} 
\DeclareCaptionListFormat{simpletable}{Table~#1~#2}
\renewcommand{\numberline}[1]{#1\quad}
\captionsetup[table]{listformat=simpletable} % used for regular tables<<<<<<<<<<
%*******************************************************

\begin{document}
    
    \listoftables
    
    \lipsum
    
{\captionsetup[table]{listformat=overviewformat} % added <<<<<<<<<<
    \renewcommand{\tablename}{Overview} % added <<<<<<<<<<
        \begin{table}
            \caption{some caption to clearly outline what is going on below. Also elongated to see how the caption will float over the table/overview environment, lalala, so long caption, sososo long caption, some more text and even more.}
            \begin{tabularx}{\textwidth}{|rX|}
                \hline
                1. & \textbf{Some Text.} Some more text of this overview. \\
                \hline
                2. & \textbf{Some Text.} Some more text of this overview. \\
                \hline  
            \end{tabularx}
        \end{table}
    }
    
    {%
        \setcounter{table}{0}
        \begin{table}[ht!]
            \caption{some other caption to clearly outline what is going on below. Also elongated to see how the caption will float over the table/overview environment, lalala, so long caption, sososo long caption, some more text and even more.}
            \begin{tabularx}{\textwidth}{r|X}
                entry 1 & entry 2 \\
                \hline
                A. & 1000 \\
                B. & 2000 \\
                \hline      
            \end{tabularx}
        \end{table}
    }   
    
\end{document}

You must log in to answer this question.

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