F diff --git a/g.tmac b/g.tmac new file mode 100644 --- /dev/null +++ b/g.tmac+ .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]+ ..+