Graphics, Figures & TablesCan we add a title to each caption in scrbook class ?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Can we add a title to each caption in scrbook class ?

Post by Cham »

I'm wondering if it's possible to add a bold title to each figure and table caption, in the scrbook class.

Because of the command \setcapindent*{0pt} in the preamble, the caption text is placed below the caption number, with a useless space after the number (where a single-line title could stand). If I use\setcapindent{0pt} instead, there is no wasted space.

So is there a way to use the useless space after the number to add a title to the caption?

Here's a MWE to try :

Code: Select all

\RequirePackage[l2tabu,orthodox]{nag}
\documentclass[11pt,twoside,letterpaper,headsepline,footsepline,cleardoublepage=plain,]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage[total={6.25in,10in},left=1.25in,top=0.5in,includehead,includefoot]{geometry}
\usepackage{graphicx}
\usepackage{subfig}
\setcapindent*{0pt}

\begin{document}

	\begin{figure}
		\centering
			\includegraphics[height=4cm]{example-image-a}
		\quad
			\includegraphics[height=4cm]{example-image-b}
		\\[12pt]
			\includegraphics[height=4cm]{example-image-c}
		\quad
			\includegraphics[height=4cm]{example-image}
		\caption{Some long description text, to show what would happen when a caption is long, long and very long.  Hey, what a boring text to write !  Maybe I should use a verbatim or another random text package instead of writing this annoying text.  Oh well, such is life anyway.  We never know in advance what would happen next.  Why do I remember the past, and not the future instead, or maybe we already do, so that the future is actually the past?}
	\end{figure}

\end{document}
PS. The autocompletion mechanism of my browser is annoying : always changing "scrbook" to "scrapbook" ! :evil:

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10330
Joined: Mon Mar 10, 2008 9:44 pm

Can we add a title to each caption in scrbook class ?

Post by Stefan Kottwitz »

You could use \setcapindent without a star *, and add a title that way, using the title also for the list of figures:

Code: Select all

\setcapindent{0pt}
...
\caption[Figure title]{\textbf{Figure title}\\Some long description text, ...}
figure.png
figure.png (41.3 KiB) Viewed 1876 times
Stefan
LaTeX.org admin
Post Reply