pwrap - wrapper for plain2

pwrap is a wrapper for plain2. It brings us external figure/table insertion, macro selection and other features.

In writting long document, we often tire input typesetting commands (TeX, HTML and others). Our attention are covered with these. Using plain2, we concentrate our attention on a document theme. It makes an easy writting environment to us. However, Since plain2 was designed to convert from single text document to single typesetting program source, plain2 does not support insertion of external figures. Then, more conveniently tools are required.

pwrap achieves this dream using perl script wrapper for plain2. pwrap call plain2 with specified macro files (which is called form file) as child process, and insert extenal files.

process flow of pwrap

Requirements

Source

How to Use

Lesson 1: basic

You can get TeX source easily.

% ./pwrap foo.txt > foo.tex % jlatex foo.tex % dvi2ps foo.dvi > foo.ps

In this situation, pwrap loads 'default.p2' as form file.

Lesson 2: two column

Using option '-2', you can get TeX source file with two column.

% ./pwrap -2 foo.txt > foo.tex

In this situation, pwrap load 'default-t.p2' as form file.

Lesson 3: figure insertion

Macro '#figure' specifys figure insertion.

Chocolate bar is a famous junk food in the world. #figure,bar,0.5,'chocolate bar'

If you write like above, pwrap searchs 'bar.eps' in directory './fig' and insert it with half size.

% ./pwrap foo.txt > foo.tex

Output will be following:

Chocolate bar is a famous junk food in the world. % Figure \begin{figure}[btp] \begin{center} \epsfile{file=fig/bar.eps,scale=0.5} \end{center} \caption{chocolate bar}\label{fig:bar} \end{figure}%

If it cannot be found file, pwrap outputs following (which will be typesetted as blank box):

Chocolate bar is a famous junk food in the world. % Figure \begin{figure}[btp] \typeout{PWRAP Warning: fig-'bar' was not found in dir-'fig'}% \begin{center} \thicklines% \fbox{% \vbox to 2cm{% \vfill% \hbox to 5cm {% \space\hfill\space{}bar\space{}0.5\hfill\space% }% \vfill% }% }% \end{center}% \caption{chocolate bar}\label{fig:bar} \end{figure}%

In addition, TeX ouputs missing message as following:

% jlatex foo.tex This is BigTeX, C Version 2.99 - j1.7 (no format preloaded) (foo.tex LaTeX Version 2.09 <24 May 1989> (/share/tex/inputs/jarticle.sty Document Style `jarticle' <18 Dec 88>. (/share/tex/inputs/jart10.sty)) (/share/tex/inputs/a4j.sty) (/home/is/k-chinen/style/fancyheadings.sty) (/share/tex/macros/epsf.sty EPSF macro package for LaTeX. version 1.3 - Released October 31, 1990 ) No file foo.aux. PWRAP Warning: fig-'bar' was not found in dir-'fig' LaTeX Warning: Reference `endofdoc' on page 1 undefined. [1] (foo.aux) LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. Output written on foo.dvi (1 page, 620 bytes). Transcript written on foo.log.

If you want to change figure directory, use option '-f'. In following example, pwrap search figures in directory 'image'.

% ./pwrap -f image foo.txt > foo.tex

Options

pwrap has following options:

syntaxdescription
-2 twocolumn
-F formset form (e.g., DPS)
-f dir figure directory
-t dir table directory
-i disable include
-b filebib file
-T text only (no figure)
-P page operation ignore (no page feed)
-a append \maketitle after abstract

Tips

Limitations

Typesetting program supporting is poor.
Currently, pwrap supports only ASCII Japanese TeX as typesetting program. It does not support other programs (roff family, pTeX and others.) However, you can support pTeX and LaTeX2e with little change of output customization in plain2.

k-chinen@is.aist-nara.ac.jp