Section number calculation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Section number calculation

ggenier
Hello,

I search for a very long time a solution to my problem.

I have several adoc file with a title. When I include my files in main file, numerotation is not calculate for my subfile.

I need to write title in main document and include my file :

Works :

== Sub section title
--
include::./subsection.adoc[]
--
<<<

Example of subsection.adoc file :
Test subsection

Do not work :
--
include::./subsection.adoc[]
--
<<<

Example of subsection.adoc file :
== Sub section title
Test subsection

Is is possible to take into account section in sub file or all title need to be in main adoc file ?

For my example it's easy to do we first solution but if my sub adoc file has sub section it's more complicated.

Thanks into advance.
Reply | Threaded
Open this post in threaded view
|

Re: Section number calculation

habamax
Not sure I understand correctly what is the problem...

So, to recap:

1. You have main doc file and several included docs
2. You want sections of included docs to be properly numbered when :sectnums: option is set

Is this correct?

By default include directive includes files as is, meaning that if you have
titles in included docs they will be titles in result doc which is usually not what you want.

If you read manual regarding include https://asciidoctor.org/docs/user-manual/#include-directive
you will find that it has options. The one we are interested in is
leveloffset. It makes all headings including title to be offset by the level
you set:

include::my_file_with_title.adoc[leveloffset=+1]

will include my_file_with_title.adoc and make all headings offset by 1 level.


Hope it will help, cheers!