Group Abstract Group Abstract

Message Boards Message Boards

Equation numbering by chapters and sections

Posted 7 years ago

Hi, I would like to write a report which includes chapters, sections, and subsections. So, How do I number equations by chapter/section in Mathematica notebooks? For example, this equation is the 4th equation in chapter 2 section 1 : x+y=1 (2.1.4)

Kind regards, Omar

POSTED BY: Omar Alsuhaimi
6 Replies
Posted 7 years ago

Great. Thanks so much Larry.

Regards Omar

POSTED BY: Omar Alsuhaimi

Hi Omar, Assuming that you are using the aforementioned "Textbook" stylesheet, you made the modification outlined in my original comment, and the first cell in the Notebook is a "BookChapterNumber"-Cell, replace the first cell with following Cell expression:

Cell[TextData[
CounterBox["BookChapterNumber"]], "BookChapterNumber",
 CounterAssignments->{ParentList, {"BookChapterNumber", 1}}]

I assume that you used the Textbook styled-notebook template as the basis for your document layout. FYI, the template can be accessed from a palette that is summoned via the menu item, File > New > Styled Notebook.... (see attached screenshot of the palette) In the palette, look for the icon with the "Textbook" caption (i.e., middle row, left-most column) and click the upper half of the icon. Note, when you hover over the top-half of the icon, the word "New" will appear. Click the icon to open a new template.

The addition of the option, CounterAssignments->{ParentList, {"BookChapterNumber", 1}}, should be the only difference between the original templated "BookChapterNumber"-Cell and the one above. (Important: The option's rhs value contains the sublist {"BookChapterNumber", 1}. That designation assigns the value 1 to the "BookChapterNumber" counter. However, the value is immediately incremented by 1 because the appearance of the "BookChapterNumber"-Cell in the Notebook causes the counter to increment. CounterBox["BookChapterNumber"] will display 2. Generally, the value assigned to "BookChapterNumber" must equal the desired value - 1.

If each chapter is in it's own separate Notebook, replace the "BookChapterNumber"-Cell with the one above, but be sure to replace the value 1 with a value == desired value - 1. For example, for chapter 3 replace the 1 with 2,..., for chapter 10 replace the 1 with 9. Also, remember to add the StyleData["EquationNumbered"]-Cell, as described in my original comment, to each notebook to correct the equation numbers.

Attachment

Attachments:
POSTED BY: Larry Adelston
Posted 7 years ago

Hi Larry, Please, I would like to make the number of the equation (eg. (2,4,7)) as the following : 2 represents the chapter number. 4 represents the section number. 7 represents the number of the equation in the chapter not in the whole document. I mean when I start a new chapter, say section 5 , chapter 2, the sixth equation in this chapter should take this number (2,5,6).

Regards Omar

POSTED BY: Omar Alsuhaimi
Posted 7 years ago

Thanks so much Larry.

Kind Regards Omar

POSTED BY: Omar Alsuhaimi
POSTED BY: Larry Adelston
Posted 2 years ago

Larry, Maybe you can help me with this: https://community.wolfram.com/groups/-/m/t/2694818?p_p_auth=7m5gRF9W Best regards, Irek

POSTED BY: irek7
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard