Text Formatting ⇒ Bold Caption Numbers and no Chapter Numbers in Caption
-
BoudewijnD
- 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
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
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
-
BoudewijnD
- 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}
-
BoudewijnD
- 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
-
BoudewijnD
- Posts: 60
- Joined: Wed Nov 18, 2009 4:18 pm
Re: Bold Caption Numbers and no Chapter Numbers in Caption
-
BoudewijnD
- 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
-
BoudewijnD
- 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