그림 목록에서 한 줄 이상의 긴 캡션을 사용하는 경우

그림 목록에서 한 줄 이상의 긴 캡션을 사용하는 경우

해결책을 시도했지만 \caption[\protect\vspace{-0.5ex}{ long caption text}]{long caption text}아무 것도 수행되지 않습니다. LOF에는 일정한 이중 간격이 필요하며, 두 줄 이상의 긴 캡션의 경우 단일 간격이어야 합니다. 도와주시겠어요? 감사합니다.

\documentclass[12pt,oneside,letterpaper,chapterprefix=on,numbers=noenddot]{scrbook}
\setuptoc{toc}{leveldown}% if ToC should be on section level
\usepackage[english]{babel}
%%% document setup
\usepackage[demo]{graphicx}


\usepackage[list-entry=heading]{caption}
\usepackage{booktabs}% table
\usepackage[doublespacing]{setspace}% <- changed


\setkomafont{captionlabel}{\bfseries}%make caption label bold
\setkomafont{caption}{\bfseries}%make caption bold
\setcapindent{0pt}%removes hanging indent from captions





%----------------%-------------------------%-----------
\begin{document}

\begingroup
\def\addvspace#1{}
\clearpage % to force a new page
\addcontentsline{toc}{chapter}{LIST OF FIGURES}
\listoffigures
%\doublespacing
\endgroup
\mainmatter

\begin{figure}
\includegraphics{test}
\caption[\protect\vspace{-0.25ex}{ llong caption text 2long caption text 3long caption text 4long caption text 5long caption text }]{1long caption text 2long caption text 3long caption text 4long caption text 5long caption text 6long caption text}
\end{figure}
\begin{figure}


\includegraphics{test2}
\caption[\protect\vspace{-0.5ex}{ llong caption text 2long caption text 3long caption text 4long caption text 5long caption text }]{1long caption text 2long caption text 3long caption text 4long caption text 5long caption text 6long caption text}
\end{figure}
\end{document}

답변1

따라서 그림(및 기타 목차) 목록을 단일 간격으로 설정하십시오. 를 사용하여 제목 바로 뒤 또는 를 사용하여 해당 목차의 보조 파일을 읽기 직전에 \singlespacing또는 \setstretch{1}맨 처음에 추가할 수 있습니다 . 예:\AfterTOCHead\BeforeStartingTOC

\BeforeStartingTOC[lof]{\singlespacing}% for the list of figures only

또는

\BeforeStartingTOC{\singlespacing}% for every TOC (i.e. table of contents, list of figures, list of tables)

그림 목록 항목 사이에 흰색 선을 표시하려면 옵션을 변경할 수 있습니다 beforeskip. 예를 들어 다음을 사용합니다.

\DeclareTOCStyleEntry[beforeskip=\baselineskip]{tocline}{figure}

이 작업은 해당 항목이 있어야 하는 모든 항목 유형에 대해 수행되어야 합니다. 테이블의 경우 명령을 복사하고 figure로 바꿉니다 table.

tocbasic자세한 내용은 KOMA-Script 매뉴얼의 장을 참조하십시오 .

목차 항목의 경우 다음을 사용할 수도 있습니다.

\RedeclareSectionCommands[tocbeforeskip=\baselineskip]{section,subsection}

에 대한 자세한 내용은 KOMA-Script 매뉴얼의 파트 II를 참조하세요 \RedeclareSectionCommand.

그림 목록과 표 목록을 목차에 넣으려면 특별한 KOMA 스크립트 기능인 옵션을 사용해야 합니다 listof=totoc. 이 목록에서 장 간격을 제거하려면 로컬로 재정의할 필요가 없지만 \addvspaceoption 을 사용할 수 있습니다 listof=nochaptergap.

이러한 변경으로 인해 더 이상 선택적 인수를 사용할 필요가 없습니다 \caption.

\documentclass[12pt,oneside,letterpaper,chapterprefix=on,numbers=noenddot,
  listof=totoc,listof=nochaptergap% <--- ADDED
]{scrbook}
\setuptoc{toc}{leveldown}% if ToC should be on section level
\usepackage[english]{babel}
%%% document setup
\usepackage[demo]{graphicx}


\usepackage[list-entry=heading]{caption}
\usepackage{booktabs}% table
\usepackage[doublespacing]{setspace}

\setkomafont{captionlabel}{\bfseries}%make caption label bold
\setkomafont{caption}{\bfseries}%make caption bold
\setcapindent{0pt}%removes hanging indent from captions

\BeforeStartingTOC{\singlespacing}% <--- ADDED
\DeclareTOCStyleEntry[beforeskip=\baselineskip]{tocline}{figure}
\DeclareTOCStyleEntry[beforeskip=\baselineskip]{tocline}{table}    

%----------------%-------------------------%-----------
\begin{document}

\frontmatter% <--- ADDED (without \mainmatter wouldn't make sense)

% CHANGED:
\listoffigures
\mainmatter

\begin{figure}
\includegraphics{test}
\caption{llong caption text 2long caption text 3long caption text 4long caption text 5long caption text}
\end{figure}
\begin{figure}


\includegraphics{test2}
\caption{llong caption text 2long caption text 3long caption text 4long caption text 5long caption text}
\end{figure}
\end{document}

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

답변2

그림 목록은 \l@figure서식을 지정하는 데 사용되므로 추가로 \vspace{\baselineskip}. 이는 모든 문서 클래스에서 작동합니다.

이중 간격은 타자기로 수행됩니다. 조판기는 줄 사이에 추가 공간을 추가합니다.

\documentclass[12pt,oneside,letterpaper,chapterprefix=on,numbers=noenddot]{scrbook}
\setuptoc{toc}{leveldown}% if ToC should be on section level
\usepackage[english]{babel}
%%% document setup
\usepackage[demo]{graphicx}


\usepackage[list-entry=heading]{caption}
\usepackage{booktabs}% table
%\usepackage[doublespacing]{setspace}% <- changed


\setkomafont{captionlabel}{\bfseries}%make caption label bold
\setkomafont{caption}{\bfseries}%make caption bold
\setcapindent{0pt}%removes hanging indent from captions

\makeatletter
\let\oldl@figure=\l@figure
\renewcommand{\l@figure}{\vspace{\baselineskip}\oldl@figure}
\makeatother

\begin{document}

\begingroup
\def\addvspace#1{}
\clearpage % to force a new page
\addcontentsline{toc}{chapter}{LIST OF FIGURES}
\listoffigures}%\doublespacing
\endgroup
\mainmatter

\begin{figure}
\includegraphics{test}
\caption{1long caption text 2long caption text 3long caption text 4long caption text 5long caption text 6long caption text}
\end{figure}
\begin{figure}


\includegraphics{test2}
\caption[\protect\vspace{-0.5ex}{ llong caption text 2long caption text 3long caption text 4long caption text 5long caption text }]{1long caption text 2long caption text 3long caption text 4long caption text 5long caption text 6long caption text}
\end{figure}
\end{document}

관련 정보