question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Change numbering styles in different parts

See original GitHub issue

Describe the problem/need and solution

Sphinx allows you to add numbers to chapters via the :numbered: flag in a TOCtree. In addition, sphinx-multitoc-numbering allows you to continue numbering across parts.

However, many books have an appendix that should both restart numbering and use a different numbering style. A common example of this is:

Introduction

1. First chapter
2. Second chapter
3. Third chapter

A. Appendix 1
B. Appendix 2

It would be useful if people could do two things:

  1. Re-start numbering for some parts of their book
  2. Choose a different numbering style

Guide for implementation

There’s a Sphinx issue that already exists about this: https://github.com/sphinx-doc/sphinx/issues/6614

But perhaps we could implement something via sphinx-multitoc-numbering, for example supporting some extra toctree metadata like:

```{toctree}
:numbered:
:numbered_group:
```

Along with a config like numbered_group_styles = {"group1": "123", "group2": "ABC"}.

I wonder if @mmcky has thought about that possibility?

Tasks and updates

No response

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
tavincommented, Feb 23, 2022

Thanks to https://github.com/executablebooks/MyST-Parser/issues/188 I found a workaround that allows me to build a latex/pdf article with appendix numbered A:

```{role} raw-latex(raw)
:format: latex
```

{raw-latex}`\renewcommand{\thesection}{A}`

I’d like to do this with a raw directive and skip the role definition, but for some reason that doesn’t work.

0reactions
michaelosthegecommented, Apr 1, 2022

This week I managed to render a pandoc-Markdown into DOCX and PDF that look really good. For the PDF I even got partially numbered headings working: https://boisgera.github.io/pandoc/markdown/#heading-identifiers

Maybe one can adopt their approach?


Are there examples (tests?) where _toc.yml is bypassed? I looked into the code and it seems to be mostly a big codebase parsing the YAML and making a dict of objects from it. I’d much rather create those TocTree objects myself, interacting with their API directly and having access to attributes that are not supported in the _toc.yml “schema”. (Such as the numbered/unnumbered thing.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Define new bullets, numbers, and multilevel lists
To change the style, click the down arrow next to Number style and choose numbers, letters, or another chronological format. Specify a level...
Read more >
Q. How do I number pages differently in the various sections of ...
Open the "Format Page Numbers" window by going to the Header & Footer Tools – Design tab on the menu, and in the...
Read more >
How do you change bullet/numbered list format of only certain ...
You apply the numbering by applying the styles, not by using the numbering controls in the ribbon. Note that this dialog shows numbering...
Read more >
How to create numbered headings or outline numbering in ...
Right-click the thumbnail for the Headings list style and choose Modify. Format > Numbering (Figure 8). You can how change any or all...
Read more >
Customizing numbered lists - Microsoft Word 2016
Word displays the number formatting you've chosen in the Enter Formatting For Number text box. Type any changes for the text of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found