
Ich suche dringend nach einer Möglichkeit, allen meinen Tabellen im Dokument denselben Titel zu geben, der in der Tabellenliste über verwendet wird caption[title]{long description...}
. Der Grund dafür ist, dass meine Tabellen aus R (xtable) stammen, das jedes Mal, wenn ich sie neu berechne, genau das obige Format verwendet, und ich kann das nicht ändern. Daher konnte ich leider keine anderen Lösungen verwenden. Dies ist für mich eine sehr wichtige Angelegenheit, da mein Dokument viele Tabellen enthält.
Hier ist ein MWE. Wie Sie sehen, fehlen die Titel und nur die Beschriftungen sind sichtbar. Die Einrückung in der längeren Beschreibung ist beabsichtigt.
Bearbeiten:
Um das besser zu veranschaulichen, habe ich ein Bild gemacht:
\documentclass[a4paper, 12pt, headsepline, smallheadings]{scrreprt}
\usepackage[labelfont={small,bf}, textfont=small, labelsep=colon,singlelinecheck=false,format=plain, parindent=1em]{caption}
\newlength\myindention
\DeclareCaptionFormat{myformat}%
{#1#2\\\hspace*{\myindention}#3}
\setlength\myindention{1em}
\captionsetup{format=myformat}
\usepackage{chngcntr}
\counterwithout{table}{chapter}
\begin{document}
\listoftables
\chapter{Introduction}
\begin{table}[h]
\caption[title table 1]{description table 1}
\fbox{content}
\end{table}
\begin{table}[h]
\caption[title table 2]{description table 2}
\fbox{content}
\end{table}
\end{document}
Vielen Dank für jede Hilfe. Freundliche Grüße, Tom.
Antwort1
Wenn Sie sicher sind, dass alle Ihre Untertitel dieses Format haben, fügen Sie der Präambel die folgenden Zeilen hinzu:
\let\oldcaption\caption
\renewcommand*\caption[2][]{%
\oldcaption[#1]{#1\\\hspace*{\myindention}#2}%
}
und Entfernen der folgenden
\DeclareCaptionFormat{myformat}%
{#1#2\\\hspace*{\myindention}#3}
\captionsetup{format=myformat}
du solltest erreichen was du willst.
MWE
\documentclass[a4paper, 12pt, headsepline, smallheadings]{scrreprt}
\usepackage[labelfont={small,bf}, textfont=small, labelsep=colon,singlelinecheck=false,format=plain, parindent=1em]{caption}
\newlength\myindention
\setlength\myindention{1em}
\usepackage{chngcntr}
\counterwithout{table}{chapter}
\let\oldcaption\caption
\renewcommand*\caption[2][]{%
\oldcaption[#1]{#1\\\hspace*{\myindention}#2}%
}
\begin{document}
\listoftables
\chapter{Introduction}
\begin{table}[h]
\caption[title table 1]{description table 1}
\fbox{content}
\end{table}
\begin{table}[h]
\caption[title table 2]{description table 2}
\fbox{content}
\end{table}
\end{document}
Ausgabe: