Graphics, Figures & TablesChanging figure caption from Fig 0.0.1. to Fig 1

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

Changing figure caption from Fig 0.0.1. to Fig 1

Post by insipidtoast »

I don't really like the format of having all those dots and periods. I just want the figures to simply be listed in order starting at "1" not "0.0.1"

How does one (no pun intended) accomplish this?
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class

Recommended reading 2024:

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

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

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Changing figure caption from Fig 0.0.1. to Fig 1

Post by kaiserkarl13 »

This happens because you are using a non-article document class (and a very unusual one, from the looks of it). Articles typically have figure numbers like "1"; books and reports have numbers like "2.1" where 2 is the chapter number and 1 is the figure number. You can change this using the \numberwithin command from the amsmath package.
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

Re: Changing figure caption from Fig 0.0.1. to Fig 1

Post by insipidtoast »

Ok I read the parts of the user guide that mention \numberwithin but I still don't get it. What do I specifically type into the preamble to get what I want?

Thanks
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Changing figure caption from Fig 0.0.1. to Fig 1

Post by kaiserkarl13 »

Without a Infominimal working example of what is currently in your preamble, I don't know. My crystal ball is on backorder (again...).
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Changing figure caption from Fig 0.0.1. to Fig 1

Post by cgnieder »

kaiserkarl13 wrote:Without a Infominimal working example of what is currently in your preamble[...]
There might be nothing as insipidtoast is using LyX...

Have a look at the chngcntr package. The number 0.0.1 stands for <chapter>.<section>.<figure>, probably.

Code: Select all

\documentclass{scrbook}
% ----------
% this needs to be in the preamble:
\usepackage{chngcntr}
\counterwithout{figure}{chapter}
\counterwithout{figure}{section}
% ----------
\begin{document}
\listoffigures

\chapter{test}
\begin{figure}
 \caption{test}
\end{figure}

\chapter{test}
\begin{figure}
 \caption{test}
\end{figure}

\end{document}
Regards
site moderator & package author
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

Changing figure caption from Fig 0.0.1. to Fig 1

Post by insipidtoast »

Thank you very much! Great quick fix, sir.

This does the trick:

Code: Select all

\usepackage{chngcntr}
\counterwithout{figure}{chapter}
\counterwithout{figure}{section}
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Changing figure caption from Fig 0.0.1. to Fig 1

Post by kaiserkarl13 »

There might be nothing as insipidtoast is using LyX...
There is always something in the preamble---LyX doesn't change that. But without knowing which packages are loaded and, more importantly, which document class is in use, I was a bit short on info.

LyX is not some magical being that changes the way LaTeX works---it's a front-end.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Re: Changing figure caption from Fig 0.0.1. to Fig 1

Post by cgnieder »

Oh, I didn't want to imply that LyX changed the way LaTeX works. Why should it do that?

What I meant was: it might be difficult to know what in the preamble is. LyX lets you add things to the preamble but doesn't show what it adds itself. One could of course tell LyX to show the whole source, which is pretty easy actually... (didn't think of that earlier, but then I'm not a LyX user).

Regards
site moderator & package author
Post Reply