# HG changeset patch # User markus schnalke # Date 1338972974 -7200 # Node ID f3c95ee96cc48c6d8bac40f46147186c9275f129 # Parent 64f177ca2af14b34a4f81398f8dbf19732c55f09 Moved TOC from end to beginning; extended makefile. The TOC generation concept and idea was inspired by the book ``UNIX Text Processing''. diff -r 64f177ca2af1 -r f3c95ee96cc4 .hgignore --- a/.hgignore Tue Jun 05 22:24:10 2012 +0200 +++ b/.hgignore Wed Jun 06 10:56:14 2012 +0200 @@ -8,4 +8,4 @@ thesis-book.ps thesis.pdf -bib.ig +*.ig diff -r 64f177ca2af1 -r f3c95ee96cc4 makefile --- a/makefile Tue Jun 05 22:24:10 2012 +0200 +++ b/makefile Wed Jun 06 10:56:14 2012 +0200 @@ -1,13 +1,23 @@ NAME = thesis -CHAPS = style front.roff dedication.roff abstract.roff preface.roff \ - ch*.roff refs.roff toc.roff +CHAPS = style front.roff dedication.roff abstract.roff toc.roff \ + preface.roff ch*.roff refs.roff PDFFLAGS = -sPAPERSIZE=a4 -dPDFSETTINGS=/prepress all: $(NAME).ps $(NAME).ps: $(CHAPS) makefile bib export TROFFONTS=fonts REFER=bib;\ - cat $(CHAPS) | refer -e -P -sLAD -l,2 -k | troff -Tps -ms | dpost >$@ + cat $(CHAPS) | refer -e -P -sLAD -l,2 -k | \ + troff -Tps -ms 2>err.ig | dpost >$@ + +err.ig: $(CHAPS) + export TROFFONTS=fonts REFER=bib;\ + cat $(CHAPS) | refer -e -P -sLAD -l,2 -k | \ + troff -Tps -ms -rZ1 -z 2>$@ + +toc.roff: toc.ig +toc.ig: err.ig + sed -n '/^TOC____/s///p' $< >$@ pdf: $(NAME).pdf $(NAME).pdf: $(NAME).ps @@ -21,4 +31,4 @@ clean: rm -f $(NAME).ps $(NAME).pdf book.ps book.pdf - rm -f bib.ig + rm -f *.ig diff -r 64f177ca2af1 -r f3c95ee96cc4 style --- a/style Tue Jun 05 22:24:10 2012 +0200 +++ b/style Wed Jun 06 10:56:14 2012 +0200 @@ -88,6 +88,11 @@ . rs .. +.de T_ \" add entry to TOC: .T_ pre-space indent-level text +.tm TOC____.sp \\$1 +.tm TOC____\&\\h'\\$2u*2u*\\n(PIu'\\$3\0\0\a\t\\n(PN\fR +.. + .rm NH .de NH .SH @@ -157,14 +162,9 @@ . lg .ds _C "\\$1 . RT -. XS -. sp .5v -. B -.ie \\n(.$=1 \{\ -\\*(SN \\$1 -.\} -.el .if ,\\$2,no, \&\\$1 -. XE +.rm t_ +.if !,\\$2,no, .ds t_ \\*(SN\0\0 +.T_ .5v 0 "\fB\\*(t_\\$1 .EH "\\\\*(_E .ie \\n(H1 .OH "\\\\*(_O .el .OH "\\\\*(_o @@ -205,11 +205,8 @@ . lg . RT .if !'\\$2'no' \{\ -.ds _S "\\$1 -. XS -. sp .3v - \\*(SN \\$1 -. XE +. ds _S "\\$1 +. T_ .3v 1 "\\*(SN\0\0\\$1 .\} .nr PP 0 .. @@ -222,9 +219,7 @@ \\$1 .RT .ds _S "\\$1 -.XS - \\*(SN \\$1 -.XE +.T_ 0 2 "\\*(SN\0\0\\$1 .nr PP 0 .. diff -r 64f177ca2af1 -r f3c95ee96cc4 toc.roff --- a/toc.roff Tue Jun 05 22:24:10 2012 +0200 +++ b/toc.roff Wed Jun 06 10:56:14 2012 +0200 @@ -1,3 +1,5 @@ .H- Contents -.PX no +.ta \n(LLu-5n \n(LLuR +.nf +.if !\nZ=1 .so toc.ig