MathGroup Archive 2003

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

Search the Archive

Re: Numbering of figure captions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38710] Re: Numbering of figure captions
  • From: Mike <mikeh1980 at optusnet.com.au>
  • Date: Mon, 6 Jan 2003 03:43:07 -0500 (EST)
  • References: <auuaf7$obi$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

This code actually puts a figure number in the cell margin of the graphic.
My problem is slightly different. I have a text cell below the graphic which
is a style called "figure caption." I have automatic numbering in this
"figure caption" cell and it is this automatically generated number which I
would like to make "static" at the top left hand side of the cell.

Thanks

Mike


On 1/1/03 7:56 PM, in article auuaf7$obi$1 at smc.vnet.net, "Omega Consulting"
<info at omegaconsultinggroup.com> wrote:

> 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: Plotting 3D with regions with non constant limits
  • Next by Date: Re: Re: OOP experiments- Component
  • Previous by thread: Re: Numbering of figure captions
  • Next by thread: Re: OOP in Mathematica