Here's the din-5008-dimensions.roff I forgot to attach in my previous mail.
Best Alexis
\# Use the following command to typeset this document: \# groff -Tpdf -p -dpaper=a4 -P-pa4 din-5008-dimensions.roff > din-5008-dimensions.pdf .nop \X'ps: exec 2 setlinecap' .nop \X'ps: exec 0 setlinejoin' .ft C .po 1.75c .sp |\n(.ou .vs 0 .PS # Defaults lineheight = 4.23 # default line height (12pt) in mm ### # User configurable variables start here define form { "A" } # Choose A or B infoblock_width = 75 # Set custom width for information block; must be <= 75 infoblock_height = 40 # Set custom height for information block; must be >= 40 footer_height = 2*lineheight # Set custom height of footer show_dimensions = 1 # 1: Print measurements; 0: Hide measurements zoom = 100 # in- or decrease size of picture # NOTA BENE: Only a zoom of 100 will be displayed accurately, # i.e. other zoom levels may introduce false gaps or overlaps # User configurable variables end here ### if form!="A"&&form!="B" then { command ".tm Unknown form" } # map user variables to internal variables lh=lineheight ibw=infoblock_width ibh=infoblock_height fth=footer_height lbls=show_dimensions ibwd=75 # max width of information block ibhd=40 # min height of information block if ibw>ibwd then { command sprintf(".tm Using maximum width of %g for information block instead of requested %g", ibwd, ibw) ibw=ibwd } if ibh<ibhd then { command sprintf(".tm Using minimum height of %g for information block instead of requested %g", ibhd, ibh) ibh=ibhd } scale=25.4 # Change scale to millimeters scale=scale*(1+(1-(zoom/100))) # Apply zoom if (scale == 25.4) then { command ".po 0c"; command ".sp |0c" } # TODO: else compute po and sp! # The DIN 5008 requires A4 paper maxpswid=210;maxpsht=297 linethick=1 if (form=="A") then { hl=27 } else { hl=45 } # Change height of header according to letter form # define paper { # Draw paper outline Paper: box wid maxpswid ht maxpsht thickness 0 } define hdr { # Fill header Header: box wid maxpswid-(linethick/2) ht hl shaded "azure2" outline "azure4" \ with .nw at Paper .nw + (linethick/4, -linethick/4) if (lbls==1) then { { # Draw width measurement line <-> left maxpswid outline "orange" \ with .c at Header .b + (0, 5) sprintf("\h'-12'\v'-6p'%g", maxpswid) } { # Draw height measurement line <-> up hl outline "orange" \ at Header .sw + (30, 0) aligned sprintf("\v'-6p'%g", hl) } { # Draw top offset measure for information block line <-> up hl+5 \ at last box .ne - (10+ibw, hl+5) aligned sprintf("\v'-6p'%g", hl+5) } } } define punchmark { { move to Header .nw down maxpsht/2 right 10 { line left 10 outline "pink2" } if (lbls==1) then { line <-> up 148.5 outline "pink2" \ aligned sprintf("\v'-6p'%g", maxpsht/2) } } } define foldmarks { hdo=60 fmd=105 fmw=5 { if ($1=="top" || $1=="both") then { move to Header .nw down hdo+hl right fmw { line left fmw outline "red" } if (lbls==1) then {line <-> up hdo+hl outline "red" aligned sprintf("\v'-6p'%g", hdo+hl)} } if ($1=="bottom" || $1=="both") then { move to Header .nw down fmd+hdo+hl right fmw { line left fmw outline "red" } if (lbls==1) then { move down maxpsht-fmd-(hdo+hl); line <-> up maxpsht-fmd-(hdo+hl) outline "red" \ aligned sprintf("\v'-6p'%g", maxpsht-fmd-(hdo+hl)) } } if ($1=="both" && lbls==1) then { line <-> up fmd outline "red" aligned sprintf("\v'-6p'%g", fmd) } } } paper hdr punchmark foldmarks("both") #PF Flyback to position where .PS started .PF .vs .PS define headerlabel { H: box invis wid 210 ht hl "\fRHeader\fP" "\f(TIDIN 5008\fP" "" "" if form=="A" then { box invis at H.c - (0, .5*lh) "\fIForm A\fP" } else { box invis at H.c - (0, .5*lh) "\fIForm B\fP" } } define addressfield { afh=45 afw=80 aoo=5 aow=afw+aoo lhadjust=linethick/4 # Fill {box wid afw ht afh color "grey90" with .nw at H .sw + (po, lh-lhadjust);} A: box wid aow ht afh with .nw at H .sw + (po-aoo, lh-lhadjust) "\fRAddressfield\fP"; if (lbls==1) then { { line <-> left aow with .c at A .s + (0, 10) outline "grey70" sprintf("%g", aow) ""; line <-> up afh with .sw at A .sw + (10, 0) aligned sprintf("%g", afh) "" } { line <-> left afw with .c at A .s + (2.5, 7.5) "" sprintf("%g", afw) } { line <-> left po-aoo sprintf("%g", po-aoo) "" at A .l # distance to left page edge line <-> right aoo sprintf("%g", aoo) "" at A .l # inner addressfield padding } } } define infoblock { ibwm=75 ibhm=40 I: box dashed wid ibw ht ibh shaded "grey90" with .ne at H .se + (-10 , lh-5) \ "\fRInformationblock\fP" sprintf("%g\(mu%g", ibw, ibh) "" if (lbls==1) then { { line -> dashed left ibw with .c at I .s + (0, 0) sprintf("\fRvariable <=\fP %g", ibwm) "" line <- dashed up ibh with .sw at I .sw + (0, 0) aligned "" sprintf("\fRvariable >=\fP %g", ibhm) } { line <-> right 10 "10" "" at I .r} # distance to right page edge } } define textblock { ibho=0 if ibh>40 then { ibho=ibh-40 } tbw=maxpswid-po-po+5 blanks=4*lh # (2 blank lines between addressfield/information block, 1 blank to page, 1 blank to footer) tbh=maxpsht-hl-afh-blanks-fth-lh-10 # 10 = bottom page margin if ibh>afh then { tbh=tbh-ibho } T: box wid tbw ht tbh dashed shaded "grey90" \ with .nw at A .sw + (5, -(lh*2+ibho)) "\fRContent\fP" if (lbls==1) then { { line <-> right tbw sprintf("%g", tbw) "" at T .nw + (0, -10) line <-> dashed up tbh \ at T .sw + (0, 0) \ aligned "" "" sprintf("\fRvariable \(ti%.2g lines (%gmm), depending on height of optional Footer\fP", tbh/lineheight, tbh) } { line <-> left po sprintf("%g", po) "" at T .l} # distance to left page edge { line <-> right po-5 sprintf("%g", po-5) "" at T .r} # distance to right page edge if ibh<=40 then { { line <-> dashed up lh*2 aligned sprintf("\s'-2'%g\s0", lh*2) "" at T .nw + (5, 0)} } if ibh>=40 then { { line <-> dashed up lh*2 aligned sprintf("\s'-2'%g\s0", lh*2) "" at I .b + (0, -lh*2)} } } } define page { P: box wid 50 ht lh dotted shaded "grey90" "\fRPage n of m\fP" with .se at T .se - (0, lh*2) if (lbls==1) then {{ line <-> dotted up lh sprintf("\h'3'%g", lh) at P .ne - (5, 0)}} } define footer { F: box wid tbw ht fth dotted shaded "grey90" "\fRFooter\fP \fI(optional)\fP" with .ne at P .se + (0, -lh) } po=25 headerlabel addressfield infoblock textblock page footer .PF .po .ex .sp |10c \s'24'Foo Ba baz\s0 .ex \# vim: set filetype=pic: