Automatic Numbering in Mathematica

811 views
Skip to first unread message

TL

unread,
Jan 12, 2009, 8:15:26 PM1/12/09
to
Is there any kind of user control over how the automatic numbering in
Mathematica works?
For example I figured out how to set a cell to have a formula auto
numbered, however I couldn't figure out how to tweak whats actually
displayed there - for instance I'd like to prepend the section number
and replace the default brackets with square ones:

default in Mathematica
(1)
(2)
...
etc


I'd like:
[4.1]
[4.2a]
[4.2b]
[4.3]
...
etc

Sjoerd C. de Vries

unread,
Jan 14, 2009, 5:34:39 AM1/14/09
to
Hi TL,

You can do that using the stylesheet editor (Format/Stylesheet
editor...).

Assuming you're in the default style make a cell in your notebook in
the DisplayedFormulaNumbered style, open the stylesheet editor and
edit the style by clicking and then typing ctrl-shift-E ("Show
expression"). Replace the contents with:

Cell[StyleData["DisplayFormulaNumbered"],
CellMargins->{{60, Inherited}, {Inherited, Inherited}},
StripStyleOnPaste->True,
CellFrameLabels->{{None,
Cell[
TextData[{"[",
CounterBox["Section"],"." ,CounterBox["DisplayFormulaNumbered"],
"]"}]]}, {None, None}},
DefaultFormatType->DefaultInputFormatType,
HyphenationOptions->{"HyphenationCharacter"->"\[Continuation]"},
LanguageCategory->"Formula",
ScriptLevel->0,
SingleLetterItalics->True,
CounterIncrements->"DisplayFormulaNumbered",
MenuPosition->1710,
UnderoverscriptBoxOptions->{LimitsPositioning->True}]

ctrl-shift-E to close again.

This is a modified version of the original hat I copied from the
notebook's parent style (Default.m). From the notebook's stylesheet
you can click through to its parent by clicking it's parent name in
the top of the stylesheet. If you want you could also change the
definition in the default style, but I would suggest making a copy and
use that as your own style file.

BTW Don't know how to have to do these a, b numberings of yours. Aee
they generated automatically?

Cheers -- Sjoerd

David Park

unread,
Jan 14, 2009, 5:35:21 AM1/14/09
to
The Presentations package contains a sub-package called KeyEquations that
allows the users to keep a list of key equations. They can be defined to
display in any style, both for the equation and the label. So you could have
square brackets if you wished. The equations can be recalled at any point
and used as normal equations.

A notebook and PDF file showing an example of this will be posted at Peter
Lindsay's site:

Peter Lindsay at the Mathematical Institute in the University of St Andrews
[ www.mcs.st-and.ac.uk ] has kindly undertaken to maintain an archive that
provides downloadable notebooks and PDF files for various Presentations
solutions that have appeared on MathGroup.

http://blackbook.mcs.st-and.ac.uk/~Peter/djmpark/html/


David Park
djm...@comcast.net
http://home.comcast.net/~djmpark/

pabloapere...@gmail.com

unread,
Feb 1, 2012, 3:55:58 AM2/1/12
to
If you have figured out how to do this, I would appreciate learning about it. I cannot figure out how to set custom equation numbers/labels.

Kevin J. McCann

unread,
Feb 2, 2012, 5:02:58 AM2/2/12
to
On 2/1/2012 3:55 AM, pabloapere...@gmail.com wrote:
> If you have figured out how to do this, I would appreciate learning about it. I cannot figure out how to set custom equation numbers/labels.
>
This is taken from my style sheet for a cell type NumberedEquation. The
key entries for numbering are the CellFrameLabels and CounterIncrements.
The latter designates a counter name so more than one type of numbered
object can have its own numbering. I should also say that I am not an
expert on this.

Sadly, Wolfram has still, after many many years and requests, not
provided adequate documentation for StyleSheet's. Perhaps someone at
Wolfram who reads this could explain why.

Kevin

Cell[StyleData["NumberedEquation"],
CellMargins->{{60, 12}, {7, 7}},
ConversionRules->{"HTML" -> {{"", ""}, {"<table
class='NumberedEquation'><tr><td>", Automatic,
IncludeCount["</td><td
class='NumberedEquationLabel'>(`1`)</td></tr></table>",
"NumberedEquation"]}}},
TaggingRules->{"CounterSettings" -> {
"CounterFormat" -> {"NumberedEquation"}, "CounterTarget" -> "Cell",
"XRefPrefix" -> "Equation"}},
TextClipboardType->"InputText",
CellHorizontalScrolling->True,
CellFrameLabels->{{None,
Cell[
TextData[{"(",
CounterBox["NumberedEquation"], ")"}], "NumberedEquation"]},
{None, None}},
DefaultFormatType->TraditionalForm,
TextAlignment->Center,
CounterIncrements->"NumberedEquation",
MenuSortingValue->1400,
MenuCommandKey->"8",
SingleLetterItalics->False]

Raul Martinez

unread,
Feb 2, 2012, 5:06:32 AM2/2/12
to
Open a cell and select it, or select an existing cell. Then go to Cell >
Cell Tags > Add/Remove Cell Tags...

Enter your cell tag in the box that appears.

HTH,

Ra=FAl

Bob

unread,
Mar 2, 2012, 7:50:26 AM3/2/12
to
On Feb 2, 3:02 am, "Kevin J. McCann" <Kevin.McC...@umbc.edu> wrote:
> On 2/1/2012 3:55 AM, pabloaperezfernan...@gmail.com wrote:> If you have figured out how to do this, I would appreciate learning about it. I cannot figure out how to set custom equation numbers/labels.
>
> This is taken from my style sheet for a cell typeNumberedEquation. The
> key entries for numbering are the CellFrameLabels and CounterIncrements.
> The latter designates a counter name so more than one type of numbered
> object can have its own numbering. I should also say that I am not an
> expert on this.
>
> Sadly, Wolfram has still, after many many years and requests, not
> provided adequate documentation for StyleSheet's. Perhaps someone at
> Wolfram who reads this could explain why.
>
> Kevin
>

Kevin,

Thanks so much for this NumberedEquation style. I was trying to use
the EquationNumbered in Mathematica and it would break and do weird
things and I got tired of trying to figure out what the problem was.
Your's works fine. Thanks so much!!!

This way of doing equation numbering is easier than David Park's
Presentations package (just using styles instead of several other
Mathematica functions) but Park's way has advantages as it "remembers"
equations and associates them with names that can be invoked without
using tags. More work but more versatile.

-Bob

Murray Eisenberg

unread,
Mar 3, 2012, 6:56:23 AM3/3/12
to
Could someone re-post Kevin McCann's style sheet for a cell type
NumberedEquation. I missed the original message somehow and cannot
locate it in the MathGroup archive.
--
Murray Eisenberg mur...@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305

Bob Freeman

unread,
Mar 3, 2012, 6:59:27 AM3/3/12
to
Reply all
Reply to author
Forward
0 new messages