Article View: trl
Article #3SUMMARY: Fancy figure numbering in LaTeX
From: Soh Kam Hung
Date: Mon, 23 Nov 1992 23:11
Date: Mon, 23 Nov 1992 23:11
63 lines
2640 bytes
2640 bytes
PROBLEM:
soh@tmp_ip_003.trl.OZ.AU (Soh Kam Hung) writes:
>I want figures in my document to have the section number preceeding the
>figure number. The counter for the figure number should be reset at
>the start of each section.
Thanks for the following people for replying to my article:
AUGH PHUQ KILL!!!!!!!!! <cjf@maths.uq.oz.au>
(mcl) mcl@eikona.eng.monash.edu.au
Greg Lampard <g.lampard@trl.oz.au>
SOLUTIONS:
Mine:
\renewcommand{\thefigure}{\arabic{section}.\arabic{figure}}
At the beginning of each section, I reset the figure number:
\setcounter{figure}{0}
\section{blah blah blah}
Greg's:
It's all done (I think) by the \@startsection command,
which just has an argument (secnumdepth?) to tell it whether it's a
chapter, section, subsection. I think if you want to avoid resetting the
figure counter you'll have to extract the definition of \@startsection
from latex.tex, put it at the top of your document, and edit it to
include something like:
if (secnumdepth = 2) figure = 0
that's not the right syntax, but you get the idea.
Maybe it's easier just to reset the counter every time!
mcl@eikona.eng.monash.edu.au:
\renewcommand{\thefigure}{\arabic{section}.\arabic{figure}}
\@addtoreset{figure}{section}
But that only works if this command is in a .sty file.
cjf@maths.uq.oz.au showed me how to use the \@ command in a document:
\renewcommand{\thefigure}{\arabic{section}.\arabic{figure}}
\makeatletter
\@addtoreset{figure}{section}
\makeatother
CONCLUSION:
cjf@maths.uq.oz.au's solution is the best, since I can have fancy
numbering without requiring another file.
Regards,
--
Soh Kam Hung, Network Management Research, | h.soh@trl.oz.au
TRL, POB 249 Clayton, Victoria 3168, Australia | +61 3 253 6638
Technical Details
Message-ID:
<1992Nov23.231108.5376@trl.oz.au>Path:
arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!chx400!Sirius.dfn.de!news.belwue.de!math.fu-berlin.de!fauern!LRZnews!regent!monu1.cc.monash.edu.au!monu6!bruce.cs.monash.edu.au!munnari.oz.au!titan!tmp_ip_003!sohReferences:
<1992Nov18.005229.8459@trl.oz.au>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f4a99,17abfd479bc327f8 X-Google-Attributes: gidf4a99,public X-Google-ArrivalTime: 1992-11-24 16:02:50 PST Newsgroups: trl,aus.tex Path: arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!chx400!Sirius.dfn.de!news.belwue.de!math.fu-berlin.de!fauern!LRZnews!regent!monu1.cc.monash.edu.au!monu6!bruce.cs.monash.edu.au!munnari.oz.au!titan!tmp_ip_003!soh From: soh@tmp_ip_003.trl.OZ.AU (Soh Kam Hung) Subject: SUMMARY: Fancy figure numbering in LaTeX Message-ID: <1992Nov23.231108.5376@trl.oz.au> Keywords: latex figure Sender: root@trl.oz.au (System PRIVILEGED Account) Organization: Telecom Research Labs, Melbourne, Australia References: <1992Nov18.005229.8459@trl.oz.au> Distribution: aus Date: Mon, 23 Nov 1992 23:11:08 GMT Lines: 63