Recently new features have been added to the gropdf device to allow 
presentation pdfs to be produced from roff files. Peter Schaffter has been 
incorporating the new features into mom, but I wondered how difficult it would 
be to incorporate it into other macro packages.

It turns out to be quite easy. I used the ms macros to create the attached 
pdf. It is the first time I have used the ms macros so apologies if I have 
made any newbie blunders. The command to generate the presentation is:-

groff -T pdf -ms ms-slides.rof > ms-slides.pdf

To generate a non-presentation version (which is easier to print), do:-

GROPDF_NOSLIDE=1 groff -T pdf -ms ms-slides.rof > ms-noslides.pdf

The changes in gropdf are in the current git version, so if you want to test 
the new features you will have to install the current git version. I would 
welcome further testing to make sure I've ironed out all the wrinkles.

Cheers 

Deri
.pl 9c
.nr PO 1c
.nr LL 14c
.nr LT 14c
.nr HM 1c
.nr FM .5c
.RP no
.P1
.nr bm 0 1
.nop \!x X papersize=16c,9c
.ds PDFHREF.COLOUR 0.0 0.3 0.9
.defcolor pdf:href.colour rgb \\*[PDFHREF.COLOUR]
.ds PDFHREF.TEXT.COLOUR pdf:href.colour
.OH "'\m[grey]Slides Demo''Deri James\m[]'"
.EH "'\m[grey]Slides Demo''Deri James\m[]'"
.pdftransition PAGE Box .5 . O
.pdftransition BLOCK Wipe 1
.de HD
.sp |\\n[HM]u-6p
\Z!\D't 1p'!\D'l \\n[LL]u 0p'
.fl
..
.de HEAD
.  NH \\$1
.  shift
\\m[pdf:href.colour]\\$*\\m[]
.  fl
.  pdfbookmark -T bm\\n+[bm] \\n[nh*hl] \\*[SN-STYLE] \\$*
.  XS \\n[%]
.  pdfhref L -D bm\\n[bm] -- \\*[SN-STYLE] \\$*
.  XE
.  pdfpause
..
.pdfpagename TITLE
.TL
\m[pdf:href.colour]Demonstrating using
.br
ms macros
.br
for a slideshow\m[]
.AU
Deri James
.LP
.sp -2.4v
.HEAD 1 The Basics
.LP
Using
.I ms
to write a presentation slideshow is easy.
.LP
.pdfpause
.HEAD 2 Configure the "paper" size
.RS
.LD
.ft CR
\&.pl 9c
\&.nr PO 1c
\&.nr LL 14c
\&.nr LT 14c
\&.nr HM 1c
\&.nr FM .5c
\&.RP no
\&.P1
\&.nop \\!x X papersize=16c,9c
.ft
.DE
.RE
The final command sets the pdf page size, suitable for a 16:9 ratio screen.
.HEAD 2 Specify the presentation transitions
.RS
.LD
.ft CR
\&.pdftransition PAGE Box .5 . O
\&.pdftransition BLOCK Wipe 1
.ft
.DE
.RE
A description of the allowed parameters is in the
.pdfhref W -D http://chuzzlewit.co.uk:8080/cgi-bin/WebManPDF.pl/man:/1/gropdf 
-- gropdf(1)
man page.
The parameters applied to
.B PAGE
are used when the transition is to a new slide, and
.B BLOCK
sets the transition for any separate blocks in the slide.
.LP
.B Note:
Not all possible transitions are supported by every PDF reader.
.pdfpause
.HEAD 2 Use Blocks
.LP
A Block is a portion of the slide which you want to appear separately on the 
screen
when you click the mouse or press the space bar. After the text which you want 
to
appear simply insert a pause:-
.RS
.LD
.ft CR
\&.pdfpause
.ft
.DE
.RE
.HEAD 2 Printing the slides
.LP
If the presentation contains blocks it may be difficult to print the slides in 
a format
so they may be given as a handout. The solution is to define GROPDF_NOSLIDE as 
true before
invoking groff:-
.RS
.LD
.ft CR
GROPDF_NOSLIDE=1 groff -Tpdf -ms filename.ms > filename.pdf
.ft
.DE
.RE
The pdf file produced will not be in presentation mode so can be printed 
normally but
you may need to select \[oq]scale to fit\[cq] and \[oq]landscape\[cq] to fit 
the actual
paper size.
.HEAD 1 Other PDF considerations
.LP
This demo has other features which take advantage of calls to the gropdf device 
which
may be useful.
.bp
.HEAD 2 PDF overview and clickable TOC
.LP
I included a custom .HEAD macro which creates a heading, adds it to the 
overview panel
in the pdf reader, adds a clickable link in the TOC and pauses:-
.RS
.LD
.ft CR
.ec Z
Z&.de HEAD
Z&.  NH \\$1
Z&.  shift
\\m[pdf:hrefZ&.colour]\\$*\\m[]
Z&.  fl
Z&.  pdfbookmark -T bm\\n+[bm] \\n[nh*hl] \\*[SN-STYLE] \\$*
Z&.  XS \\n[%]
Z&.  pdfhref L -D bm\\n[bm] -- \\*[SN-STYLE] \\$*
Z&.  XE
Z&.  pdfpause
Z&..
.ec
.ft
.DE
.RE
.bp
It should be called as:
.RS
.LD
.ft CR
\&.HEAD 2 PDF overview and clickable TOC
.ft
.DE
.RE
.HEAD 2 Move TOC to page after TITLE
.LP
First insert the following just before the
.CW .TL
section at the top of the file.
.RS
.LD
.ft CR
\&.pdfpagename TITLE
.ft
.DE
.RE
Then insert these lines at the end of your ms file:-
.RS
.LD
.ft CR
\&.pdfswitchtopage after TITLE
\&.TC
.ft
.DE
.RE
.pdfswitchtopage after TITLE
.TC

Attachment: ms-slides.pdf
Description: Adobe PDF document

Reply via email to