From 312eb6e589c67f954ba676fb7a04ab8d06827033 Mon Sep 17 00:00:00 2001 From: Galin Simeonov Date: Fri, 28 May 2021 23:20:22 +0300 Subject: added multi level headings --- g.tmac | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/g.tmac b/g.tmac index 98693c5..fa5b6f5 100644 --- a/g.tmac +++ b/g.tmac @@ -5,7 +5,10 @@ \######################################################################### .nr paragraph_indentation 2.3 \######################################################################### -.nr heading_current_number 1 +.nr heading_current_number_1 0 +.nr heading_current_number_2 0 +.nr heading_current_number_3 0 +.nr heading_current_number_4 0 .ds heading_style DIGIT \######################################################################### .nr footnote_current_number 0 @@ -97,6 +100,7 @@ .. \######################################################################### .de finish +.main_diversion .references \#.plainpage end .. @@ -135,9 +139,36 @@ \} .el .if '\\*[heading_style]'DIGIT' \{\ -\f[B] \\n[heading_current_number]. +\f[B] +.if \\$2<=1 \{\ +.nr heading_current_number_1 +1 +.nr heading_current_number_2 0 +.nr heading_current_number_3 0 +.nr heading_current_number_4 0 +\\n[heading_current_number_1]. +\} +.if '\\$2'2' \{\ +.nr heading_current_number_2 +1 +.nr heading_current_number_3 0 +.nr heading_current_number_4 0 +\\n[heading_current_number_1]. +\\n[heading_current_number_2]. +\} +.if '\\$2'3' \{\ +.nr heading_current_number_3 +1 +.nr heading_current_number_4 0 +\\n[heading_current_number_1]. +\\n[heading_current_number_2]. +\\n[heading_current_number_3]. +\} +.if '\\$2'4' \{\ +.nr heading_current_number_4 +1 +\\n[heading_current_number_1]. +\\n[heading_current_number_2]. +\\n[heading_current_number_3]. +\\n[heading_current_number_4]. +\} \\$1 \f[] -.nr heading_current_number +1 \} .br .. -- cgit v1.2.3