scrreprt 클래스의 캡션에서 테이블 제목 추가

scrreprt 클래스의 캡션에서 테이블 제목 추가

나는 모든 테이블에 를 통해 테이블 ​​목록에 사용되는 문서의 동일한 제목을 지정하는 방법을 심하게 찾고 있습니다 caption[title]{long description...}. 그 이유는 내 테이블이 R(xtable)에서 생성되었기 때문입니다. 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}

원하는 것을 달성해야합니다.

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} 

산출:

여기에 이미지 설명을 입력하세요

관련 정보