MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Numbering of figure captions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38635] Re: [mg38612] Numbering of figure captions
  • From: Omega Consulting <info at omegaconsultinggroup.com>
  • Date: Wed, 1 Jan 2003 03:40:58 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

At 10:49 PM 12/30/2002, Mike wrote:
>I'm trying to implement automatic numbering of figure captions. This is no
>problem with the actual numbering eg.
>
>   CellFrameLabels->{{Cell[
>           TextData[ {"Fig. ",
>             CounterBox[ "NumberedFigureCaption"]}]], None}, {None, None}}
>
>I get the figure number in the left hand cell margin okay...but I'd like the
>number to remain in the top left hand corner of the cell.
>It currently floats in the middle left hand side of the cell.
>
>I've tried including things like
>
>CellBaseline ->
>CellLabelPositioning->
>
>into the Cell box that contains the CounterBox but that doesn't seem to
>help.
>
>
>Any suggestions would be appreciated.
>
>thanks
>
>Mike

You can't do this with the CellFrameLabels. They aren't that flexible. You 
can do this with a GridBox, though.

Here's your counter:

num = Cell[TextData[ {"Fig. ",
             CounterBox[ "NumberedFigureCaption"]}]];

Here's a function that creates a Graphics cell from a Graphics expression:

GraphicsCell[gr_] := Cell[GraphicsData["PostScript", DisplayString[gr]]]

Put them together in a GridBox and CellPrint:

MakeFigure[gr_] :=
   CellPrint[
     Cell[BoxData[
         GridBox[{{num, GraphicsCell[gr]}}, RowAlignments->Top]],
       "NumberedFigureCaption",CellFrameLabels->{{None, None}, {None, None}}] ]

Now this gives you what you want:

MakeFigure[Plot[x,{x,0,1}, DisplayFunction->Identity]]
or
Plot[x, {x, 0, 1}, DisplayFunction->MakeFigure]

If you want to make a lot of these, use it to set $DisplayFunction.

$DisplayFunction = (MakeFigure[#];#)&;

And it will be done automatically.

Plot[x,{x,0,1}]

--------------------------------------------------------------
Omega Consulting
"The final answer to your Mathematica needs"
http://omegaconsultinggroup.com



  • Prev by Date: Re: scaling/translating Polyhedra - is this how??
  • Next by Date: Re: Circle Fit
  • Previous by thread: Re: Circle Fit
  • Next by thread: Re: Numbering of figure captions