🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Soh Kam Hung Wed, 18 Nov 1992 00:52
Fancy figure numbering in LaTeX
#1
Author: Soh Kam Hung
Date: Wed, 18 Nov 1992 00:52
27 lines
1580 bytes
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.

My solution at the moment is this:

\renewcommand{\thefigure}{\arabic{section}.\arabic{figure}}

At the beginning of each section, I have to reset the figure number:

\setcounter{figure}{0}
\section{blah blah blah}

I have tried the following commands, but the figure number seems to be
always reset by the \subsection command.  I think the \subsection
command uses the \thesection command to generate its numbers.

\renewcommand{\thefigure}{\arabic{section}.\arabic{figure}}
\renewcommand{\thesection}{\arabic{section}\setcounter{figure}{0}}

Please email your solutions, and I will summarise and post them if
there is enough interest.

Thanks,

Soh Kam Hung, Network Management Research,     | h.soh@trl.oz.au  
TRL, POB 249 Clayton, Victoria 3168, Australia | +61 3 253 6638
SUMMARY: Fancy figure numbering in LaTeX
#3
Author: Soh Kam Hung
Date: Mon, 23 Nov 1992 23:11
63 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads