diff options
author | Galin Simeonov <gts@volconst.com> | 2021-05-13 22:51:10 +0300 |
---|---|---|
committer | Galin Simeonov <gts@volconst.com> | 2021-05-13 22:51:10 +0300 |
commit | 958bd25bee9069eea3d6677a279319c4f997a45b (patch) | |
tree | 45551a93a0f5bbf3ff30305d2d17fae89b796113 | |
download | mg-958bd25bee9069eea3d6677a279319c4f997a45b.tar.gz |
init commit
-rw-r--r-- | g.tmac | 191 |
1 files changed, 191 insertions, 0 deletions
@@ -0,0 +1,191 @@ +.nr paragraph_indentation 2.3 +.nr heading_current_number 1 +.nr footnote_current_number 0 +.nr footnote_vertical_spacing 5 +\# font size +.nr footnote_point_size_reduction 3 +\# default heading style +.ds heading_style DIGIT + +.de place_footer_trap +.wh -3v paste_footer +.. +.de place_header_trap +.wh 0 paste_header +.. +.de place_ordinary_traps +.place_header_trap +.place_footer_trap +.. + +.ev footnote_environment +.vs \n[footnote_vertical_spacing] +.ev + +\# IMPORTANT! +.place_ordinary_traps + +.de remove_footer_trap +.wh -3v +.. + +.de remove_header_trap +.wh 0 +.. + +.nr header_text_from_top_spacing 1 +.nr header_line_from_text_spacing 0.3 +.nr header_real_text_from_line_spacing 2 +.nr header_horizontal_line 1 +.nr header_horizontal_line_thickness 0.5p + +.de paragraph +.ti \\n[paragraph_indentation] +.. + +.de list +.ie '\\$1'end' \{\ +.nr list_indentation 0 +\} +.el \{\ +.nr list_indentation 1 +\} +.. + +.de item +.br +\\n[list_indentation]) +.nr list_indentation +1 +.. + +.de mark_item +.if !'\\$1'' \{\ +.nr \\$1 \\n[list_indentation]-1 +\} +.. + +.de heading +.br +.ie '\\*[heading_style]'NONE' \{\ +\f[B] \\$1 \f[] +\} +.el +.if '\\*[heading_style]'DIGIT' \{\ +\f[B] \\n[heading_current_number]. +\\$1 \f[] +.nr heading_current_number +1 +\} +.br +.. + +.de mark_heading +.if !'\\$1'' \{\ +.if heading_current_number>0 \{\ +.nr \\$1 \\n[heading_current_number]-1 +\} +\} +.. + + +.de title +.ce 9999 +.ps +2 +.ps -2 +\f[B] \\$1 \f[] +.sp 1 +.ce 0 +. +.ds title_string \\$1 +.if !d header_right \{\ +.ds header_right \\*[title_string] +\} +. +.. +.de author +.ce 9999 +\\$1 +.if !'\\$2'' \{\ +.ps -1 +\\$2 +.ps +1 +\} +.sp 1 +.ce 0 +. +.ds author_string \\$1 +. +.if !d header_left \{\ +.ds header_left \\*[author_string] +\} +.. + +.de footnote +.ie '\\$1'end' \{\ +.ps +\\n[footnote_point_size_reduction] +.br +.boxa +.if !d there_is_a_footnote \{\ +.wh -1i paste_footnote +.ds there_is_a_footnote "yes" +\} +\} +.el \{\ +.nr footnote_current_number +1 +[\\n[footnote_current_number]] +.boxa footnote_text +.ps -\\n[footnote_point_size_reduction] + +[\\n[footnote_current_number]] +\} +.. + +.de paste_footnote +\#just in case we are in a diversion when this hits the trap +.box +\# separator +.ev footnote_environment +\l'1i' +.footnote_text +.rm footnote_text +.br +.ev +.bp +.. + +.de paste_footer +.ce 1 +- \\n[.pn] - +.ce 0 +.bp +.. + +.de header +.ds header_left \\$1 +.ds header_center \\$2 +.ds header_right \\$3 +.. + +.de draw_full_page_horisontal_line +\D't \\n[header_horizontal_line_thickness]' +\l'\\n[.ll]u' +.. +.de paste_header +.sp \\n[header_text_from_top_spacing] +.ad l +\\*[header_left] +.br +.sp -1 +.ad c +\\*[header_center] +.br +.sp -1 +.ad r +\\*[header_right] +.br +.sp -1 +.ad l +.sp \\n[header_line_from_text_spacing] +.draw_full_page_horisontal_line +.sp \\n[header_real_text_from_line_spacing] +.. + |