scrreprt クラスのキャプションから表のタイトルを追加する

scrreprt クラスのキャプションから表のタイトルを追加する

私は、ドキュメント内のすべてのテーブルに、 を介してテーブルのリストで使用される同じタイトルを付ける方法を必死に探していますcaption[title]{long description...}。その理由は、私のテーブルが R (xtable) から取得されており、再計算するたびに上記の形式が正確に使用され、それを変更できないためです。そのため、残念ながら、別のソリューションを利用することはできませんでした。ドキュメントには多くのテーブルがあるため、これは私にとって非常に重要な問題です。

これが MWE です。ご覧のとおり、タイトルが欠落しており、ラベルのみが表示されています。長い説明のインデントは意図的なものです。

編集:

これをよりわかりやすく説明するために、次の図を作成しました。 ここに画像の説明を入力してください

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

ご協力いただければ幸いです。よろしくお願いいたします。トム

答え1

すべてのキャプションがこの形式になっていることが確実な場合は、前文に次の行を追加します。

\let\oldcaption\caption
\renewcommand*\caption[2][]{%
\oldcaption[#1]{#1\\\hspace*{\myindention}#2}%
}

そして次のものを削除します

\DeclareCaptionFormat{myformat}%
{#1#2\\\hspace*{\myindention}#3}

\captionsetup{format=myformat}

あなたが望むものを達成できるはずです。

ムウェ

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

出力:

ここに画像の説明を入力してください

関連情報