1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907
|
<!-- -*-jfw-sgml-*- -->
<!doctype document public "-//JFW//DTD Document//EN" [
<!ENTITY % remark "ignore" >
<!ENTITY % remote "IGNORE" >
<![ %remote [<!ENTITY % local "ignore" > ]]>
<!ENTITY % local "INCLUDE" >
<!ENTITY % epsfig "IGNORE" >
<![ %epsfig [<!ENTITY % grphcs "IGNORE" >]]>
<!ENTITY % grphcs "IGNORE" >
<![ %grphcs [<!ENTITY % epsfig "IGNORE" >]]>
<!-- Files and the source of the hard wired path -->
<!ENTITY % f.text system "common.ent" > %f.text;
<!ENTITY instdir system "instdir" >
<!ENTITY notaent "notation.ent" >
<!ENTITY Makefile "X2YMakefile" >
<!ENTITY MkfPath "&instdir;/bin/&Makefile;" >
<!--
We need %Literat in the prologe this is strange but thus we needto do
everything by ourself. Lets put together something to have also a
readable output.
-->
<!ENTITY % Literat "IGNORE">
<![ %Literat [
<!ENTITY epstogif system "epstogif">
]]>
<!ENTITY epstogif
"# Here is the code from 'epstogif.sgml' (inlined version) omitted.
# Please refer to the documentation of 'epstogif' for details." >
]>
<document face="1C 2S"
author="J&oe;rg Wittenberger"
inst="TU Dresden"
>Notation handling programs
This defines a bunch of scripts which are to handle the conversion of
files using some of the &sdc; supported notations into forms
suitable for the target formats.
The names of all the final conversion files follow the scheme:
<quote><var>notation<code>2<var>format</quote>
This document is organized in order of the target format.
Here is the file <code/notation.ent/ composed as well. The conversion
scripts are called from this file. It goes into the <code/dtd/
directory.
First we declare the <code/ignore/ notation, which just prints a
message about being used.
<literate file="¬aent;"<verb>
<!NOTATION ignore SYSTEM "echo Ignore Notation used for %s.">
</verb</>
<!-- no central Makefile!!
We need a variable dependency rule in the Makefile:
<literate file="&Makefile;"<verb>
$(TARGET): $(SRC)
</verb</>
This makes the file to be created depending on the source (using the
full path).
Furthermore we need a magic target <code/.SUFFIXES/ extending the
built in one with the unusual suffixes:
<literate<verb>
.SUFFIXES: .eps .gif .obj
</verb</>
-->
<sect id="ASCII converters">ASCII
There are only a few notations representable in ASCII:
<literate file="¬aent;"<rverb>
<![ %ASCII [
<!NOTATION fig SYSTEM "echo Figure %s not representable." >
<!NOTATION eps SYSTEM "echo Figure %s not representable." >
<!NOTATION latex SYSTEM "&instdir;/bin/latex2lout %f %S" >
<!NOTATION lout SYSTEM "cat %f" >
<!NOTATION lfig SYSTEM "cat %f" >
<!NOTATION roff SYSTEM "&instdir;/bin/roff2lout %f %S" >
<!NOTATION tgif SYSTEM "echo Figure %s not representable." >
<!NOTATION gif SYSTEM "echo Figure %s not representable." >
]]>
</rverb</>
<sect id="HTML converters">HTML
At the moment the <code/GIF/ format is the most important except for
things which can be converted in HTML. It's to expect soon, that
<code/GIF/ will be abandoned because of legal reasons. Up to now no
successor is selected. So here comes the gif support. The successor is
to be added later.
<sect1 id="HTML notations">Notations
<literate file="¬aent;"<rverb>
<![ %HTML [
<!NOTATION fig SYSTEM "&instdir;/bin/fig2html %f %S" >
<!NOTATION eps SYSTEM "&instdir;/bin/eps2html %f %S" >
<!NOTATION latex SYSTEM "&instdir;/bin/latex2html %f %S" >
<!NOTATION lout SYSTEM "&instdir;/bin/lout2html %f %S" >
<!NOTATION lfig SYSTEM "&instdir;/bin/lout2html %f %S" >
<!NOTATION roff SYSTEM "&instdir;/bin/roff2html %f %S" >
<!NOTATION tgif SYSTEM "&instdir;/bin/tgif2html %f %S" >
<!NOTATION gif SYSTEM "&instdir;/bin/gif2html %f %S" >
]]>
</rverb</>
<sect1 id="eps2html">eps2html
<literate file="eps2html">
<rverb>
#!/bin/sh
# handle eps file for html, expects args %f %S
set -e # die on any error
BASE=`basename $2 .eps`
IN=$2 # input file
OUT=$BASE.gif # output file
[ -f "$IN" ] || exit 1 # ensure our file exists
&instdir;/bin/pstogif "$IN" "$BASE.gif" 1>&2
# making transparent gifs is nice but not required
( giftrans -t "#ffffff" -o "$OUT.1" "$OUT" && \
mv -f "$OUT.1" "$OUT" || \
true
rm -f "$OUT.1"
)
</rverb>
</literate>
See documentation of <code/epstogif/ for files and behavior of the
rest of the code. This is the <![ %remote [remote]]><![ %local
[local]]> version.
Now echo the inclusion command to stdout:
<literate<rverb>
echo "<IMG SRC="\"$OUT\"">"
</rverb</literate>
Well, this uses a command pstogif. This has been copied from the
LaTeX2HTML.
<sect1 id="fig2html">fig2html
<literate file="fig2html">
<verb>
#!/bin/sh
# handle fig file for html, expect args %f %S
set -e # die on any error
BASE=`basename $2 .fig`
IN=$2 # input file
OUT=$BASE.gif # output file
[ -f "$IN" ] || exit 1 # ensure our file exists
</verb</literate>
The remote version once again uses <code/epstogif/.
<![ %remote [ <literate<rverb>
# aph: this is untested, and crazy
rcp $IN $REMOTENAME@$REMOTEHOST:remote/$IN
rsh $REMOTEHOST -l $REMOTENAME \
fig2dev -L ps remote/$IN > $OUT
&epstogif;
rsh $REMOTEHOST -l $REMOTENAME rm -f remote/$IN
</rverb></literate> ]]>
<![ %local [
The local version needs some more things locally
<literate<rverb>
# make sure our temp file does not already exist
if [ -f "$BASE.ps" ]; then
echo "$0: $BASE.ps is in the way" 1>&2
exit 1
fi
fig2dev -L ps "$BASE.ps" "$IN" 1>&2
&instdir;/bin/pstogif "$BASE.ps" "$OUT" 1>&2
# making transparent gifs is nice but not required
( giftrans -t "#ffffff" -o "$OUT.1" "$OUT" && \
mv -f "$OUT.1" "$OUT" || \
true
rm -f "$OUT.1"
)
</rverb</> ]]>
<literate<rverb>
echo "<IMG SRC=\"$OUT\">"
</rverb</>
<sect1 id="latex2html">latex2html
This goes through two stages. First convert into eps, then call
eps2html from the same package.
<literate file="latex2html"<rverb>
#!/bin/sh
# handle latex file for html, expects args %f %S
set -e # die on any error
BASE=`basename $2 .tex`
IN=$2 # input file
OUT=$BASE.gif # output file
TMP=$BASE.eps # temporary file
[ -f "$IN" ] || exit 1 # ensure our file exists
# make sure our temp file does not already exist
if [ -f "$TMP" ]; then
echo "$0: $TMP is in the way" 1>&2
exit 1
fi
&instdir;/bin/latex2eps- "$IN" "$TMP" 1>&2
&instdir;/bin/eps2html "$TMP" "$TMP" 1>&2
rm -f "$TMP"
</rverb>
</literate>
<sect1 id="lout2html">lout2html
This composes a simple lout file, defines a Galley without any size
constraints and has the text find it's way there.
<literate file="lout2html"<rverb>
#!/bin/sh
# handle lout file for html, expects args %f %S
set -e # die on any error
BASE=`basename $2 .lout`
IN=$2 # input file
OUT=$BASE.gif # output file
TMP1=$BASE.tmplout
TMP2=$BASE.eps
[ -f "$IN" ] || exit 1 # ensure our file exists
# make sure our temp files do not already exist
if [ -f "$TMP1" ]; then
echo "$0: $TMP1 is in the way" 1>&2
exit 1
fi
if [ -f "$TMP2" ]; then
echo "$0: $TMP2 is in the way" 1>&2
exit 1
fi
cat >"$TMP1" <<EOF
@SysInclude{fig}
@SysInclude{eq}
@SysInclude{graph}
@SysInclude{doc}
@Doc //
@Text @Begin
EOF
cat "$IN" >>"$TMP1"
cat >>"$TMP1" <<EOF
@End @Text
EOF
lout -EPS "$TMP1" -o "$TMP2"
&instdir;/bin/pstogif "$TMP2" "$OUT" 1>&2
# making transparent gifs is nice but not required
( giftrans -t "#ffffff" -o "$OUT.1" "$OUT" && \
mv -f "$OUT.1" "$OUT" || \
true
rm -f "$OUT.1"
)
rm -f $TMP1.* $TMP1 $TMP2 lout.li
echo "<IMG SRC=\"$OUT\">"
</rverb>
</literate>
<sect1 id="roff2html">roff2html
Roff2html goes through 2 steps. First convert to encapsulated
PostScript. This could eventually happen on a remote host, then
transferred to <code/eps2html/ from the &sdc; package.
First we need to put some blank lines before the real
document. Ghostscript will otherwise crop the first lines on some
systems.
<literate file="roff2html"<verb>
#!/bin/sh
# handle roff file for html, expects args %f %S
set -e # die on any error
BASE=`basename $2 .roff`
IN=$2 # input file
OUT=$BASE.eps # output file, in this case, also temporary
TMP=T$BASE.roff # temporary file
[ -f "$IN" ] || exit 1 # ensure our file exists
# make sure our temp file does not already exist
if [ -f "$TMP" ]; then
echo "$0: $TMP is in the way" 1>&2
exit 1
fi
cat - "$IN" > "$TMP" <<EOF
EOF
</verb>
<![ %remote [ <verb>
rcp "$TMP" $REMOTENAME@$REMOTEHOST:remote/"$TMP"
rsh $REMOTEHOST -l $REMOTENAME "cd remote;\
gtbl $TMP | groff -Tps " >$OUT
</verb> ]]>
<![ %local [ <verb>
gtbl "$TMP" | groff -Tps >"$OUT"
</verb> ]]>
<rverb>
&instdir;/bin/eps2html "$OUT" "$OUT"
rm -f "$TMP" "$OUT"
</rverb>
</literate>
<sect1 id="tgif2html">tgif2html
<literate file="tgif2html"<rverb>
#!/bin/sh
# handle tgif file for html, expects args %f %S
set -e # die on any error
BASE=`basename $2 .obj`
IN=$2 # input file
OUT=$BASE.gif # output file, in this case, also temporary
TMP=$BASE.tmp # temporary file
[ -f "$IN" ] || exit 1 # ensure our file exists
# make sure our temp file does not already exist
if [ -f "$TMP" ]; then
echo "$0: $TMP is in the way" 1>&2
exit 1
fi
tgif -print -eps -stdout "$IN" > "$TMP"
&instdir/bin/pstogif "$TMP" "$OUT" 1>&2
# making transparent gifs is nice but not required
( giftrans -t "#ffffff" -o "$OUT.1" "$OUT" && \
mv -f "$OUT.1" "$OUT" || \
true
rm -f "$OUT.1"
)
rm -f "$TMP"
echo "<IMG SRC=\"$OUT\">"
</rverb>
</literate>
<sect1 id="gif2html">gif2html
This converter is basically trivial, it just emits the right HTML tag.
<literate file="gif2html"<rverb>
#!/bin/sh
# handle tgif file for html, expects args %f %S
set -e # die on any error
IN=$2 # input file
[ -f "$IN" ] || exit 1 # ensure our file exists
echo "<IMG SRC=\"$IN\">"
</rverb>
</literate>
<sect id="Info converters">Info
Info understands almost nothing. Here the excerpt from the ¬aent;
file.
<literate file="¬aent;"<verb>
<![ %Info [
<!NOTATION fig SYSTEM "echo Figure %s not representable." >
<!NOTATION eps SYSTEM "echo Figure %s not representable." >
<!NOTATION latex SYSTEM "cat %f" >
<!NOTATION lout SYSTEM "cat %f" >
<!NOTATION lfig SYSTEM "cat %f" >
<!NOTATION roff SYSTEM
"gtbl %f | groff -Tascii | col -b -f | sed -e '/^$/d'" >
<!NOTATION tgif SYSTEM "echo Figure %s not representable." >
<!NOTATION gif SYSTEM "echo Figure %s not representable." >
]]>
</verb</>
<sect id="LaTeX converters">LaTeX
I don't know about all notations which can be included into LaTeX DVI
files and the DVI driver they work with.
<sect1 id="LaTeX notations">Notations
<literate file="¬aent;"<rverb>
<![ %LaTeX [
<!NOTATION fig SYSTEM "&instdir;/bin/fig2latex %f %S">
<!NOTATION eps SYSTEM "&instdir;/bin/eps2latex %f %s">
<!NOTATION latex SYSTEM "cat %f" >
<!NOTATION lout SYSTEM "&instdir;/bin/lout2latex %f %S" >
<!NOTATION lfig SYSTEM "&instdir;/bin/lout2latex %f %S" >
<!NOTATION roff SYSTEM "&instdir;/bin/roff2latex %f %S" >
<!NOTATION tgif SYSTEM "&instdir;/bin/tgif2latex %f %S" >
<!NOTATION gif SYSTEM "&instdir;/bin/gif2latex %f %S" >
]]>
</rverb</>
<sect1 id="eps2latex">eps2latex
<![ %epsfig [
Using the <code/epsfig/ package. We only need to copy the eps file
into the current directory and tell the command to LaTeX.
<literate file="eps2latex"<verb>
#!/bin/sh
# handle eps file for latex, epsfig version, expects args %f %S
set -e # die on any error
IN=$2 # input file, and also the output file
[ -f "$IN" ] || exit 1 # ensure our file exists
echo \\epsfig{ file=$IN }
</verb</>
]]>
<![ %grphcs [
With the <code/graphics/ package we only need to copy the eps file
into the current directory and the the command to LaTeX.
<literate file="eps2latex"<verb>
#!/bin/sh
# handle eps file for latex, graphics version, expects args %f %S
set -e # die on any error
IN=$2 # input file, and also the output file
[ -f "$IN" ] || exit 1 # ensure our file exists
echo \\includegraphics{$IN}
</verb</>
]]>
<sect1 id="fig2latex">fig2latex
The <code/fig2dev/ supports LaTeX output. The <code/fig2latex/ script
will make use of it. Drawback: you can't have some types of objects
(e.g., splines) in the picture. For those pictures better convert them
into eps and tell <code/&sdc;/
to use notation eps.
<literate file="fig2latex"<verb>
#!/bin/sh
# handle fig file for latex, emits to STDOUT, expects args %f %S
set -e # die on any error
IN=$2 # input file
[ -f "$IN" ] || exit 1 # ensure our file exists
</verb>
<![ %remote [<verb>
rcp $IN $REMOTENAME@$REMOTEHOST:remote/$IN
rsh $REMOTEHOST -l $REMOTENAME fig2dev -L latex remote/$IN
rsh $REMOTEHOST -l $REMOTENAME rm -f remote/$IN
</verb> ]]>
<![ %local [ <verb>
fig2dev -L latex $IN
</verb> ]]>
</literate>
<sect1 id="lout2latex">lout2latex
From lout to LaTeX we need to have a special Layout with a Galley with
unspecified dimensions. This way the produced eps file will be of the
necessary size.
<literate file="lout2latex"<verb>
#!/bin/sh
# handle fig file for latex, expects args %f %S
set -e # die on any error
BASE=`basename $2 .lout`
IN=$2 # input file
TMP=$BASE.tmp # temporary file
OUT=$BASE.eps # output file
[ -f "$IN" ] || exit 1 # ensure our file exists
# make sure our temp file does not already exist
if [ -f "$TMP" ]; then
echo "$0: $TMP is in the way" 1>&2
exit 1
fi
cat >"$TMP" <<EOF
@SysInclude{fontdefs}
@SysInclude{langdefs}
@SysInclude{fig}
@SysInclude{eq}
@SysInclude{graph}
@SysInclude{dl}
extend @DocumentLayout
export @TextPlace @Text
def @PlainLayout
@Begin
def @TextPlace { @Galley }
def @Text into { @TextPlace&&preceding } right x
{
@InitialFont @Font @InitialBreak @Break @InitialColour @Colour
@InitialLanguage @Language x
}
@End @PlainLayout
@Use{ @DocumentLayout }
@Use{ @PlainLayout }
@TextPlace
//
@Text @Begin
EOF
cat "$IN" >>"$TMP"
cat >>$TMP <<EOF
@End @Text
EOF
</verb>
<rverb>
lout -EPS "$TMP" -o "$OUT"
rm -f "$TMP" "$SRC.ld" lout.li
</rverb>
<![ %epsfig [<verb>
echo \\epsfig{file=$OUT}
</verb> ]]>
<![ %grphcs [<verb>
echo \\includegraphics{$OUT}
</verb>]]>
</literate>
<sect1 id="roff2latex">roff2latex
The converter from roff to LaTeX goes through encapsulated PostScript.
Therefore you need a roff command which can produce PostScript. Here
<code/groff/ is used.
Unfortunately groff can't write encapsulated PostScript. You need to
have <code/bbset/ installed. (It comes with &sdc;.) See
documentation for bbset for details.
<literate file="roff2latex"<verb>
#!/bin/sh
# handle roff file for latex, expects args %f %S
set -e # die on any error
BASE=`basename $2 .roff`
IN=$2 # input file
TMP=$BASE.tmp # temporary file
OUT=$BASE.eps # output file, in this case, also temporary
[ -f "$IN" ] || exit 1 # ensure our file exists
# make sure our temp file does not already exist
if [ -f "$TMP" ]; then
echo "$0: $TMP is in the way" 1>&2
exit 1
fi
</verb>
<![ %local [ <rverb>
gtbl "$IN" | groff -Tps > $TMP
ps2epsi "$TMP" "$OUT" 1>&2
rm -f "$TMP"
</rverb> ]]>
<![ %remote [ <verb>
rcp $IN $REMOTENAME@$REMOTEHOST:remote/$IN
rsh $REMOTEHOST -l $REMOTENAME "set -e ; cd remote;\
gtbl $IN | groff -Tps > $TMP ;
ps2epsi \"$TMP\" \"$OUT\" 1>&2 ; cat \"$OUT\"" >$OUT
rsh $REMOTEHOST -l $REMOTENAME rm -f remote/$TMP remote/$OUT
</verb>]]>
<![ %epsfig [
<verb>
echo \\epsfig{ file=$OUT }
</verb>]]>
<![ %grphcs [
<verb>
echo \\includegraphics{$OUT}
</verb>]]>
</literate>
<sect1 id="tgif2latex">tgif2latex
<literate file="tgif2latex"<rverb>
#!/bin/sh
# handle tgif file for latex, expects args %f %S
set -e # die on any error
BASE=`basename $1 .obj`
IN=$2 # input file
OUT=$BASE.eps # output file
[ -f "$IN" ] || exit 1 # ensure our file exists
tgif -print -eps -stdout "$IN" > "$OUT"
</rverb>
<![ %epsfig [ <verb>
echo \\epsfig{ file=$TARGET }
</verb>]]>
<![ %grphcs [ <verb>
echo \\includegraphics{$TARGET}
</verb>]]>
</literate>
<sect1 id="gif2latex">gif2latex
<literate file="gif2latex"<rverb>
#!/bin/sh
# handle gif file for latex, expects args %f %S
set -e # die on any error
BASE=`basename $1 .gif`
IN=$2 # input file
OUT=$BASE.eps # output file
TMP=$BASE.ps # temporary file
[ -f "$IN" ] || exit 1 # ensure our file exists
# make sure our temp file does not already exist
if [ -f "$TMP" ]; then
echo "$0: $TMP is in the way" 1>&2
exit 1
fi
giftopnm "$IN" | pnmtops -noturn > "$TMP"
ps2epsi "$TMP" "$OUT" 1>&2
rm -r "$TMP"
echo "\\includegraphics{$OUT}"
</rverb>
</literate>
<sect id="Lout converters">Lout
Lout understands only two notations: native lout code and encapsulated
PostScript.
<sect1 id="Lout notations">Notations
<literate file="¬aent;"<rverb>
<![ %Lout [
<!NOTATION eps SYSTEM "&instdir;/bin/eps2lout %f %S">
<!NOTATION fig SYSTEM "&instdir;/bin/fig2lout %f %S">
<!NOTATION latex SYSTEM "&instdir;/bin/latex2lout %f %S" >
<!NOTATION lout SYSTEM "cat %f" >
<!NOTATION lfig SYSTEM "cat %f" >
<!NOTATION roff SYSTEM "&instdir;/bin/roff2lout %f %S" >
<!NOTATION tgif SYSTEM "&instdir;/bin/tgif2lout %f %S">
<!NOTATION gif SYSTEM "echo Figure %s not implemented." >
]]>
</rverb</>
<sect1 id="eps2lout">eps2lout
Including eps into Lout documents is pretty simple:
protect the file name and echo the lout code.
<literate file="eps2lout"<verb>
#!/bin/sh
# handle gif file for latex, expects args %f %S
set -e # die on any error
IN=$2 # input file
[ -f "$IN" ] || exit 1 # ensure our file exists
echo @VContract{// @IncludeGraphic{ \"$2\" }// }
</verb</>
<sect1 id="fig2lout">fig2lout
<literate file="fig2lout"<verb>
#!/bin/sh
# handle fig file for lout, expects args %f %S
set -e # die on any error
BASE=`basename $2 .fig`
IN=$2 # input file
OUT=$BASE.eps # output file
[ -f "$IN" ] || exit 1 # ensure our file exists
</verb>
<![ %remote [<verb>
rcp $IN $REMOTENAME@$REMOTEHOST:remote/$IN
rsh $REMOTEHOST -l $REMOTENAME fig2dev -L ps remote/$IN > $OUT
rsh $REMOTEHOST -l $REMOTENAME rm -f remote/$IN
</verb> ]]>
<![ %local [ <rverb>
fig2dev -L ps $IN $OUT
</rverb> ]]> <verb>
#echo @IncludeGraphic{ \"$TARGET\" }
echo @VContract{// @IncludeGraphic{ \"$TARGET\" }// }
</verb</>
<sect1 id="latex2lout">latex2lout
<literate file="latex2lout"<rverb>
#!/bin/sh
# handle latex file for lout, expects args %f %S
set -e # die on any error
BASE=`basename $2 .tex`
IN=$2 # input file
OUT=$BASE.eps # output file
[ -f "$IN" ] || exit 1 # ensure our file exists
&instdir;/bin/latex2eps- $IN $OUT
echo @IncludeGraphic{ \"$OUT\" }
</rverb</>
<sect1 id="roff2lout">roff2lout
<literate file="roff2lout"<verb>
#!/bin/sh
# handle roff file for lout, expects args %f %S
set -e # die on any error
BASE=`basename $2 .roff`
IN=$2 # input file
OUT=$BASE.eps # output file
TMP=$BASE.tmp # temporary file
[ -f "$IN" ] || exit 1 # ensure our file exists
# make sure our temp file does not already exist
if [ -f "$TMP" ]; then
echo "$0: $TMP is in the way" 1>&2
exit 1
fi
</verb>
<![ %local [
<rverb>
gtbl "$IN" | groff -Tps - > "$TMP"
ps2epsi "$TMP" "$OUT" 1>&2
</rverb>
]]>
<![ %remote [ <verb>
rcp $IN $REMOTENAME@$REMOTEHOST:remote/$IN
rsh $REMOTEHOST -l $REMOTENAME "cd remote;\
gtbl $IN | groff -Tps - > $TMP;\
ps2epsi $TMP $OUT;\
cat $OUT" >$OUT
rsh $REMOTEHOST -l $REMOTENAME rm remote/$IN remote/$OUT remote/$TMP
</verb>]]>
<verb>
echo @IncludeGraphic{ \"$OUT\" }
</verb>
</literate>
<sect1 id="tgif2lout">tgif2lout
<literate file="tgif2lout"<verb>
#!/bin/sh
# handle tgif file for lout, expects args %f %S
set -e # die on any error
BASE=`basename $2 .obj`
IN=$2 # input file
OUT=$BASE.eps # output file
[ -f "$IN" ] || exit 1 # ensure our file exists
</verb>
<![ %remote [<rverb>
SRC=`basename $1`
rcp $IN $REMOTENAME@$REMOTEHOST:remote/$IN
rsh $REMOTEHOST -l $REMOTENAME &null
"cd remote; tgif -print -eps $IN; cat $OUT" > $OUT 2> /dev/null
rsh $REMOTEHOST -l $REMOTENAME rm -f remote/$IN remote/$OUT
</rverb> ]]>
<![ %local [ <rverb>
tgif -print -eps -stdout "$IN" > "$OUT"
</rverb> ]]> <verb>
echo @IncludeGraphic{ \"$OUT\" }
</verb</>
<sect id="Man converters">Man
Man also know about almost nothing. We don't need any script, just
some command lines:
<literate file="¬aent;"<verb>
<![ %Man [
<!NOTATION fig SYSTEM "echo Figure %s not representable." >
<!NOTATION eps SYSTEM "echo Figure %s not representable." >
<!NOTATION latex SYSTEM "cat %f" >
<!NOTATION lout SYSTEM "cat %f" >
<!NOTATION lfig SYSTEM "cat %f" >
<!NOTATION roff SYSTEM "tbl %f | eqn | pic " >
<!NOTATION tgif SYSTEM "echo Figure %s not representable." >
<!NOTATION gif SYSTEM "echo Figure %s not representable." >
]]>
</verb</>
<sect id="latex2eps-">latex2eps-
<note>
Naming convention: the trailing - means this is not a complete handler
for a notation, instead it produces a second format.
</note>
Converts $1 from latex into $2 eps.
Please note, that you don't need a <code/\documenttype{..}/,
<code/\begin{document}/ and <code/\end{document}/. Moreover you are
supposed not to have any.
<literate file="latex2eps-"<verb>
#!/bin/sh
FILE=`basename $1 .tex`
TMPTEX=tmp$$
cat > $TMPTEX.tex << EOF
\documentstyle{article}
\pagestyle{empty}
\begin{document}
EOF
cat $1 >> $TMPTEX.tex
echo ' \end{document}' >> $TMPTEX.tex
</verb>
<![ %remote [ <verb>
rcp $TMPTEX.tex $REMOTENAME@$REMOTEHOST:remote/$TMPTEX.tex
rsh $REMOTEHOST -l $REMOTENAME "cd remote;latex $TMPTEX.tex >/dev/null"
rsh $REMOTEHOST -l $REMOTENAME "cd remote; \
dvips -q -E $TMPTEX; cat $TMPTEX.ps" >$FILE.eps
rsh $REMOTEHOST -l $REMOTENAME "rm -f remote/$TMPTEX.*"
</verb> ]]>
<![ %local [ <rverb>
latex $TMPTEX.tex >/dev/null
dvips -q -E -o $FILE.eps $TMPTEX >/dev/null 2>/dev/null
#dvips -q -E $TMPTEX
#cat $TMPTEX.ps >$FILE.eps
</rverb> ]]>
<verb>
rm -f $TMPTEX.*
</verb>
</literate>
|