[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] moving TOC to start
From: |
Heinz-Jürgen Oertel |
Subject: |
Re: [Groff] moving TOC to start |
Date: |
Tue, 27 Sep 2005 21:56:58 +0200 |
User-agent: |
KMail/1.8 |
Am Dienstag, 27. September 2005 15:06 schrieb Tadziu Hoffmann:
> > does anyone have any simple methods for placing the table of contents
> > at the start of the output file ?
> >
> > I have done it manually with Postscript output and should be able to
> > script that, but if anyone has other suggestions I would appreciate
> > hearing from them.
>
> I think manipulating the intermediate output given to the device
> postprocessor is easier than manipulating the final device code
> (ps, in your case). Something like this:
>
> groff -ww -b -Tps -Z [other options] [*roff-file] |
> sed -f shuffle.sed | grops >[ps-file]
> rm troff.sort
>
> with shuffle.sed being:
>
> #!/bin/sed -f
>
> /^p1$/s/p1/# -- cut here --/
> /^# -- cut here --$/,/^# -- cut here --$/w troff.sort
> /^# -- cut here --$/,/^# -- cut here --$/c\
> p1
> /^x trailer$/d
> /^x stop$/{
> s/.*/p1/
> r troff.sort
> a\
> x trailer\
> x stop
> }
>
> Note that this particular program works only if page number 1
> appears twice in the document. Everything from the second
> page 1 to the end of the file is moved to the beginning.
> I usually set the page number back to 1 on the title page
> and set the number format to roman (so that the title page
> is page i), and format the table of contents at the very end,
> like this:
>
> [page 1] [page 2] ... [last page] [page i] [page ii] ... [contents]
>
> which gets shuffled to
>
> [page i] [page ii] ... [contents] [page 1] [page 2] ... [last page]
>
> Thus all the front matter has roman page numbers and the "real"
> content has arabic page numbers.
>
>
What we are doing?
We use ms macros
Collecting TOC entries with a combination of Standard headline macros and
.XS/.XE like:
.NH
Multi-Line Version
.XS
\*(SN Multi-Line Version
.XE
Producing the TOC at the end of all files (or end of file)
.TC
Feeding the resulting PS file through psselect
# psselect adressiert von vorn 1,2,....
# oder von hinten _1 ist die letzte, _2 die vorletzte ... Seite
## -----------------------------------------------------------------
sort: FORCE
psselect -p1-4,_4-_1,5-_5 $(TMP_PS) $(PS_FILE)
--
with best regards / mit freundlichen Grüßen
Heinz-Jürgen Oertel
+===================================================================
| port GmbH phone +49 345 77755-0
| Regensburger Str.7b fax +49 345 77755-20
| D-06132 Halle/Saale mailto:address@hidden
| Germany http://www.port.de
| CAN Wiki http://www.CAN-Wiki.info/
| ETHERNET Powerlink http://www.epl-tools.com
| Newsletter: http://www.port.de/register.html
+===================================================================
Merokok dapat menyebabkan kanker, serangan jantung,
impotensi dan gangguan kehamilan dan janin.
Re: [Groff] moving TOC to start, Keith MARSHALL, 2005/09/29
Re: [Groff] moving TOC to start, Keith MARSHALL, 2005/09/29