OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to apply hierarchical numbering to indented titles?

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

Guest
I have a table of content in the form of indention to track the hierarchy like:

Code:
- title1
-- title1-1
-- title1-2
--- title1-2-1
--- title1-2-2
- title2
-- title2-1
-- title2-2
- title3
- title4

I want to translate them with a numbering format like:

Code:
1 title1
1.1 title1-1
1.2 title1-2
1.2.1 title1-2-1
1.2.2 title1-2-2
2 title2
2.1 title2-1
2.2 title2-2
3 title3
4 title4

This is just an example where the string "title-*" could be any heading text. Also the size of an indent could get greater than in this example.

This comes from my real work, where I collect headings, or manually hand-written headings, in a Word document and reformat these possible headings from beginning to end aiming to correct any wrong order and indention.

I have tried this myself, and while mostly these headings were transformed into the desired format, for some it did not work out. How should this be done?
<p>I have a table of content in the form of indention to track the hierarchy like:</p>
<pre><code>- title1
-- title1-1
-- title1-2
--- title1-2-1
--- title1-2-2
- title2
-- title2-1
-- title2-2
- title3
- title4
</code></pre>
<p>I want to translate them with a numbering format like:</p>
<pre><code>1 title1
1.1 title1-1
1.2 title1-2
1.2.1 title1-2-1
1.2.2 title1-2-2
2 title2
2.1 title2-1
2.2 title2-2
3 title3
4 title4
</code></pre>
<p>This is just an example where the string "title-*" could be any heading text. Also the size of an indent could get greater than in this example.</p>
<p>This comes from my real work, where I collect headings, or manually hand-written headings, in a Word document and reformat these possible headings from beginning to end aiming to correct any wrong order and indention.</p>
<p>I have tried this myself, and while mostly these headings were transformed into the desired format, for some it did not work out. How should this be done?</p>
 

Latest posts

A
Replies
0
Views
1
Alvah_Franey
A
H
Replies
0
Views
1
habrewning
H
Top