図表一覧で 1 行を超える長いキャプションをシングルスペースで表示

図表一覧で 1 行を超える長いキャプションをシングルスペースで表示

解決策を試してみました\caption[\protect\vspace{-0.5ex}{ long caption text}]{long caption text}が、何も起こりませんでした。LOF では一定の 2 倍のスペースが必要ですが、1 行を超える長いキャプションの場合は 1 倍のスペースにする必要があります。助けていただけませんか? ありがとうございます。

\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 スクリプト マニュアルの章を参照してください。

目次のエントリには、

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

の詳細については、KOMA スクリプト マニュアルのパート II を参照してください\RedeclareSectionCommand

図のリストと表のリストを目次に入れるには、特別な KOMA スクリプト機能であるオプションも使用する必要がありますlistof=totoc。これらのリストから章のギャップを削除するには、ローカルで再定義する必要はなく\addvspace、オプションを使用できます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}

関連情報