Text Formatting ⇒ Bold Caption Numbers and no Chapter Numbers in Caption
-
- Posts: 60
- Joined: Wed Nov 18, 2009 4:18 pm
Bold Caption Numbers and no Chapter Numbers in Caption
I'm working on the layout of my thesis and want some change in the captions but I don't get it to work.
I want to change the caption from:
Figure 1.1: Nice Pic
to
Figure 1: Nice Pic
Were the number stands for the picture number and not the chapter number.
I already look into the caption package but I could not find the right commands to do it.
Thanx,
\BoudewijnD
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
Bold Caption Numbers and no Chapter Numbers in Caption
Code: Select all
\documentclass{book}
\usepackage[within=none]{caption}
\DeclareCaptionLabelFormat{myformat}{#1~\textbf{#2}}
\captionsetup{labelformat=myformat}
\begin{document}
\chapter{Nice Chapter}
\begin{figure}
\caption{Nice Pic}
\end{figure}
\end{document}
Axel
-
- Posts: 60
- Joined: Wed Nov 18, 2009 4:18 pm
Re: Bold Caption Numbers and no Chapter Numbers in Caption
The bold part worked out great. Only the removing chapter numbering didn't work. I get this error:
Option clash for package caption. \DeclareCaptionLabelFormat
So what did I do wrong.
\BoudewijnD
Bold Caption Numbers and no Chapter Numbers in Caption
"Option clash" means that the caption package was already loaded so you cannot load it again with options. You can try:BoudewijnD wrote:Option clash for package caption.
- Add the "within=none" option to the existing \usepackage[...]{caption} instead of trying to load it again.
or
- Use \captionsetup{within=none} after loading the caption package, e.g.:
Code: Select all
\documentclass{book}
\usepackage{caption}
\DeclareCaptionLabelFormat{myformat}{#1~\textbf{#2}}
\captionsetup{within=none,labelformat=myformat}
\begin{document}
\chapter{Nice Chapter}
\begin{figure}
\caption{Nice Pic}
\end{figure}
\end{document}
-
- Posts: 60
- Joined: Wed Nov 18, 2009 4:18 pm
Bold Caption Numbers and no Chapter Numbers in Caption
that last trick with the:
Code: Select all
\usepackage{caption}
\DeclareCaptionLabelFormat{myformat}{#1~\textbf{#2}}
\captionsetup{within=none,labelformat=myformat}
Can you explain me a little bit what the code means. So I can learn and maybe you this knowledge in the future.
Thanx,
\BoudewijnD
Re: Bold Caption Numbers and no Chapter Numbers in Caption
-
- Posts: 60
- Joined: Wed Nov 18, 2009 4:18 pm
Re: Bold Caption Numbers and no Chapter Numbers in Caption
-
- Posts: 60
- Joined: Wed Nov 18, 2009 4:18 pm
Bold Caption Numbers and no Chapter Numbers in Caption
I got the the Figure environment working with out chapter numbering. But I also have as Scheme environment (as a part of the chemstyle package). But the the chapter numbering is not lost Using this code:
Code: Select all
\usepackage{caption}
\DeclareCaptionLabelFormat{myformat}{#1~\textbf{#2}}
\captionsetup{within=none,labelformat=myformat}
\BoudewijnD
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Bold Caption Numbers and no Chapter Numbers in Caption
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 60
- Joined: Wed Nov 18, 2009 4:18 pm
Re: Bold Caption Numbers and no Chapter Numbers in Caption
You are right it was a bit fussie I started an new topic with a working code.
\Boudewijn