Shield

Document Generation Hints and Tips

Caspar Fall, Ben Hourahine
September 2001
Shield

-----

Warning: This information is provided primarily for users at the University of Exeter!

Conversion between formats:

To convert between the various formats follow these guidelines:

1a LaTeX->HTML Consider using latex2html or TtH. The latter can format equations without creating pictures.
1b LaTeX->PDF Use pdflatex file.tex. Be aware that to include graphics, you need to include in the LaTeX source:
\usepackage[pdftex]{graphicx}
\includegraphics[width=3cm]{figure.pdf}
The PDF figure is obtained from an EPS figure using ~fall/bin/epstopdf.
1c LaTeX->PS latex file.tex and then dvips file.dvi will make a postscript file. To include figures in EPS format, you can include in your LaTeX file the following commands:
\usepackage{graphicx}
\includegraphics[width=3cm]{figure.eps}
1d LaTeX->Word Remove the LaTeX formating using detex file.tex and load the resulting plain text into Word/StarOffice. :-(
2a HTML->PDF Use htmldoc, which is intalled properly on deimos. A nice feature of this is that it creates links in the PDF file. It also allows you to create PDF files that cannot be printed, but only viewed on screen.
2b HTML->PS In netscape, use File/Save As/Postscript or use htmldoc, which is intalled properly on deimos.
2c HTML->Word Word can load HTML files.
2d HTML->LaTeX Try using ~fall/bin/html2latex/html2latex. It's a perl script that can handle figures too.
3a PDF->PS Within acroread, use File/Print/Print To File
3b PDF->Word Untested.
3c PDF->LaTeX See 3d.
3d PDF->HTML Hard. You can extract the raw text from PDF using pdftotext -raw file.pdf, but you would then have to reformat the result.
4a PS->Word Difficult, but try ps2ascii file.ps to get raw text output.
4b PS->LaTeX Difficult, but try ps2ascii file.ps to get raw text output.
4c PS->HTML Near impossible, to my knowledge.
4d PS->PDF Use an online distiller such as ps2pdf.org (which may have trouble with large documents containing figures), use ps2pdf (which currently tends to create nasty big files), or use the 5th floor distiller (which won't work if Bob's machine has crashed. Copy files to ~jones/PDF/in, the result appears in ~jones/PDF/out/).
5a Word->LaTeX A neat perl script can convert Word docs into TeX, but cannot cope with figures: ~goss/bin/w2t.
5b Word->HTML Word can save HTML files.
5c Word->PDF On the PC with the distiller, you can generate the PDF directly using File/Distill DPF.... Within StarOffice, go via 5d and 4d.
5d Word->PS Print to file from inside Word/StarOffice.

Acquiring figures from postscript and PDF:

Ghostscript provides a neat way of getting figures from postscript documents into a format that can be put into other documents. The idea is to use gs with a device driver other than the default X11 one so that it writes out the current page to file in another form.

The general syntax to grab a whole page is something like:
gs -rRES -sDEVICE=dev -sOutputFile=out.dev file.ps
with dev being the device of choice for output (try gs -h to get a list) and RES the resolution (try about 300).

Alternatively, you can display the postscript/PDF figure on screen with gv or acroread, zoom in on on the figure of interest, lauch xv in the background and click the Grab button in xv to acquire a bitmap image of the figure. Save the figure from within xv in the format of your choice.

Navigation bar in PDF:

When generating PDF foils using LaTeX, you might like to try to use the hyperref package to create a navigation bar inside the PDF file. This provides convenient navigation when giving a presentation. Here is an example LaTeX file which you should compile with pdflatex:

\documentclass[30pt,landscape]{foils}
\usepackage[pdftex]{geometry}
\geometry{headsep=3ex,hscale=0.9}
\usepackage[pdftex]{color} % for the colored block
\usepackage[            % for hyper links in dvi ending in postscript and PDF
pdftex,                 % pdf output
a4paper,                % a4 paper
colorlinks=true,        % links are colored
citecolor=green,        % color of cite links
pagecolor=blue,         % color of page links
linkcolor=cyan,         % color of hyperref links
menucolor=blue,         % color of Acrobat Reader menu buttons
urlcolor=magenta,       % color of page of \url{...}
]{hyperref}%
\RequirePackage{amssymb}% for navigation bar


\MyLogo{\href{mailto:c.j.fall@exeter.ac.uk}{c.j.fall@exeter.ac.uk}}
\rightfooter{   %navigation bar bottom right
\normalsize
\Acrobatmenu{FirstPage}{$\blacktriangleleft\!\blacktriangleleft$}
\Acrobatmenu{PrevPage}{$\blacktriangleleft$}
\Acrobatmenu{FullScreen}{$\diamond$}
\Acrobatmenu{NextPage}{$\blacktriangleright$}
\Acrobatmenu{LastPage}{$\blacktriangleright\!\blacktriangleright$}
\hspace{2mm}
\Acrobatmenu{Close}{$\times$} }
\leftheader{University of Exeter}

\begin{document}
\foilhead{A PDF file with a navigation bar}
\begin{itemize}
\item Click the blue triangles to move around.
\item See \href{http://newton.ex.ac.uk/people/fall/}{Caspar's homepage}
for more information.
\end{itemize}
\foilhead{A PDF file with a navigation bar (2)}
Click the diamond for full screen display.
\foilhead{A PDF file with a navigation bar (3)}
Click the blue cross to close the file.
\end{document}
You can download the example source, and view the PDF result too.

Powerpoint effects in PDF:

You can create a variety of PowerPoint-like effects in a PDF file generated from a LaTeX source using PPower4.

Here is an example that features an incrementally-built page:

\documentclass[20pt,landscape]{foils}
\usepackage{amssymb}
\usepackage[pdftex,colorlinks=true]{hyperref}
\usepackage[pdftex]{color}
\usepackage{pause}

%% Inserting this pauselevel into the footer we will have the footer appear
%% immediately. But we still need a \pause at the end of the page,
%% otherwise the last page material will also come out first.
\MyLogo{\pause\href{mailto:c.j.fall@exeter.ac.uk}{c.j.fall@exeter.ac.uk}}
\rightfooter{\pauselevel{=1}
\normalsize
\Acrobatmenu{FirstPage}{$\blacktriangleleft\!\blacktriangleleft$}
\Acrobatmenu{PrevPage}{$\blacktriangleleft$}
\Acrobatmenu{FullScreen}{$\diamond$}
\Acrobatmenu{NextPage}{$\blacktriangleright$}
\Acrobatmenu{LastPage}{$\blacktriangleright\!\blacktriangleright$}
\hspace{2mm}
\Acrobatmenu{Close}{$\times$}}

\begin{document}
\foilhead{An incrementally-built page with PPower4}
\begin{itemize}
\item This is a paused page \pause
\item The manual for \href{http://www-sp.iti.informatik.tu-darmstadt.de/software/ppower4/beta/}{PPower4} is online \pause
 \begin{itemize}
  \item We use version beta5 to allow the footer to be displayed immediately
  \item In this case, an extra $\backslash$pause at the end of the page is required\pause
  \item The trick is to put this extra command at the {\it beginning}
        of the footer. Here, this means putting it in the logo command.
 \end{itemize}
\end{itemize}
\end{document}
You can download the example source, and view the PDF result too. To compile it, you will need to use the style files found in ~fall/tex/ppower4/. To create the final result, you should: Alternatively, you can copy a neat script from ~fall/tex/ppower4/GNUmakefile into your current directory and type make all. This should process all the tex files in the directory and make screen and print PDF versions of them all. It should also process the figures for you.

Another example file featuring multicoloured backgrounds is available (source, PDF). When viewing this PDF file, type Ctrl-L to switch from full-screen to window mode...

-----
Caspar Fall              email: C.J.Fall@exeter.ac.uk
University of Exeter     phone: +44 (1392) 264198
Exeter EX4 4QL, UK       fax  : +44 (1392) 264111
28th September 2001