diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/rtflatex |
Initial commit
Diffstat (limited to 'support/rtflatex')
119 files changed, 14556 insertions, 0 deletions
diff --git a/support/rtflatex/README b/support/rtflatex/README new file mode 100644 index 0000000000..7d019d0d24 --- /dev/null +++ b/support/rtflatex/README @@ -0,0 +1,26 @@ +Subject: RTFLATEX -- July 25th, 1995 +New release of RTF-to-LaTeX converter (RTFLaTeX), +version 2.14, by Daniel TAUPIN, +Laboratoire de Physique des Solides, 91405 ORSAY, France. + +New features: + -- C source (from p2c) corrected to avoid data overrunning due to a p2c + "feature" ignoring string truncation at assignments, but overwriting + nearby and unpredictable data, + -- font handling conform either to LaTeX2e or to LaTeX209 (option) + -- tables (approximately) converted +Does not convert: + -- pictures + -- equation editor output (this is... unpredictably coded) + -- other features whose semantic is not clear in Microsoft's specifications + +Available at anonymous ftp: rsovax.lps.u-psud.fr + Directory [anonymous.rtf2tex] + + ftp: hprib.lps.u-psud.fr + Directory pub/rtflatex + +Provided as zipped (executable for MS-DOS, Turbopascal source, standard +C and data files) + + diff --git a/support/rtflatex/mf/cmobx10.mf b/support/rtflatex/mf/cmobx10.mf new file mode 100644 index 0000000000..bb74a9a8b2 --- /dev/null +++ b/support/rtflatex/mf/cmobx10.mf @@ -0,0 +1,82 @@ +% This is CMOBX10.MF in text format, as of Aug 19, 1993. +% Computer Modern Bold Extended Roman 10 point +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +outlining:=true; + +font_identifier:="CMOBX"; font_size 10pt#; +u#:=23/36pt#; % unit width +width_adj#:=11/36pt#; % width adjustment for certain characters +serif_fit#:=0pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=7/36pt#; % extra sidebar near uppercase serifs +letter_fit#:=0pt#; % extra space added to all sidebars + +body_height#:=270/36pt#; % height of tallest characters +asc_height#:=250/36pt#; % height of lowercase ascenders +cap_height#:=247/36pt#; % height of caps +fig_height#:=232/36pt#; % height of numerals +x_height#:=160/36pt#; % height of lowercase without ascenders +math_axis#:=90/36pt#; % axis of symmetry for math symbols +bar_height#:=85/36pt#; % height of crossbar in lowercase e +comma_depth#:=70/36pt#; % depth of comma below baseline +desc_depth#:=70/36pt#; % depth of lowercase descenders + +crisp#:=0pt#; % diameter of serif corners +tiny#:=13/36pt#; % diameter of rounded corners +fine#:=10/36pt#; % diameter of sharply rounded corners +thin_join#:=10/36pt#; % width of extrafine details +hair#:=17/36pt#; % lowercase hairline breadth +stem#:=41/36pt#; % lowercase stem breadth +curve#:=46/36pt#; % lowercase curve breadth +ess#:=38/36pt#; % breadth in middle of lowercase s +flare#:=45/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=56/36pt#; % diameter of dots +cap_hair#:=19/36pt#; % uppercase hairline breadth +cap_stem#:=51/36pt#; % uppercase stem breadth +cap_curve#:=55/36pt#; % uppercase curve breadth +cap_ess#:=53/36pt#; % breadth in middle of uppercase s +% rule_thickness#:=.6pt#; % thickness of lines in math symbols +rule_thickness#:=.8pt#; % thickness of lines in math symbols + +dish#:=1/36pt#; % amount erased at top or bottom of serifs +bracket#:=10/36pt#; % vertical distance from serif base to tangent +jut#:=25/36pt#; % protrusion of lowercase serifs +cap_jut#:=39/36pt#; % protrusion of uppercase serifs +beak_jut#:=11/36pt#; % horizontal protrusion of beak serifs +beak#:=70/36pt#; % vertical protrusion of beak serifs +vair#:=13/36pt#; % vertical diameter of hairlines +% notch_cut#:=10pt#; % maximum breadth above or below notches +notch_cut#:=15pt#; % maximum breadth above or below notches +bar#:=17/36pt#; % lowercase bar thickness +slab#:=17/36pt#; % serif and arm thickness +cap_bar#:=17/36pt#; % uppercase bar thickness +cap_band#:=17/36pt#; % uppercase thickness above/below lobes +% cap_notch_cut#:=10pt#; % max breadth above/below uppercase notches +cap_notch_cut#:=15pt#; % max breadth above/below uppercase notches +serif_drop#:=3/36pt#; % vertical drop of sloped serifs +stem_corr#:=2/36pt#; % for small refinements of stem breadth +vair_corr#:=1.5/36pt#; % for small refinements of hairline height +apex_corr#:=0pt#; % extra width at diagonal junctions + +o#:=4/36pt#; % amount of overshoot for curves +apex_o#:=3/36pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=1; % factor applied to weights of heavy characters +math_spread:=.5; % extra openness of math symbols +superness:=8/11; % parameter for superellipses +superpull:=1/8; % extra openness inside bowls +beak_darkness:=.4; % fraction of triangle inside beak serifs +ligs:=2; % level of ligatures to be included + +square_dots:=false; % should dots be square? +hefty:=false; % should we try hard not to be overweight? +serifs:=true; % should serifs and bulbs be attached? +monospace:=false; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=false; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file + diff --git a/support/rtflatex/mf/cmobx12.mf b/support/rtflatex/mf/cmobx12.mf new file mode 100644 index 0000000000..b0b23aa007 --- /dev/null +++ b/support/rtflatex/mf/cmobx12.mf @@ -0,0 +1,83 @@ +% This is OCMBX12.MF in text format, as of Mar 31, 1986. +% Computer Modern Bold Extended Roman 12 point +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +outlining:=true; + +font_identifier:="CMOBX"; font_size 12pt#; + +u#:=27/36pt#; % unit width +width_adj#:=13/36pt#; % width adjustment for certain characters +serif_fit#:=0pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=8/36pt#; % extra sidebar near uppercase serifs +letter_fit#:=0pt#; % extra space added to all sidebars + +body_height#:=324/36pt#; % height of tallest characters +asc_height#:=300/36pt#; % height of lowercase ascenders +cap_height#:=296.4/36pt#; % height of caps +fig_height#:=278.4/36pt#; % height of numerals +x_height#:=192/36pt#; % height of lowercase without ascenders +math_axis#:=108/36pt#; % axis of symmetry for math symbols +bar_height#:=102/36pt#; % height of crossbar in lowercase e +comma_depth#:=84/36pt#; % depth of comma below baseline +desc_depth#:=84/36pt#; % depth of lowercase descenders + +crisp#:=0pt#; % diameter of serif corners +tiny#:=13/36pt#; % diameter of rounded corners +fine#:=10/36pt#; % diameter of sharply rounded corners +thin_join#:=10.5/36pt#; % width of extrafine details +hair#:=18.3/36pt#; % lowercase hairline breadth +stem#:=47/36pt#; % lowercase stem breadth +curve#:=52/36pt#; % lowercase curve breadth +ess#:=44/36pt#; % breadth in middle of lowercase s +flare#:=51/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=62/36pt#; % diameter of dots +cap_hair#:=20/36pt#; % uppercase hairline breadth +cap_stem#:=57/36pt#; % uppercase stem breadth +cap_curve#:=61/36pt#; % uppercase curve breadth +cap_ess#:=59/36pt#; % breadth in middle of uppercase s +rule_thickness#:=.66pt#; % thickness of lines in math symbols +rule_thickness#:=.88pt#; % thickness of lines in math symbols + +dish#:=1/36pt#; % amount erased at top or bottom of serifs +bracket#:=12/36pt#; % vertical distance from serif base to tangent +jut#:=30/36pt#; % protrusion of lowercase serifs +cap_jut#:=46/36pt#; % protrusion of uppercase serifs +beak_jut#:=12.4/36pt#; % horizontal protrusion of beak serifs +beak#:=84/36pt#; % vertical protrusion of beak serifs +vair#:=14.3/36pt#; % vertical diameter of hairlines +%notch_cut#:=12pt#; % maximum breadth above or below notches +notch_cut#:=17pt#; % maximum breadth above or below notches drh +bar#:=18.5/36pt#; % lowercase bar thickness +slab#:=18.5/36pt#; % serif and arm thickness +cap_bar#:=18.5/36pt#; % uppercase bar thickness +cap_band#:=18.5/36pt#; % uppercase thickness above/below lobes +%cap_notch_cut#:=12pt#; % max breadth above/below uppercase notches +cap_notch_cut#:=17pt#; % max breadth above/below uppercase notches drh +serif_drop#:=3.6/36pt#; % vertical drop of sloped serifs +stem_corr#:=2/36pt#; % for small refinements of stem breadth +vair_corr#:=1.5/36pt#; % for small refinements of hairline height +apex_corr#:=0pt#; % extra width at diagonal junctions + +o#:=5/36pt#; % amount of overshoot for curves +apex_o#:=4/36pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=1; % factor applied to weights of heavy characters +math_spread:=.4; % extra openness of math symbols +superness:=8/11; % parameter for superellipses +superpull:=1/8; % extra openness inside bowls +beak_darkness:=.4; % fraction of triangle inside beak serifs +ligs:=2; % level of ligatures to be included + +square_dots:=false; % should dots be square? +hefty:=false; % should we try hard not to be overweight? +serifs:=true; % should serifs and bulbs be attached? +monospace:=false; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=false; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file + diff --git a/support/rtflatex/mf/cmoinch.mf b/support/rtflatex/mf/cmoinch.mf new file mode 100644 index 0000000000..a3d4033265 --- /dev/null +++ b/support/rtflatex/mf/cmoinch.mf @@ -0,0 +1,82 @@ +% This is OCMINCH.MF in text format, as of Sept. 14, 1988. +% Computer Modern Inch-High Sans Serif Bold Extended Caps and Digits Outline +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 +numeric Pt#; 250/36Pt#=1in#; +font_identifier:="OCMINCH"; font_size 10Pt#; + +outlining:=true; + +u#:=22/36Pt#; % unit width +width_adj#:=22/36Pt#; % width adjustment for certain characters +serif_fit#:=-9/36Pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=-11/36Pt#; % extra sidebar near uppercase serifs +letter_fit#:=0Pt#; % extra space added to all sidebars + +body_height#:=270/36Pt#; % height of tallest characters +asc_height#:=250/36Pt#; % height of lowercase ascenders +cap_height#:=250/36Pt#; % height of caps +fig_height#:=250/36Pt#; % height of numerals +x_height#:=165/36Pt#; % height of lowercase without ascenders +math_axis#:=90/36Pt#; % axis of symmetry for math symbols +bar_height#:=90/36Pt#; % height of crossbar in lowercase e +comma_depth#:=38/36Pt#; % depth of comma below baseline +desc_depth#:=70/36Pt#; % depth of lowercase descenders + +crisp#:=26/36Pt#; % diameter of serif corners +tiny#:=26/36Pt#; % diameter of rounded corners +fine#:=9/36Pt#; % diameter of sharply rounded corners +thin_join#:=9/36Pt#; % width of extrafine details +hair#:=49/36Pt#; % lowercase hairline breadth +stem#:=49/36Pt#; % lowercase stem breadth +curve#:=49/36Pt#; % lowercase curve breadth +ess#:=43/36Pt#; % breadth in middle of lowercase s +flare#:=40/36Pt#; % diameter of bulbs or breadth of terminals +dot_size#:=47/36Pt#; % diameter of dots +cap_hair#:=49/36Pt#; % uppercase hairline breadth +cap_stem#:=53/36Pt#; % uppercase stem breadth +cap_curve#:=53/36Pt#; % uppercase curve breadth +cap_ess#:=51/36Pt#; % breadth in middle of uppercase s +rule_thickness#:=30/36Pt#; % thickness of lines in math symbols + +dish#:=0Pt#; % amount erased at top or bottom of serifs +bracket#:=0Pt#; % vertical distance from serif base to tangent +jut#:=0Pt#; % protrusion of lowercase serifs +cap_jut#:=0Pt#; % protrusion of uppercase serifs +beak_jut#:=0Pt#; % horizontal protrusion of beak serifs +beak#:=1.5/36Pt#; % vertical protrusion of beak serifs +vair#:=26/36Pt#; % vertical diameter of hairlines +%notch_cut#:=49/36Pt#; % maximum breadth above or below notches +notch_cut#:=17Pt#; % maximum breadth above or below notches drh +bar#:=26/36Pt#; % lowercase bar thickness +slab#:=36/36Pt#; % serif and arm thickness +cap_bar#:=34/36Pt#; % uppercase bar thickness +cap_band#:=31/36Pt#; % uppercase thickness above/below lobes +%cap_notch_cut#:=45/36Pt#; % max breadth above/below uppercase notches +cap_notch_cut#:=17Pt#; % max breadth above/below uppercase notches drh +serif_drop#:=2/36Pt#; % vertical drop of sloped serifs +stem_corr#:=1/36Pt#; % for small refinements of stem breadth +vair_corr#:=2/36Pt#; % for small refinements of hairline height +apex_corr#:=18/36Pt#; % extra width at diagonal junctions + +o#:=8/36Pt#; % amount of overshoot for curves +apex_o#:=0Pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=.88; % factor applied to weights of heavy characters +math_spread:=.5; % extra openness of math symbols +superness:=3/4; % parameter for superellipses +superpull:=1/18; % extra openness inside bowls +beak_darkness:=0; % fraction of triangle inside beak serifs +ligs:=2; % level of ligatures to be included + +square_dots:=true; % should dots be square? +hefty:=true; % should we try hard not to be overweight? +serifs:=false; % should serifs and bulbs be attached? +monospace:=false; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=false; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate title % switch to the driver file + diff --git a/support/rtflatex/mf/cmor10.mf b/support/rtflatex/mf/cmor10.mf new file mode 100644 index 0000000000..36f6466994 --- /dev/null +++ b/support/rtflatex/mf/cmor10.mf @@ -0,0 +1,83 @@ +% This is OCMR10.MF in text format, as of Mar 31, 1986. +% Computer Modern Roman 10 point +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +outlining:=true; + +font_identifier:="CMOR"; font_size 10pt#; + +u#:=20/36pt#; % unit width +width_adj#:=0pt#; % width adjustment for certain characters +serif_fit#:=0pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=5/36pt#; % extra sidebar near uppercase serifs +letter_fit#:=0pt#; % extra space added to all sidebars + +body_height#:=270/36pt#; % height of tallest characters +asc_height#:=250/36pt#; % height of lowercase ascenders +cap_height#:=246/36pt#; % height of caps +fig_height#:=232/36pt#; % height of numerals +x_height#:=155/36pt#; % height of lowercase without ascenders +math_axis#:=90/36pt#; % axis of symmetry for math symbols +bar_height#:=87/36pt#; % height of crossbar in lowercase e +comma_depth#:=70/36pt#; % depth of comma below baseline +desc_depth#:=70/36pt#; % depth of lowercase descenders + +crisp#:=0pt#; % diameter of serif corners +tiny#:=8/36pt#; % diameter of rounded corners +fine#:=7/36pt#; % diameter of sharply rounded corners +thin_join#:=7/36pt#; % width of extrafine details +hair#:=9/36pt#; % lowercase hairline breadth +stem#:=25/36pt#; % lowercase stem breadth +curve#:=30/36pt#; % lowercase curve breadth +ess#:=27/36pt#; % breadth in middle of lowercase s +flare#:=33/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=38/36pt#; % diameter of dots +cap_hair#:=11/36pt#; % uppercase hairline breadth +cap_stem#:=32/36pt#; % uppercase stem breadth +cap_curve#:=37/36pt#; % uppercase curve breadth +cap_ess#:=35/36pt#; % breadth in middle of uppercase s +%rule_thickness#:=.4pt#; % thickness of lines in math symbols +rule_thickness#:=.62pt#; % thickness of lines in math symbols drh + +dish#:=1/36pt#; % amount erased at top or bottom of serifs +bracket#:=20/36pt#; % vertical distance from serif base to tangent +jut#:=28/36pt#; % protrusion of lowercase serifs +cap_jut#:=37/36pt#; % protrusion of uppercase serifs +beak_jut#:=10/36pt#; % horizontal protrusion of beak serifs +beak#:=70/36pt#; % vertical protrusion of beak serifs +vair#:=8/36pt#; % vertical diameter of hairlines +%notch_cut#:=10pt#; % maximum breadth above or below notches +notch_cut#:=17pt#; % maximum breadth above or below notches drh +bar#:=11/36pt#; % lowercase bar thickness +slab#:=11/36pt#; % serif and arm thickness +cap_bar#:=11/36pt#; % uppercase bar thickness +cap_band#:=11/36pt#; % uppercase thickness above/below lobes +% cap_notch_cut#:=10pt#; % max breadth above/below uppercase notches +cap_notch_cut#:=17pt#; % max breadth above/below uppercase notches drh +serif_drop#:=4/36pt#; % vertical drop of sloped serifs +stem_corr#:=1/36pt#; % for small refinements of stem breadth +vair_corr#:=1/36pt#; % for small refinements of hairline height +apex_corr#:=0pt#; % extra width at diagonal junctions + +o#:=8/36pt#; % amount of overshoot for curves +apex_o#:=8/36pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=1; % factor applied to weights of heavy characters +math_spread:=0; % extra openness of math symbols +superness:=1/sqrt2; % parameter for superellipses +superpull:=1/6; % extra openness inside bowls +beak_darkness:=11/30; % fraction of triangle inside beak serifs +ligs:=2; % level of ligatures to be included + +square_dots:=false; % should dots be square? +hefty:=false; % should we try hard not to be overweight? +serifs:=true; % should serifs and bulbs be attached? +monospace:=false; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=false; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file + diff --git a/support/rtflatex/mf/cmor12.mf b/support/rtflatex/mf/cmor12.mf new file mode 100644 index 0000000000..a12b69ec03 --- /dev/null +++ b/support/rtflatex/mf/cmor12.mf @@ -0,0 +1,83 @@ +% This is OCMR12.MF in text format, as of Mar 31, 1986. +% Computer Modern Roman Outline 12 point +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +outlining:=true; % make "outline" characters for this run + +font_identifier:="CMOR"; font_size 12pt#; + +u#:=23.5/36pt#; % unit width +width_adj#:=0pt#; % width adjustment for certain characters +serif_fit#:=0pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=5.8/36pt#; % extra sidebar near uppercase serifs +letter_fit#:=0pt#; % extra space added to all sidebars + +body_height#:=324/36pt#; % height of tallest characters +asc_height#:=300/36pt#; % height of lowercase ascenders +cap_height#:=295.2/36pt#; % height of caps +fig_height#:=278.4/36pt#; % height of numerals +x_height#:=186/36pt#; % height of lowercase without ascenders +math_axis#:=108/36pt#; % axis of symmetry for math symbols +bar_height#:=104.4/36pt#; % height of crossbar in lowercase e +comma_depth#:=84/36pt#; % depth of comma below baseline +desc_depth#:=84/36pt#; % depth of lowercase descenders + +crisp#:=0pt#; % diameter of serif corners +tiny#:=8/36pt#; % diameter of rounded corners +fine#:=7/36pt#; % diameter of sharply rounded corners +thin_join#:=7.5/36pt#; % width of extrafine details +hair#:=9.5/36pt#; % lowercase hairline breadth +stem#:=28/36pt#; % lowercase stem breadth +curve#:=33/36pt#; % lowercase curve breadth +ess#:=30/36pt#; % breadth in middle of lowercase s +flare#:=36/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=42/36pt#; % diameter of dots +cap_hair#:=11.5/36pt#; % uppercase hairline breadth +cap_stem#:=35/36pt#; % uppercase stem breadth +cap_curve#:=40/36pt#; % uppercase curve breadth +cap_ess#:=38/36pt#; % breadth in middle of uppercase s +%rule_thickness#:=.44pt#; % thickness of lines in math symbols +rule_thickness#:=.66pt#; % thickness of lines in math symbols + +dish#:=1/36pt#; % amount erased at top or bottom of serifs +bracket#:=24/36pt#; % vertical distance from serif base to tangent +jut#:=33/36pt#; % protrusion of lowercase serifs +cap_jut#:=41/36pt#; % protrusion of uppercase serifs +beak_jut#:=11.4/36pt#; % horizontal protrusion of beak serifs +beak#:=84/36pt#; % vertical protrusion of beak serifs +vair#:=8.5/36pt#; % vertical diameter of hairlines +%notch_cut#:=12pt#; % maximum breadth above or below notches +notch_cut#:=17pt#; % maximum breadth above or below notches drh +bar#:=12.5/36pt#; % lowercase bar thickness +slab#:=12.5/36pt#; % serif and arm thickness +cap_bar#:=12.5/36pt#; % uppercase bar thickness +cap_band#:=12.5/36pt#; % uppercase thickness above/below lobes +%cap_notch_cut#:=12pt#; % max breadth above/below uppercase notches +cap_notch_cut#:=17pt#; % max breadth above/below uppercase notches drh +serif_drop#:=4.8/36pt#; % vertical drop of sloped serifs +stem_corr#:=1/36pt#; % for small refinements of stem breadth +vair_corr#:=1/36pt#; % for small refinements of hairline height +apex_corr#:=0pt#; % extra width at diagonal junctions + +o#:=9/36pt#; % amount of overshoot for curves +apex_o#:=9/36pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=1; % factor applied to weights of heavy characters +math_spread:=-0.2; % extra openness of math symbols +superness:=1/sqrt2; % parameter for superellipses +superpull:=1/6; % extra openness inside bowls +beak_darkness:=11/30; % fraction of triangle inside beak serifs +ligs:=2; % level of ligatures to be included + +square_dots:=false; % should dots be square? +hefty:=false; % should we try hard not to be overweight? +serifs:=true; % should serifs and bulbs be attached? +monospace:=false; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=false; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file + diff --git a/support/rtflatex/mf/cmor17.mf b/support/rtflatex/mf/cmor17.mf new file mode 100644 index 0000000000..c9043b4579 --- /dev/null +++ b/support/rtflatex/mf/cmor17.mf @@ -0,0 +1,81 @@ +% This is OCMR17.MF in text format, as of Mar 31, 1986. +% Computer Modern Roman 17 point (more or less) +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +outlining:=true; + +font_identifier:="CMOR"; font_size 17.28pt#; + +u#:=32.5/36pt#; % unit width +width_adj#:=0pt#; % width adjustment for certain characters +serif_fit#:=0pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=8/36pt#; % extra sidebar near uppercase serifs +letter_fit#:=-0.1pt#; % extra space added to all sidebars + +body_height#:=466/36pt#; % height of tallest characters +asc_height#:=432/36pt#; % height of lowercase ascenders +cap_height#:=425/36pt#; % height of caps +fig_height#:=401/36pt#; % height of numerals +x_height#:=267.8/36pt#; % height of lowercase without ascenders +math_axis#:=155.5/36pt#; % axis of symmetry for math symbols +bar_height#:=150/36pt#; % height of crossbar in lowercase e +comma_depth#:=121/36pt#; % depth of comma below baseline +desc_depth#:=121/36pt#; % depth of lowercase descenders + +crisp#:=0pt#; % diameter of serif corners +tiny#:=8/36pt#; % diameter of rounded corners +fine#:=7/36pt#; % diameter of sharply rounded corners +thin_join#:=9/36pt#; % width of extrafine details +hair#:=11/36pt#; % lowercase hairline breadth +stem#:=33/36pt#; % lowercase stem breadth +curve#:=41/36pt#; % lowercase curve breadth +ess#:=35/36pt#; % breadth in middle of lowercase s +flare#:=45/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=51/36pt#; % diameter of dots +cap_hair#:=13/36pt#; % uppercase hairline breadth +cap_stem#:=40/36pt#; % uppercase stem breadth +cap_curve#:=48/36pt#; % uppercase curve breadth +cap_ess#:=43/36pt#; % breadth in middle of uppercase s +%rule_thickness#:=.6pt#; % thickness of lines in math symbols +rule_thickness#:=1pt#; % thickness of lines in math symbols + +dish#:=1/36pt#; % amount erased at top or bottom of serifs +bracket#:=34/36pt#; % vertical distance from serif base to tangent +jut#:=42/36pt#; % protrusion of lowercase serifs +cap_jut#:=50/36pt#; % protrusion of uppercase serifs +beak_jut#:=15/36pt#; % horizontal protrusion of beak serifs +beak#:=121/36pt#; % vertical protrusion of beak serifs +vair#:=10/36pt#; % vertical diameter of hairlines +notch_cut#:=17pt#; % maximum breadth above or below notches +bar#:=16/36pt#; % lowercase bar thickness +slab#:=16/36pt#; % serif and arm thickness +cap_bar#:=16/36pt#; % uppercase bar thickness +cap_band#:=16/36pt#; % uppercase thickness above/below lobes +cap_notch_cut#:=17pt#; % max breadth above/below uppercase notches +serif_drop#:=17/36pt#; % vertical drop of sloped serifs +stem_corr#:=1/36pt#; % for small refinements of stem breadth +vair_corr#:=1/36pt#; % for small refinements of hairline height +apex_corr#:=0pt#; % extra width at diagonal junctions + +o#:=10/36pt#; % amount of overshoot for curves +apex_o#:=10/36pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=1; % factor applied to weights of heavy characters +math_spread:=-0.4; % extra openness of math symbols +superness:=1/sqrt2; % parameter for superellipses +superpull:=1/6; % extra openness inside bowls +beak_darkness:=11/30; % fraction of triangle inside beak serifs +ligs:=2; % level of ligatures to be included + +square_dots:=false; % should dots be square? +hefty:=false; % should we try hard not to be overweight? +serifs:=true; % should serifs and bulbs be attached? +monospace:=false; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=false; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file + diff --git a/support/rtflatex/mf/cmor5.mf b/support/rtflatex/mf/cmor5.mf new file mode 100644 index 0000000000..fa676a8e10 --- /dev/null +++ b/support/rtflatex/mf/cmor5.mf @@ -0,0 +1,83 @@ +% This is OCMR5.MF in text format, as of Sept 10, 1988. +% Computer Modern Roman Outline 5 point +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +outlining:=true; + +font_identifier:="OCMR"; font_size 5pt#; + +u#:=12.5/36pt#; % unit width +width_adj#:=0pt#; % width adjustment for certain characters +serif_fit#:=0pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=2/36pt#; % extra sidebar near uppercase serifs +letter_fit#:=5/36pt#; % extra space added to all sidebars + +body_height#:=135/36pt#; % height of tallest characters +asc_height#:=125/36pt#; % height of lowercase ascenders +cap_height#:=123/36pt#; % height of caps +fig_height#:=116/36pt#; % height of numerals +x_height#:=77.5/36pt#; % height of lowercase without ascenders +math_axis#:=45/36pt#; % axis of symmetry for math symbols +bar_height#:=43.5/36pt#; % height of crossbar in lowercase e +comma_depth#:=35/36pt#; % depth of comma below baseline +desc_depth#:=35/36pt#; % depth of lowercase descenders + +crisp#:=0pt#; % diameter of serif corners +tiny#:=6/36pt#; % diameter of rounded corners +fine#:=5/36pt#; % diameter of sharply rounded corners +thin_join#:=5/36pt#; % width of extrafine details +hair#:=7.5/36pt#; % lowercase hairline breadth +stem#:=16/36pt#; % lowercase stem breadth +curve#:=18/36pt#; % lowercase curve breadth +ess#:=12/36pt#; % breadth in middle of lowercase s +flare#:=19/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=22/36pt#; % diameter of dots +cap_hair#:=8/36pt#; % uppercase hairline breadth +cap_stem#:=19/36pt#; % uppercase stem breadth +cap_curve#:=21/36pt#; % uppercase curve breadth +cap_ess#:=14/36pt#; % breadth in middle of uppercase s +%rule_thickness#:=.28pt#; % thickness of lines in math symbols +rule_thickness#:=.4pt#; % thickness of lines in math symbols + +dish#:=.7/36pt#; % amount erased at top or bottom of serifs +bracket#:=10/36pt#; % vertical distance from serif base to tangent +jut#:=15/36pt#; % protrusion of lowercase serifs +cap_jut#:=20/36pt#; % protrusion of uppercase serifs +beak_jut#:=6/36pt#; % horizontal protrusion of beak serifs +beak#:=35/36pt#; % vertical protrusion of beak serifs +vair#:=6/36pt#; % vertical diameter of hairlines +%notch_cut#:=17pt#; % maximum breadth above or below notches +notch_cut#:=5pt#; % maximum breadth above or below notches +bar#:=8/36pt#; % lowercase bar thickness +slab#:=8/36pt#; % serif and arm thickness +cap_bar#:=8/36pt#; % uppercase bar thickness +cap_band#:=8/36pt#; % uppercase thickness above/below lobes +%cap_notch_cut#:=5pt#; % max breadth above/below uppercase notches +cap_notch_cut#:=17pt#; % max breadth above/below uppercase notches +serif_drop#:=2/36pt#; % vertical drop of sloped serifs +stem_corr#:=.7/36pt#; % for small refinements of stem breadth +vair_corr#:=.5/36pt#; % for small refinements of hairline height +apex_corr#:=0pt#; % extra width at diagonal junctions + +o#:=4/36pt#; % amount of overshoot for curves +apex_o#:=4/36pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=1; % factor applied to weights of heavy characters +math_spread:=1; % extra openness of math symbols +superness:=1/sqrt2; % parameter for superellipses +superpull:=1/6; % extra openness inside bowls +beak_darkness:=11/30; % fraction of triangle inside beak serifs +ligs:=1; % level of ligatures to be included + +square_dots:=false; % should dots be square? +hefty:=false; % should we try hard not to be overweight? +serifs:=true; % should serifs and bulbs be attached? +monospace:=false; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=false; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file + diff --git a/support/rtflatex/mf/cmor6.mf b/support/rtflatex/mf/cmor6.mf new file mode 100644 index 0000000000..04d106f21f --- /dev/null +++ b/support/rtflatex/mf/cmor6.mf @@ -0,0 +1,82 @@ +% This is OCMR6.MF in text format, as of Sept. 14, 1988. +% Computer Modern Roman 6 point Outline +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +outlining:=true; + +font_identifier:="OCMR"; font_size 6pt#; + +u#:=14/36pt#; % unit width +width_adj#:=0pt#; % width adjustment for certain characters +serif_fit#:=0pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=2.8/36pt#; % extra sidebar near uppercase serifs +letter_fit#:=3/36pt#; % extra space added to all sidebars + +body_height#:=162/36pt#; % height of tallest characters +asc_height#:=150/36pt#; % height of lowercase ascenders +cap_height#:=147.6/36pt#; % height of caps +fig_height#:=139.2/36pt#; % height of numerals +x_height#:=93/36pt#; % height of lowercase without ascenders +math_axis#:=54/36pt#; % axis of symmetry for math symbols +bar_height#:=52.2/36pt#; % height of crossbar in lowercase e +comma_depth#:=42/36pt#; % depth of comma below baseline +desc_depth#:=42/36pt#; % depth of lowercase descenders + +crisp#:=0pt#; % diameter of serif corners +tiny#:=7/36pt#; % diameter of rounded corners +fine#:=6/36pt#; % diameter of sharply rounded corners +thin_join#:=6/36pt#; % width of extrafine details +hair#:=8/36pt#; % lowercase hairline breadth +stem#:=18/36pt#; % lowercase stem breadth +curve#:=20.5/36pt#; % lowercase curve breadth +ess#:=17/36pt#; % breadth in middle of lowercase s +flare#:=21/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=26/36pt#; % diameter of dots +cap_hair#:=8.5/36pt#; % uppercase hairline breadth +cap_stem#:=21.5/36pt#; % uppercase stem breadth +cap_curve#:=24/36pt#; % uppercase curve breadth +cap_ess#:=19/36pt#; % breadth in middle of uppercase s +%rule_thickness#:=.31pt#; % thickness of lines in math symbols +rule_thickness#:=.51pt#; % thickness of lines in math symbols drh + +dish#:=.8/36pt#; % amount erased at top or bottom of serifs +bracket#:=12/36pt#; % vertical distance from serif base to tangent +jut#:=17/36pt#; % protrusion of lowercase serifs +cap_jut#:=23/36pt#; % protrusion of uppercase serifs +beak_jut#:=6.8/36pt#; % horizontal protrusion of beak serifs +beak#:=42/36pt#; % vertical protrusion of beak serifs +vair#:=7/36pt#; % vertical diameter of hairlines +%notch_cut#:=6pt#; % maximum breadth above or below notches +notch_cut#:=17pt#; % maximum breadth above or below notches drh +bar#:=8.5/36pt#; % lowercase bar thickness +slab#:=8.5/36pt#; % serif and arm thickness +cap_bar#:=8.5/36pt#; % uppercase bar thickness +cap_band#:=8.5/36pt#; % uppercase thickness above/below lobes +%cap_notch_cut#:=6pt#; % max breadth above/below uppercase notches +cap_notch_cut#:=17pt#; % max breadth above/below uppercase notches drh +serif_drop#:=2.4/36pt#; % vertical drop of sloped serifs +stem_corr#:=.8/36pt#; % for small refinements of stem breadth +vair_corr#:=.7/36pt#; % for small refinements of hairline height +apex_corr#:=0pt#; % extra width at diagonal junctions + +o#:=4.5/36pt#; % amount of overshoot for curves +apex_o#:=4.5/36pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=1; % factor applied to weights of heavy characters +math_spread:=.8; % extra openness of math symbols +superness:=1/sqrt2; % parameter for superellipses +superpull:=1/6; % extra openness inside bowls +beak_darkness:=11/30; % fraction of triangle inside beak serifs +ligs:=2; % level of ligatures to be included + +square_dots:=false; % should dots be square? +hefty:=false; % should we try hard not to be overweight? +serifs:=true; % should serifs and bulbs be attached? +monospace:=false; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=false; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file diff --git a/support/rtflatex/mf/cmor7.mf b/support/rtflatex/mf/cmor7.mf new file mode 100644 index 0000000000..77502bbaaa --- /dev/null +++ b/support/rtflatex/mf/cmor7.mf @@ -0,0 +1,82 @@ +% This is OCMR7.MF in text format, as of Sept. 14, 1988. +% Computer Modern Roman 7 point Outline +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +outlining:=true; + +font_identifier:="OCMR"; font_size 7pt#; + +u#:=15.5/36pt#; % unit width +width_adj#:=0pt#; % width adjustment for certain characters +serif_fit#:=0pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=3.5/36pt#; % extra sidebar near uppercase serifs +letter_fit#:=2/36pt#; % extra space added to all sidebars + +body_height#:=189/36pt#; % height of tallest characters +asc_height#:=175/36pt#; % height of lowercase ascenders +cap_height#:=172.2/36pt#; % height of caps +fig_height#:=162.4/36pt#; % height of numerals +x_height#:=108.5/36pt#; % height of lowercase without ascenders +math_axis#:=63/36pt#; % axis of symmetry for math symbols +bar_height#:=60.9/36pt#; % height of crossbar in lowercase e +comma_depth#:=49/36pt#; % depth of comma below baseline +desc_depth#:=49/36pt#; % depth of lowercase descenders + +crisp#:=0pt#; % diameter of serif corners +tiny#:=7/36pt#; % diameter of rounded corners +fine#:=6/36pt#; % diameter of sharply rounded corners +thin_join#:=6/36pt#; % width of extrafine details +hair#:=8.5/36pt#; % lowercase hairline breadth +stem#:=20/36pt#; % lowercase stem breadth +curve#:=23/36pt#; % lowercase curve breadth +ess#:=21/36pt#; % breadth in middle of lowercase s +flare#:=24/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=29/36pt#; % diameter of dots +cap_hair#:=9/36pt#; % uppercase hairline breadth +cap_stem#:=24/36pt#; % uppercase stem breadth +cap_curve#:=27/36pt#; % uppercase curve breadth +cap_ess#:=23/36pt#; % breadth in middle of uppercase s +%rule_thickness#:=.34pt#; % thickness of lines in math symbols +rule_thickness#:=.56pt#; % thickness of lines in math symbols + +dish#:=.9/36pt#; % amount erased at top or bottom of serifs +bracket#:=14/36pt#; % vertical distance from serif base to tangent +jut#:=19/36pt#; % protrusion of lowercase serifs +cap_jut#:=26/36pt#; % protrusion of uppercase serifs +beak_jut#:=7.6/36pt#; % horizontal protrusion of beak serifs +beak#:=49/36pt#; % vertical protrusion of beak serifs +vair#:=7/36pt#; % vertical diameter of hairlines +%notch_cut#:=7pt#; % maximum breadth above or below notches +notch_cut#:=17pt#; % maximum breadth above or below notches +bar#:=9/36pt#; % lowercase bar thickness +slab#:=9/36pt#; % serif and arm thickness +cap_bar#:=9/36pt#; % uppercase bar thickness +cap_band#:=9/36pt#; % uppercase thickness above/below lobes +%cap_notch_cut#:=7pt#; % max breadth above/below uppercase notches +cap_notch_cut#:=17pt#; % max breadth above/below uppercase notches +serif_drop#:=2.8/36pt#; % vertical drop of sloped serifs +stem_corr#:=.9/36pt#; % for small refinements of stem breadth +vair_corr#:=.9/36pt#; % for small refinements of hairline height +apex_corr#:=0pt#; % extra width at diagonal junctions + +o#:=5/36pt#; % amount of overshoot for curves +apex_o#:=5/36pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=1; % factor applied to weights of heavy characters +math_spread:=.6; % extra openness of math symbols +superness:=1/sqrt2; % parameter for superellipses +superpull:=1/6; % extra openness inside bowls +beak_darkness:=11/30; % fraction of triangle inside beak serifs +ligs:=2; % level of ligatures to be included + +square_dots:=false; % should dots be square? +hefty:=false; % should we try hard not to be overweight? +serifs:=true; % should serifs and bulbs be attached? +monospace:=false; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=false; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file diff --git a/support/rtflatex/mf/cmor8.mf b/support/rtflatex/mf/cmor8.mf new file mode 100644 index 0000000000..d4b7294fe0 --- /dev/null +++ b/support/rtflatex/mf/cmor8.mf @@ -0,0 +1,82 @@ +% This is OCMR8.MF in text format, as of Sept. 14, 1988. +% Computer Modern Roman 8 point Outline +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +outlining:=true; + +font_identifier:="CMOR"; font_size 8pt#; + +u#:=17/36pt#; % unit width +width_adj#:=0pt#; % width adjustment for certain characters +serif_fit#:=0pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=4.1/36pt#; % extra sidebar near uppercase serifs +letter_fit#:=0pt#; % extra space added to all sidebars + +body_height#:=216/36pt#; % height of tallest characters +asc_height#:=200/36pt#; % height of lowercase ascenders +cap_height#:=196.8/36pt#; % height of caps +fig_height#:=185.6/36pt#; % height of numerals +x_height#:=124/36pt#; % height of lowercase without ascenders +math_axis#:=72/36pt#; % axis of symmetry for math symbols +bar_height#:=69.6/36pt#; % height of crossbar in lowercase e +comma_depth#:=56/36pt#; % depth of comma below baseline +desc_depth#:=56/36pt#; % depth of lowercase descenders + +crisp#:=0pt#; % diameter of serif corners +tiny#:=8/36pt#; % diameter of rounded corners +fine#:=7/36pt#; % diameter of sharply rounded corners +thin_join#:=7/36pt#; % width of extrafine details +hair#:=9/36pt#; % lowercase hairline breadth +stem#:=22/36pt#; % lowercase stem breadth +curve#:=25.5/36pt#; % lowercase curve breadth +ess#:=23/36pt#; % breadth in middle of lowercase s +flare#:=27/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=32/36pt#; % diameter of dots +cap_hair#:=9.5/36pt#; % uppercase hairline breadth +cap_stem#:=26.5/36pt#; % uppercase stem breadth +cap_curve#:=30/36pt#; % uppercase curve breadth +cap_ess#:=27/36pt#; % breadth in middle of uppercase s +%rule_thickness#:=.36pt#; % thickness of lines in math symbols +rule_thickness#:=.58pt#; % thickness of lines in math symbols drh + +dish#:=1/36pt#; % amount erased at top or bottom of serifs +bracket#:=16/36pt#; % vertical distance from serif base to tangent +jut#:=22/36pt#; % protrusion of lowercase serifs +cap_jut#:=29/36pt#; % protrusion of uppercase serifs +beak_jut#:=8.4/36pt#; % horizontal protrusion of beak serifs +beak#:=56/36pt#; % vertical protrusion of beak serifs +vair#:=8/36pt#; % vertical diameter of hairlines +%notch_cut#:=8pt#; % maximum breadth above or below notches +notch_cut#:=17pt#; % maximum breadth above or below notches drh +bar#:=9.5/36pt#; % lowercase bar thickness +slab#:=9.5/36pt#; % serif and arm thickness +cap_bar#:=9.5/36pt#; % uppercase bar thickness +cap_band#:=9.5/36pt#; % uppercase thickness above/below lobes +%cap_notch_cut#:=8pt#; % max breadth above/below uppercase notches +cap_notch_cut#:=17pt#; % max breadth above/below uppercase notches drh +serif_drop#:=3.2/36pt#; % vertical drop of sloped serifs +stem_corr#:=1/36pt#; % for small refinements of stem breadth +vair_corr#:=1/36pt#; % for small refinements of hairline height +apex_corr#:=0pt#; % extra width at diagonal junctions + +o#:=6/36pt#; % amount of overshoot for curves +apex_o#:=6/36pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=1; % factor applied to weights of heavy characters +math_spread:=.4; % extra openness of math symbols +superness:=1/sqrt2; % parameter for superellipses +superpull:=1/6; % extra openness inside bowls +beak_darkness:=11/30; % fraction of triangle inside beak serifs +ligs:=2; % level of ligatures to be included + +square_dots:=false; % should dots be square? +hefty:=false; % should we try hard not to be overweight? +serifs:=true; % should serifs and bulbs be attached? +monospace:=false; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=false; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file diff --git a/support/rtflatex/mf/cmor9.mf b/support/rtflatex/mf/cmor9.mf new file mode 100644 index 0000000000..1c57261acf --- /dev/null +++ b/support/rtflatex/mf/cmor9.mf @@ -0,0 +1,82 @@ +% This is OCMR9.MF in text format, as of Sept. 15, 1988. +% Computer Modern Roman 9 point Outline +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +outlining:=true; + +font_identifier:="CMOR"; font_size 9pt#; + +u#:=18.5/36pt#; % unit width +width_adj#:=0pt#; % width adjustment for certain characters +serif_fit#:=0pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=4.6/36pt#; % extra sidebar near uppercase serifs +letter_fit#:=0pt#; % extra space added to all sidebars + +body_height#:=243/36pt#; % height of tallest characters +asc_height#:=225/36pt#; % height of lowercase ascenders +cap_height#:=221.4/36pt#; % height of caps +fig_height#:=208.8/36pt#; % height of numerals +x_height#:=139.5/36pt#; % height of lowercase without ascenders +math_axis#:=81/36pt#; % axis of symmetry for math symbols +bar_height#:=78.3/36pt#; % height of crossbar in lowercase e +comma_depth#:=63/36pt#; % depth of comma below baseline +desc_depth#:=63/36pt#; % depth of lowercase descenders + +crisp#:=0pt#; % diameter of serif corners +tiny#:=8/36pt#; % diameter of rounded corners +fine#:=7/36pt#; % diameter of sharply rounded corners +thin_join#:=7/36pt#; % width of extrafine details +hair#:=9/36pt#; % lowercase hairline breadth +stem#:=24/36pt#; % lowercase stem breadth +curve#:=28/36pt#; % lowercase curve breadth +ess#:=25/36pt#; % breadth in middle of lowercase s +flare#:=30/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=35/36pt#; % diameter of dots +cap_hair#:=10/36pt#; % uppercase hairline breadth +cap_stem#:=29/36pt#; % uppercase stem breadth +cap_curve#:=33/36pt#; % uppercase curve breadth +cap_ess#:=31/36pt#; % breadth in middle of uppercase s +%rule_thickness#:=.38pt#; % thickness of lines in math symbols +rule_thickness#:=.60pt#; % thickness of lines in math symbols drh + +dish#:=1/36pt#; % amount erased at top or bottom of serifs +bracket#:=18/36pt#; % vertical distance from serif base to tangent +jut#:=25/36pt#; % protrusion of lowercase serifs +cap_jut#:=33/36pt#; % protrusion of uppercase serifs +beak_jut#:=9.2/36pt#; % horizontal protrusion of beak serifs +beak#:=63/36pt#; % vertical protrusion of beak serifs +vair#:=8/36pt#; % vertical diameter of hairlines +%notch_cut#:=9pt#; % maximum breadth above or below notches +notch_cut#:=17pt#; % maximum breadth above or below notches +bar#:=10/36pt#; % lowercase bar thickness +slab#:=10/36pt#; % serif and arm thickness +cap_bar#:=10/36pt#; % uppercase bar thickness +cap_band#:=10/36pt#; % uppercase thickness above/below lobes +%cap_notch_cut#:=9pt#; % max breadth above/below uppercase notches +cap_notch_cut#:=17pt#; % max breadth above/below uppercase notches +serif_drop#:=3.6/36pt#; % vertical drop of sloped serifs +stem_corr#:=1/36pt#; % for small refinements of stem breadth +vair_corr#:=1/36pt#; % for small refinements of hairline height +apex_corr#:=0pt#; % extra width at diagonal junctions + +o#:=7/36pt#; % amount of overshoot for curves +apex_o#:=7/36pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=1; % factor applied to weights of heavy characters +math_spread:=.2; % extra openness of math symbols +superness:=1/sqrt2; % parameter for superellipses +superpull:=1/6; % extra openness inside bowls +beak_darkness:=11/30; % fraction of triangle inside beak serifs +ligs:=2; % level of ligatures to be included + +square_dots:=false; % should dots be square? +hefty:=false; % should we try hard not to be overweight? +serifs:=true; % should serifs and bulbs be attached? +monospace:=false; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=false; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file diff --git a/support/rtflatex/mf/cmosdc10.mf b/support/rtflatex/mf/cmosdc10.mf new file mode 100644 index 0000000000..e0e3e34c96 --- /dev/null +++ b/support/rtflatex/mf/cmosdc10.mf @@ -0,0 +1,83 @@ +% This is OCMSDC10.MF in text format, as of Sept 10, 1988. +% Computer Modern Sans Serif Demibold Condensed Outline 10 pt +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +outlining:=true; + +font_identifier:="OCMSSDC"; font_size 10pt#; + +u#:=19/36pt#; % unit width +width_adj#:=15/36pt#; % width adjustment for certain characters +serif_fit#:=-8/36pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=-9/36pt#; % extra sidebar near uppercase serifs +letter_fit#:=0pt#; % extra space added to all sidebars + +body_height#:=270/36pt#; % height of tallest characters +asc_height#:=250/36pt#; % height of lowercase ascenders +cap_height#:=250/36pt#; % height of caps +fig_height#:=250/36pt#; % height of numerals +x_height#:=170/36pt#; % height of lowercase without ascenders +math_axis#:=95/36pt#; % axis of symmetry for math symbols +bar_height#:=95/36pt#; % height of crossbar in lowercase e +comma_depth#:=40/36pt#; % depth of comma below baseline +desc_depth#:=60/36pt#; % depth of lowercase descenders + +crisp#:=23/36pt#; % diameter of serif corners +tiny#:=23/36pt#; % diameter of rounded corners +fine#:=8/36pt#; % diameter of sharply rounded corners +thin_join#:=8/36pt#; % width of extrafine details +hair#:=40/36pt#; % lowercase hairline breadth +stem#:=40/36pt#; % lowercase stem breadth +curve#:=40/36pt#; % lowercase curve breadth +ess#:=37/36pt#; % breadth in middle of lowercase s +flare#:=31/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=38/36pt#; % diameter of dots +cap_hair#:=40/36pt#; % uppercase hairline breadth +cap_stem#:=44/36pt#; % uppercase stem breadth +cap_curve#:=44/36pt#; % uppercase curve breadth +cap_ess#:=42/36pt#; % breadth in middle of uppercase s +%rule_thickness#:=25/36pt#; % thickness of lines in math symbols +rule_thickness#:=.89pt#; % thickness of lines in math symbols + +dish#:=0pt#; % amount erased at top or bottom of serifs +bracket#:=0pt#; % vertical distance from serif base to tangent +jut#:=0pt#; % protrusion of lowercase serifs +cap_jut#:=0pt#; % protrusion of uppercase serifs +beak_jut#:=0pt#; % horizontal protrusion of beak serifs +beak#:=1.5/36pt#; % vertical protrusion of beak serifs +vair#:=23/36pt#; % vertical diameter of hairlines +%notch_cut#:=40/36pt#; % maximum breadth above or below notches +notch_cut#:=17pt#; % maximum breadth above or below notches drh +bar#:=23/36pt#; % lowercase bar thickness +slab#:=31/36pt#; % serif and arm thickness +cap_bar#:=29/36pt#; % uppercase bar thickness +cap_band#:=27/36pt#; % uppercase thickness above/below lobes +%cap_notch_cut#:=37/36pt#; % max breadth above/below uppercase notches +cap_notch_cut#:=17pt#; % max breadth above/below uppercase notches +serif_drop#:=2/36pt#; % vertical drop of sloped serifs +stem_corr#:=1/36pt#; % for small refinements of stem breadth +vair_corr#:=2/36pt#; % for small refinements of hairline height +apex_corr#:=14/36pt#; % extra width at diagonal junctions + +o#:=7/36pt#; % amount of overshoot for curves +apex_o#:=0pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=.91; % factor applied to weights of heavy characters +math_spread:=.3; % extra openness of math symbols +superness:=.74; % parameter for superellipses +superpull:=1/18; % extra openness inside bowls +beak_darkness:=0; % fraction of triangle inside beak serifs +ligs:=2; % level of ligatures to be included + +square_dots:=true; % should dots be square? +hefty:=true; % should we try hard not to be overweight? +serifs:=false; % should serifs and bulbs be attached? +monospace:=false; % should all characters have the same width? +variant_g:=true; % should an italic-style g be used? +low_asterisk:=false; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file + diff --git a/support/rtflatex/mf/cmosl12.mf b/support/rtflatex/mf/cmosl12.mf new file mode 100644 index 0000000000..8292129bcc --- /dev/null +++ b/support/rtflatex/mf/cmosl12.mf @@ -0,0 +1,83 @@ +% This is OCMSL12.MF in text format, as of Sept. 8, 1988. +% Computer Modern Slanted Roman Outline 12 point +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +outlining:=true; + +font_identifier:="CMOSL"; font_size 12pt#; + +u#:=23.5/36pt#; % unit width +width_adj#:=0pt#; % width adjustment for certain characters +serif_fit#:=0pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=5.8/36pt#; % extra sidebar near uppercase serifs +letter_fit#:=0pt#; % extra space added to all sidebars + +body_height#:=324/36pt#; % height of tallest characters +asc_height#:=300/36pt#; % height of lowercase ascenders +cap_height#:=295.2/36pt#; % height of caps +fig_height#:=278.4/36pt#; % height of numerals +x_height#:=186/36pt#; % height of lowercase without ascenders +math_axis#:=108/36pt#; % axis of symmetry for math symbols +bar_height#:=104.4/36pt#; % height of crossbar in lowercase e +comma_depth#:=84/36pt#; % depth of comma below baseline +desc_depth#:=84/36pt#; % depth of lowercase descenders + +crisp#:=0pt#; % diameter of serif corners +tiny#:=8/36pt#; % diameter of rounded corners +fine#:=7/36pt#; % diameter of sharply rounded corners +thin_join#:=7.5/36pt#; % width of extrafine details +hair#:=9.5/36pt#; % lowercase hairline breadth +stem#:=28/36pt#; % lowercase stem breadth +curve#:=33/36pt#; % lowercase curve breadth +ess#:=30/36pt#; % breadth in middle of lowercase s +flare#:=36/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=42/36pt#; % diameter of dots +cap_hair#:=11.5/36pt#; % uppercase hairline breadth +cap_stem#:=35/36pt#; % uppercase stem breadth +cap_curve#:=40/36pt#; % uppercase curve breadth +cap_ess#:=38/36pt#; % breadth in middle of uppercase s +%rule_thickness#:=.44pt#; % thickness of lines in math symbols +rule_thickness#:=.66pt#; % thickness of lines in math symbols + +dish#:=1/36pt#; % amount erased at top or bottom of serifs +bracket#:=24/36pt#; % vertical distance from serif base to tangent +jut#:=33/36pt#; % protrusion of lowercase serifs +cap_jut#:=41/36pt#; % protrusion of uppercase serifs +beak_jut#:=11.4/36pt#; % horizontal protrusion of beak serifs +beak#:=84/36pt#; % vertical protrusion of beak serifs +vair#:=8.5/36pt#; % vertical diameter of hairlines +%notch_cut#:=12pt#; % maximum breadth above or below notches +notch_cut#:=17pt#; % maximum breadth above or below notches drh +bar#:=12.5/36pt#; % lowercase bar thickness +slab#:=12.5/36pt#; % serif and arm thickness +cap_bar#:=12.5/36pt#; % uppercase bar thickness +cap_band#:=12.5/36pt#; % uppercase thickness above/below lobes +%cap_notch_cut#:=12pt#; % max breadth above/below uppercase notches +cap_notch_cut#:=17pt#; % max breadth above/below uppercase notches drh +serif_drop#:=4.8/36pt#; % vertical drop of sloped serifs +stem_corr#:=1/36pt#; % for small refinements of stem breadth +vair_corr#:=1/36pt#; % for small refinements of hairline height +apex_corr#:=0pt#; % extra width at diagonal junctions + +o#:=9/36pt#; % amount of overshoot for curves +apex_o#:=9/36pt#; % amount of overshoot for diagonal junctions + +slant:=1/6; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=1; % factor applied to weights of heavy characters +math_spread:=-0.2; % extra openness of math symbols +superness:=1/sqrt2; % parameter for superellipses +superpull:=1/6; % extra openness inside bowls +beak_darkness:=11/30; % fraction of triangle inside beak serifs +ligs:=2; % level of ligatures to be included + +square_dots:=false; % should dots be square? +hefty:=false; % should we try hard not to be overweight? +serifs:=true; % should serifs and bulbs be attached? +monospace:=false; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=false; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file + diff --git a/support/rtflatex/mf/cmoss10.mf b/support/rtflatex/mf/cmoss10.mf new file mode 100644 index 0000000000..6988592677 --- /dev/null +++ b/support/rtflatex/mf/cmoss10.mf @@ -0,0 +1,83 @@ +% This is OCMSS10.MF in text format, as of Mar 31, 1986. +% Computer Modern Sans Serif 10 pt +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +outlining:=true; % make "outline" characters for this run + +font_identifier:="CMOSS"; font_size 10pt#; + +u#:=20/36pt#; % unit width +width_adj#:=15/36pt#; % width adjustment for certain characters +serif_fit#:=-7/36pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=-10/36pt#; % extra sidebar near uppercase serifs +letter_fit#:=0pt#; % extra space added to all sidebars + +body_height#:=270/36pt#; % height of tallest characters +asc_height#:=250/36pt#; % height of lowercase ascenders +cap_height#:=250/36pt#; % height of caps +fig_height#:=236/36pt#; % height of numerals +x_height#:=160/36pt#; % height of lowercase without ascenders +math_axis#:=90/36pt#; % axis of symmetry for math symbols +bar_height#:=79/36pt#; % height of crossbar in lowercase e +comma_depth#:=45/36pt#; % depth of comma below baseline +desc_depth#:=70/36pt#; % depth of lowercase descenders + +crisp#:=0pt#; % diameter of serif corners +tiny#:=0pt#; % diameter of rounded corners +fine#:=0pt#; % diameter of sharply rounded corners +thin_join#:=17/36pt#; % width of extrafine details +hair#:=28/36pt#; % lowercase hairline breadth +stem#:=28/36pt#; % lowercase stem breadth +curve#:=28/36pt#; % lowercase curve breadth +ess#:=28/36pt#; % breadth in middle of lowercase s +flare#:=25/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=30/36pt#; % diameter of dots +cap_hair#:=28/36pt#; % uppercase hairline breadth +cap_stem#:=32/36pt#; % uppercase stem breadth +cap_curve#:=32/36pt#; % uppercase curve breadth +cap_ess#:=32/36pt#; % breadth in middle of uppercase s +%rule_thickness#:=.4pt#; % thickness of lines in math symbols +rule_thickness#:=.8pt#; % thickness of lines in math symbols + +dish#:=0pt#; % amount erased at top or bottom of serifs +bracket#:=0pt#; % vertical distance from serif base to tangent +jut#:=0pt#; % protrusion of lowercase serifs +cap_jut#:=0pt#; % protrusion of uppercase serifs +beak_jut#:=0pt#; % horizontal protrusion of beak serifs +beak#:=.5/36pt#; % vertical protrusion of beak serifs +vair#:=22/36pt#; % vertical diameter of hairlines +%notch_cut#:=18/36pt#; % maximum breadth above or below notches +notch_cut#:=17pt#; % maximum breadth above or below notches drh +bar#:=21/36pt#; % lowercase bar thickness +slab#:=23/36pt#; % serif and arm thickness +cap_bar#:=22/36pt#; % uppercase bar thickness +cap_band#:=20/36pt#; % uppercase thickness above/below lobes +%cap_notch_cut#:=25/36pt#; % max breadth above/below uppercase notches +cap_notch_cut#:=17pt#; % max breadth above/below uppercase notches drh +serif_drop#:=2/36pt#; % vertical drop of sloped serifs +stem_corr#:=1/36pt#; % for small refinements of stem breadth +vair_corr#:=1/36pt#; % for small refinements of hairline height +apex_corr#:=5/36pt#; % extra width at diagonal junctions + +o#:=8/36pt#; % amount of overshoot for curves +apex_o#:=0pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=.96; % factor applied to weights of heavy characters +math_spread:=0; % extra openness of math symbols +superness:=1/sqrt 2; % parameter for superellipses +superpull:=1/20; % extra openness inside bowls +beak_darkness:=0; % fraction of triangle inside beak serifs +ligs:=2; % level of ligatures to be included + +square_dots:=true; % should dots be square? +hefty:=true; % should we try hard not to be overweight? +serifs:=false; % should serifs and bulbs be attached? +monospace:=false; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=false; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file + diff --git a/support/rtflatex/mf/cmoss12.mf b/support/rtflatex/mf/cmoss12.mf new file mode 100644 index 0000000000..c30ac35f33 --- /dev/null +++ b/support/rtflatex/mf/cmoss12.mf @@ -0,0 +1,83 @@ +% This is OCMSS12.MF in text format, as of Mar 31, 1986. +% Computer Modern Sans Serif 12 pt +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +outlining:=true; % make "outline" characters for this run + +font_identifier:="CMOSS"; font_size 12pt#; + +u#:=23.5/36pt#; % unit width +width_adj#:=17/36pt#; % width adjustment for certain characters +serif_fit#:=-9/36pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=-13/36pt#; % extra sidebar near uppercase serifs +letter_fit#:=0pt#; % extra space added to all sidebars + +body_height#:=324/36pt#; % height of tallest characters +asc_height#:=300/36pt#; % height of lowercase ascenders +cap_height#:=300/36pt#; % height of caps +fig_height#:=283/36pt#; % height of numerals +x_height#:=192/36pt#; % height of lowercase without ascenders +math_axis#:=108/36pt#; % axis of symmetry for math symbols +bar_height#:=97/36pt#; % height of crossbar in lowercase e +comma_depth#:=54/36pt#; % depth of comma below baseline +desc_depth#:=84/36pt#; % depth of lowercase descenders + +crisp#:=0pt#; % diameter of serif corners +tiny#:=0pt#; % diameter of rounded corners +fine#:=0pt#; % diameter of sharply rounded corners +thin_join#:=20/36pt#; % width of extrafine details +hair#:=33/36pt#; % lowercase hairline breadth +stem#:=33/36pt#; % lowercase stem breadth +curve#:=33/36pt#; % lowercase curve breadth +ess#:=33/36pt#; % breadth in middle of lowercase s +flare#:=30/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=35/36pt#; % diameter of dots +cap_hair#:=33/36pt#; % uppercase hairline breadth +cap_stem#:=37/36pt#; % uppercase stem breadth +cap_curve#:=37/36pt#; % uppercase curve breadth +cap_ess#:=37/36pt#; % breadth in middle of uppercase s +%rule_thickness#:=.44pt#; % thickness of lines in math symbols +rule_thickness#:=.84pt#; % thickness of lines in math symbols drh + +dish#:=0pt#; % amount erased at top or bottom of serifs +bracket#:=0pt#; % vertical distance from serif base to tangent +jut#:=0pt#; % protrusion of lowercase serifs +cap_jut#:=0pt#; % protrusion of uppercase serifs +beak_jut#:=0pt#; % horizontal protrusion of beak serifs +beak#:=.6/36pt#; % vertical protrusion of beak serifs +vair#:=26/36pt#; % vertical diameter of hairlines +%notch_cut#:=22/36pt#; % maximum breadth above or below notches +notch_cut#:=17pt#; % maximum breadth above or below notches drh +bar#:=25/36pt#; % lowercase bar thickness +slab#:=27/36pt#; % serif and arm thickness +cap_bar#:=26/36pt#; % uppercase bar thickness +cap_band#:=24/36pt#; % uppercase thickness above/below lobes +%cap_notch_cut#:=31/36pt#; % max breadth above/below uppercase notches +cap_notch_cut#:=17pt#; % max breadth above/below uppercase notches drh +serif_drop#:=2/36pt#; % vertical drop of sloped serifs +stem_corr#:=1/36pt#; % for small refinements of stem breadth +vair_corr#:=1/36pt#; % for small refinements of hairline height +apex_corr#:=6/36pt#; % extra width at diagonal junctions + +o#:=9/36pt#; % amount of overshoot for curves +apex_o#:=0pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=.98; % factor applied to weights of heavy characters +math_spread:=-0.2; % extra openness of math symbols +superness:=1/sqrt 2; % parameter for superellipses +superpull:=1/20; % extra openness inside bowls +beak_darkness:=0; % fraction of triangle inside beak serifs +ligs:=2; % level of ligatures to be included + +square_dots:=true; % should dots be square? +hefty:=true; % should we try hard not to be overweight? +serifs:=false; % should serifs and bulbs be attached? +monospace:=false; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=false; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file + diff --git a/support/rtflatex/mf/cmoss17.mf b/support/rtflatex/mf/cmoss17.mf new file mode 100644 index 0000000000..927da821a5 --- /dev/null +++ b/support/rtflatex/mf/cmoss17.mf @@ -0,0 +1,82 @@ +% This is OCMSS17.MF in text format, as of May 5, 1986. +% Computer Modern Sans Serif 17 pt (more or less) +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +outlining:=true; % make "outline" characters for this run + +font_identifier:="CMOSS"; font_size 17.28pt#; + +u#:=32.5/36pt#; % unit width +width_adj#:=24/36pt#; % width adjustment for certain characters +serif_fit#:=-12/36pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=-17/36pt#; % extra sidebar near uppercase serifs +letter_fit#:=0pt#; % extra space added to all sidebars + +body_height#:=466/36pt#; % height of tallest characters +asc_height#:=432/36pt#; % height of lowercase ascenders +cap_height#:=432/36pt#; % height of caps +fig_height#:=408/36pt#; % height of numerals +x_height#:=267.8/36pt#; % height of lowercase without ascenders +math_axis#:=155.5/36pt#; % axis of symmetry for math symbols +bar_height#:=136/36pt#; % height of crossbar in lowercase e +comma_depth#:=78/36pt#; % depth of comma below baseline +desc_depth#:=121/36pt#; % depth of lowercase descenders + +crisp#:=0pt#; % diameter of serif corners +tiny#:=0pt#; % diameter of rounded corners +fine#:=0pt#; % diameter of sharply rounded corners +thin_join#:=28/36pt#; % width of extrafine details +hair#:=47/36pt#; % lowercase hairline breadth +stem#:=47/36pt#; % lowercase stem breadth +curve#:=47/36pt#; % lowercase curve breadth +ess#:=47/36pt#; % breadth in middle of lowercase s +flare#:=42/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=50/36pt#; % diameter of dots +cap_hair#:=47/36pt#; % uppercase hairline breadth +cap_stem#:=52/36pt#; % uppercase stem breadth +cap_curve#:=52/36pt#; % uppercase curve breadth +cap_ess#:=52/36pt#; % breadth in middle of uppercase s +rule_thickness#:=1pt#; % was .6pt# drh; % thickness of lines in math symbols + +dish#:=0pt#; % amount erased at top or bottom of serifs +bracket#:=0pt#; % vertical distance from serif base to tangent +jut#:=0pt#; % protrusion of lowercase serifs +cap_jut#:=0pt#; % protrusion of uppercase serifs +beak_jut#:=0pt#; % horizontal protrusion of beak serifs +beak#:=.8/36pt#; % vertical protrusion of beak serifs +vair#:=38/36pt#; % vertical diameter of hairlines +% notch_cut#:=32/36pt#; % maximum breadth above or below notches +notch_cut#:=17pt#; % maximum breadth above or below notches drh +bar#:=36/36pt#; % lowercase bar thickness +slab#:=40/36pt#; % serif and arm thickness +cap_bar#:=38/36pt#; % uppercase bar thickness +cap_band#:=35/36pt#; % uppercase thickness above/below lobes +% cap_notch_cut#:=46/36pt#; % max breadth above/below uppercase notches +cap_notch_cut#:=17pt#; % max breadth above/below uppercase notches drh +serif_drop#:=2/36pt#; % vertical drop of sloped serifs +stem_corr#:=1/36pt#; % for small refinements of stem breadth +vair_corr#:=1/36pt#; % for small refinements of hairline height +apex_corr#:=7/36pt#; % extra width at diagonal junctions + +o#:=10/36pt#; % amount of overshoot for curves +apex_o#:=0pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=1; % factor applied to weights of heavy characters +math_spread:=-0.4; % extra openness of math symbols +superness:=1/sqrt 2; % parameter for superellipses +superpull:=1/20; % extra openness inside bowls +beak_darkness:=0; % fraction of triangle inside beak serifs +ligs:=2; % level of ligatures to be included + +square_dots:=true; % should dots be square? +hefty:=true; % should we try hard not to be overweight? +serifs:=false; % should serifs and bulbs be attached? +monospace:=false; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=false; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file + diff --git a/support/rtflatex/mf/cmoss8.mf b/support/rtflatex/mf/cmoss8.mf new file mode 100644 index 0000000000..559fe5b5a8 --- /dev/null +++ b/support/rtflatex/mf/cmoss8.mf @@ -0,0 +1,83 @@ +% This is OCMSS8.MF in text format, as of Sept. 10, 1988. +% Computer Modern Sans Serif Outline 8 pt +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +outlining:=true; + +font_identifier:="OCMSS"; font_size 8pt#; + +u#:=17/36pt#; % unit width +width_adj#:=12/36pt#; % width adjustment for certain characters +serif_fit#:=-6/36pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=-8.5/36pt#; % extra sidebar near uppercase serifs +letter_fit#:=0pt#; % extra space added to all sidebars + +body_height#:=216/36pt#; % height of tallest characters +asc_height#:=200/36pt#; % height of lowercase ascenders +cap_height#:=200/36pt#; % height of caps +fig_height#:=189/36pt#; % height of numerals +x_height#:=128/36pt#; % height of lowercase without ascenders +math_axis#:=72/36pt#; % axis of symmetry for math symbols +bar_height#:=63/36pt#; % height of crossbar in lowercase e +comma_depth#:=37/36pt#; % depth of comma below baseline +desc_depth#:=56/36pt#; % depth of lowercase descenders + +crisp#:=0pt#; % diameter of serif corners +tiny#:=0pt#; % diameter of rounded corners +fine#:=0pt#; % diameter of sharply rounded corners +thin_join#:=15/36pt#; % width of extrafine details +hair#:=25/36pt#; % lowercase hairline breadth +stem#:=25/36pt#; % lowercase stem breadth +curve#:=25/36pt#; % lowercase curve breadth +ess#:=25/36pt#; % breadth in middle of lowercase s +flare#:=22/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=26/36pt#; % diameter of dots +cap_hair#:=25/36pt#; % uppercase hairline breadth +cap_stem#:=29/36pt#; % uppercase stem breadth +cap_curve#:=29/36pt#; % uppercase curve breadth +cap_ess#:=28/36pt#; % breadth in middle of uppercase s +%rule_thickness#:=.36pt#; % thickness of lines in math symbols +rule_thickness#:=.46pt#; % thickness of lines in math symbols + +dish#:=0pt#; % amount erased at top or bottom of serifs +bracket#:=0pt#; % vertical distance from serif base to tangent +jut#:=0pt#; % protrusion of lowercase serifs +cap_jut#:=0pt#; % protrusion of uppercase serifs +beak_jut#:=0pt#; % horizontal protrusion of beak serifs +beak#:=.4/36pt#; % vertical protrusion of beak serifs +vair#:=19/36pt#; % vertical diameter of hairlines +%notch_cut#:=16/36pt#; % maximum breadth above or below notches +notch_cut#:=17pt#; % maximum breadth above or below notches drh +bar#:=18/36pt#; % lowercase bar thickness +slab#:=20/36pt#; % serif and arm thickness +cap_bar#:=19/36pt#; % uppercase bar thickness +cap_band#:=17/36pt#; % uppercase thickness above/below lobes +%cap_notch_cut#:=22/36pt#; % max breadth above/below uppercase notches +cap_notch_cut#:=17pt#; % max breadth above/below uppercase notches drh +serif_drop#:=2/36pt#; % vertical drop of sloped serifs +stem_corr#:=1/36pt#; % for small refinements of stem breadth +vair_corr#:=1/36pt#; % for small refinements of hairline height +apex_corr#:=4/36pt#; % extra width at diagonal junctions + +o#:=6/36pt#; % amount of overshoot for curves +apex_o#:=0pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=.93; % factor applied to weights of heavy characters +math_spread:=.4; % extra openness of math symbols +superness:=1/sqrt 2; % parameter for superellipses +superpull:=1/20; % extra openness inside bowls +beak_darkness:=0; % fraction of triangle inside beak serifs +ligs:=2; % level of ligatures to be included + +square_dots:=true; % should dots be square? +hefty:=true; % should we try hard not to be overweight? +serifs:=false; % should serifs and bulbs be attached? +monospace:=false; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=false; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file + diff --git a/support/rtflatex/mf/cmossb10.mf b/support/rtflatex/mf/cmossb10.mf new file mode 100644 index 0000000000..1c65abcc0f --- /dev/null +++ b/support/rtflatex/mf/cmossb10.mf @@ -0,0 +1,82 @@ +% This is CMOSSB10.MF in text format, as of Mar 31, 1986. +% Computer Modern Sans Serif Bold Extended 10 pt +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +outlining:=true; % make "outline" characters for this run + +font_identifier:="CMOSSB"; font_size 10pt#; + +u#:=22/36pt#; % unit width +width_adj#:=22/36pt#; % width adjustment for certain characters +serif_fit#:=-9/36pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=-11/36pt#; % extra sidebar near uppercase serifs +letter_fit#:=0pt#; % extra space added to all sidebars + +body_height#:=270/36pt#; % height of tallest characters +asc_height#:=250/36pt#; % height of lowercase ascenders +cap_height#:=250/36pt#; % height of caps +fig_height#:=250/36pt#; % height of numerals +x_height#:=165/36pt#; % height of lowercase without ascenders +math_axis#:=90/36pt#; % axis of symmetry for math symbols +bar_height#:=90/36pt#; % height of crossbar in lowercase e +comma_depth#:=38/36pt#; % depth of comma below baseline +desc_depth#:=70/36pt#; % depth of lowercase descenders + +crisp#:=26/36pt#; % diameter of serif corners +tiny#:=26/36pt#; % diameter of rounded corners +fine#:=9/36pt#; % diameter of sharply rounded corners +thin_join#:=9/36pt#; % width of extrafine details +hair#:=49/36pt#; % lowercase hairline breadth +stem#:=49/36pt#; % lowercase stem breadth +curve#:=49/36pt#; % lowercase curve breadth +ess#:=43/36pt#; % breadth in middle of lowercase s +flare#:=40/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=47/36pt#; % diameter of dots +cap_hair#:=49/36pt#; % uppercase hairline breadth +cap_stem#:=53/36pt#; % uppercase stem breadth +cap_curve#:=53/36pt#; % uppercase curve breadth +cap_ess#:=51/36pt#; % breadth in middle of uppercase s +% rule_thickness#:=30/36pt#; % thickness of lines in math symbols +rule_thickness#:=50/36pt#; % thickness of lines in math symbols + +dish#:=0pt#; % amount erased at top or bottom of serifs +bracket#:=0pt#; % vertical distance from serif base to tangent +jut#:=0pt#; % protrusion of lowercase serifs +cap_jut#:=0pt#; % protrusion of uppercase serifs +beak_jut#:=0pt#; % horizontal protrusion of beak serifs +beak#:=1.5/36pt#; % vertical protrusion of beak serifs +vair#:=26/36pt#; % vertical diameter of hairlines +%notch_cut#:=49/36pt#; % maximum breadth above or below notches +notch_cut#:=17pt#; % maximum breadth above or below notches drh +bar#:=26/36pt#; % lowercase bar thickness +slab#:=36/36pt#; % serif and arm thickness +cap_bar#:=34/36pt#; % uppercase bar thickness +cap_band#:=31/36pt#; % uppercase thickness above/below lobes +%cap_notch_cut#:=45/36pt#; % max breadth above/below uppercase notches +cap_notch_cut#:=17pt#; % maximum breadth above or below notches drh +serif_drop#:=2/36pt#; % vertical drop of sloped serifs +stem_corr#:=1/36pt#; % for small refinements of stem breadth +vair_corr#:=2/36pt#; % for small refinements of hairline height +apex_corr#:=18/36pt#; % extra width at diagonal junctions + +o#:=8/36pt#; % amount of overshoot for curves +apex_o#:=0pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=.88; % factor applied to weights of heavy characters +math_spread:=.5; % extra openness of math symbols +superness:=3/4; % parameter for superellipses +superpull:=1/18; % extra openness inside bowls +beak_darkness:=0; % fraction of triangle inside beak serifs +ligs:=2; % level of ligatures to be included + +square_dots:=true; % should dots be square? +hefty:=true; % should we try hard not to be overweight? +serifs:=false; % should serifs and bulbs be attached? +monospace:=false; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=false; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file diff --git a/support/rtflatex/mf/cmoti12.mf b/support/rtflatex/mf/cmoti12.mf new file mode 100644 index 0000000000..8023c0f855 --- /dev/null +++ b/support/rtflatex/mf/cmoti12.mf @@ -0,0 +1,81 @@ +% This is OCMTI12.MF in text format, as of Sept. 10, 1988. +% Computer Modern Text Italic Outline 12 point +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +font_identifier:="OCMTI"; font_size 12pt#; + +u#:=21.6/36pt#; % unit width +width_adj#:=0pt#; % width adjustment for certain characters +serif_fit#:=0pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=5.8/36pt#; % extra sidebar near uppercase serifs +letter_fit#:=10.8/36pt#; % extra space added to all sidebars + +body_height#:=324/36pt#; % height of tallest characters +asc_height#:=300/36pt#; % height of lowercase ascenders +cap_height#:=295.2/36pt#; % height of caps +fig_height#:=278.4/36pt#; % height of numerals +x_height#:=186/36pt#; % height of lowercase without ascenders +math_axis#:=108/36pt#; % axis of symmetry for math symbols +bar_height#:=104.4/36pt#; % height of crossbar in lowercase e +comma_depth#:=84/36pt#; % depth of comma below baseline +desc_depth#:=84/36pt#; % depth of lowercase descenders + +crisp#:=8/36pt#; % diameter of serif corners +tiny#:=8/36pt#; % diameter of rounded corners +fine#:=7/36pt#; % diameter of sharply rounded corners +thin_join#:=7.5/36pt#; % width of extrafine details +hair#:=12/36pt#; % lowercase hairline breadth +stem#:=26/36pt#; % lowercase stem breadth +curve#:=31/36pt#; % lowercase curve breadth +ess#:=29/36pt#; % breadth in middle of lowercase s +flare#:=32/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=42/36pt#; % diameter of dots +cap_hair#:=11.5/36pt#; % uppercase hairline breadth +cap_stem#:=32/36pt#; % uppercase stem breadth +cap_curve#:=37/36pt#; % uppercase curve breadth +cap_ess#:=34/36pt#; % breadth in middle of uppercase s +%rule_thickness#:=.44pt#; % thickness of lines in math symbols +rule_thickness#:=.66pt#; % thickness of lines in math symbols + +dish#:=1/36pt#; % amount erased at top or bottom of serifs +bracket#:=24/36pt#; % vertical distance from serif base to tangent +jut#:=35/36pt#; % protrusion of lowercase serifs +cap_jut#:=38/36pt#; % protrusion of uppercase serifs +beak_jut#:=10.4/36pt#; % horizontal protrusion of beak serifs +beak#:=84/36pt#; % vertical protrusion of beak serifs +vair#:=8.5/36pt#; % vertical diameter of hairlines +%notch_cut#:=12pt#; % maximum breadth above or below notches +notch_cut#:=17pt#; % maximum breadth above or below notches drh +bar#:=12.5/36pt#; % lowercase bar thickness +slab#:=12.5/36pt#; % serif and arm thickness +cap_bar#:=12.5/36pt#; % uppercase bar thickness +cap_band#:=12.5/36pt#; % uppercase thickness above/below lobes +%cap_notch_cut#:=12pt#; % max breadth above/below uppercase notches +cap_notch_cut#:=17pt#; % max breadth above/below uppercase notches drh +serif_drop#:=4.8/36pt#; % vertical drop of sloped serifs +stem_corr#:=1/36pt#; % for small refinements of stem breadth +vair_corr#:=1/36pt#; % for small refinements of hairline height +apex_corr#:=0pt#; % extra width at diagonal junctions + +o#:=9/36pt#; % amount of overshoot for curves +apex_o#:=9/36pt#; % amount of overshoot for diagonal junctions + +slant:=.25; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=1; % factor applied to weights of heavy characters +math_spread:=-0.2; % extra openness of math symbols +superness:=1/sqrt2; % parameter for superellipses +superpull:=1/6; % extra openness inside bowls +beak_darkness:=11/30; % fraction of triangle inside beak serifs +ligs:=2; % level of ligatures to be included + +square_dots:=false; % should dots be square? +hefty:=false; % should we try hard not to be overweight? +serifs:=true; % should serifs and bulbs be attached? +monospace:=false; % should all characters have the same width? +variant_g:=true; % should an italic-style g be used? +low_asterisk:=false; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate textit % switch to the driver file + diff --git a/support/rtflatex/mf/cmott10.mf b/support/rtflatex/mf/cmott10.mf new file mode 100644 index 0000000000..aa16ad9179 --- /dev/null +++ b/support/rtflatex/mf/cmott10.mf @@ -0,0 +1,80 @@ +% This is OCMTT10.MF in text format, as of January 26, 1989. +% Computer Modern Outline Typewriter Text for use with 10 point +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +font_identifier:="CMOTT"; font_size 10pt#; + +u#:=21/36pt#; % unit width +width_adj#:=0pt#; % width adjustment for certain characters +serif_fit#:=0pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=0pt#; % extra sidebar near uppercase serifs +letter_fit#:=0pt#; % extra space added to all sidebars + +body_height#:=250/36pt#; % height of tallest characters +asc_height#:=220/36pt#; % height of lowercase ascenders +cap_height#:=220/36pt#; % height of caps +fig_height#:=220/36pt#; % height of numerals +x_height#:=155/36pt#; % height of lowercase without ascenders +math_axis#:=110/36pt#; % axis of symmetry for math symbols +bar_height#:=79/36pt#; % height of crossbar in lowercase e +comma_depth#:=50/36pt#; % depth of comma below baseline +desc_depth#:=80/36pt#; % depth of lowercase descenders + +crisp#:=22/36pt#; % diameter of serif corners +tiny#:=22/36pt#; % diameter of rounded corners +fine#:=21/36pt#; % diameter of sharply rounded corners +thin_join#:=21/36pt#; % width of extrafine details +hair#:=25/36pt#; % lowercase hairline breadth +stem#:=25/36pt#; % lowercase stem breadth +curve#:=25/36pt#; % lowercase curve breadth +ess#:=22/36pt#; % breadth in middle of lowercase s +flare#:=32/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=36/36pt#; % diameter of dots +cap_hair#:=25/36pt#; % uppercase hairline breadth +cap_stem#:=25/36pt#; % uppercase stem breadth +cap_curve#:=25/36pt#; % uppercase curve breadth +cap_ess#:=25/36pt#; % breadth in middle of uppercase s +rule_thickness#:=25/36pt#; % thickness of lines in math symbols + +dish#:=0pt#; % amount erased at top or bottom of serifs +bracket#:=0pt#; % vertical distance from serif base to tangent +jut#:=34/36pt#; % protrusion of lowercase serifs +cap_jut#:=34/36pt#; % protrusion of uppercase serifs +beak_jut#:=0pt#; % horizontal protrusion of beak serifs +beak#:=34/36pt#; % vertical protrusion of beak serifs +vair#:=22/36pt#; % vertical diameter of hairlines +%notch_cut#:=25/36pt#; % maximum breadth above or below notches -drh- +notch_cut#:=30/36pt#; % maximum breadth above or below notches +bar#:=22/36pt#; % lowercase bar thickness +slab#:=22/36pt#; % serif and arm thickness +cap_bar#:=22/36pt#; % uppercase bar thickness +cap_band#:=22/36pt#; % uppercase thickness above/below lobes +%cap_notch_cut#:=25/36pt#; % max breadth above/below uppercase notches -drh- +cap_notch_cut#:=30/36pt#; % max breadth above/below uppercase notches +serif_drop#:=0pt#; % vertical drop of sloped serifs +stem_corr#:=0pt#; % for small refinements of stem breadth +vair_corr#:=0pt#; % for small refinements of hairline height +apex_corr#:=10/36pt#; % extra width at diagonal junctions + +o#:=4/36pt#; % amount of overshoot for curves +apex_o#:=3/36pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=0.81; % factor applied to weights of heavy characters +math_spread:=-1; % extra openness of math symbols +superness:=1/sqrt2; % parameter for superellipses +superpull:=0; % extra openness inside bowls +beak_darkness:=0; % fraction of triangle inside beak serifs +ligs:=0; % level of ligatures to be included + +square_dots:=false; % should dots be square? +hefty:=true; % should we try hard not to be overweight? +serifs:=true; % should serifs and bulbs be attached? +monospace:=true; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=true; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file + diff --git a/support/rtflatex/mf/cmott12.mf b/support/rtflatex/mf/cmott12.mf new file mode 100644 index 0000000000..f388b44f7e --- /dev/null +++ b/support/rtflatex/mf/cmott12.mf @@ -0,0 +1,80 @@ +% This is OCMTT12.MF in text format, as of January 26, 1989. +% Computer Modern Outline Typewriter Text for use with 12 point +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +font_identifier:="CMOTT"; font_size 12pt#; + +u#:=24.7/36pt#; % unit width +width_adj#:=0pt#; % width adjustment for certain characters +serif_fit#:=0pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=0pt#; % extra sidebar near uppercase serifs +letter_fit#:=0pt#; % extra space added to all sidebars + +body_height#:=300/36pt#; % height of tallest characters +asc_height#:=264/36pt#; % height of lowercase ascenders +cap_height#:=264/36pt#; % height of caps +fig_height#:=264/36pt#; % height of numerals +x_height#:=186/36pt#; % height of lowercase without ascenders +math_axis#:=132/36pt#; % axis of symmetry for math symbols +bar_height#:=95/36pt#; % height of crossbar in lowercase e +comma_depth#:=60/36pt#; % depth of comma below baseline +desc_depth#:=96/36pt#; % depth of lowercase descenders + +crisp#:=25/36pt#; % diameter of serif corners +tiny#:=25/36pt#; % diameter of rounded corners +fine#:=22/36pt#; % diameter of sharply rounded corners +thin_join#:=22/36pt#; % width of extrafine details +hair#:=28/36pt#; % lowercase hairline breadth +stem#:=28/36pt#; % lowercase stem breadth +curve#:=28/36pt#; % lowercase curve breadth +ess#:=25/36pt#; % breadth in middle of lowercase s +flare#:=35/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=39/36pt#; % diameter of dots +cap_hair#:=28/36pt#; % uppercase hairline breadth +cap_stem#:=28/36pt#; % uppercase stem breadth +cap_curve#:=28/36pt#; % uppercase curve breadth +cap_ess#:=28/36pt#; % breadth in middle of uppercase s +rule_thickness#:=28/36pt#; % thickness of lines in math symbols + +dish#:=0pt#; % amount erased at top or bottom of serifs +bracket#:=0pt#; % vertical distance from serif base to tangent +jut#:=39/36pt#; % protrusion of lowercase serifs +cap_jut#:=39/36pt#; % protrusion of uppercase serifs +beak_jut#:=0pt#; % horizontal protrusion of beak serifs +beak#:=39/36pt#; % vertical protrusion of beak serifs +vair#:=25/36pt#; % vertical diameter of hairlines +%notch_cut#:=28/36pt#; % maximum breadth above or below notches -drh- +notch_cut#:=32/36pt#; % maximum breadth above or below notches +bar#:=25/36pt#; % lowercase bar thickness +slab#:=25/36pt#; % serif and arm thickness +cap_bar#:=25/36pt#; % uppercase bar thickness +cap_band#:=25/36pt#; % uppercase thickness above/below lobes +%cap_notch_cut#:=28/36pt#; % max breadth above/below uppercase notches +cap_notch_cut#:=32/36pt#; % max breadth above/below uppercase notches +serif_drop#:=0pt#; % vertical drop of sloped serifs +stem_corr#:=0pt#; % for small refinements of stem breadth +vair_corr#:=0pt#; % for small refinements of hairline height +apex_corr#:=11/36pt#; % extra width at diagonal junctions + +o#:=5/36pt#; % amount of overshoot for curves +apex_o#:=4/36pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=0.86; % factor applied to weights of heavy characters +math_spread:=-1; % extra openness of math symbols +superness:=1/sqrt2; % parameter for superellipses +superpull:=0; % extra openness inside bowls +beak_darkness:=0; % fraction of triangle inside beak serifs +ligs:=0; % level of ligatures to be included + +square_dots:=false; % should dots be square? +hefty:=true; % should we try hard not to be overweight? +serifs:=true; % should serifs and bulbs be attached? +monospace:=true; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=true; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file + diff --git a/support/rtflatex/mf/cmott9.mf b/support/rtflatex/mf/cmott9.mf new file mode 100644 index 0000000000..d11af379b7 --- /dev/null +++ b/support/rtflatex/mf/cmott9.mf @@ -0,0 +1,81 @@ +% This is OCMTT9.MF in text format, as of January 26, 1989. +% Computer Modern Outline Typewriter Text for use with 9 point +if unknown cmbase: input cmbase fi +input outlines % Line added 5/7/89 + +font_identifier:="CMOTT"; font_size 9pt#; + +u#:=18.9/36pt#; % unit width +width_adj#:=0pt#; % width adjustment for certain characters +serif_fit#:=0pt#; % extra sidebar near lowercase serifs +cap_serif_fit#:=0pt#; % extra sidebar near uppercase serifs +letter_fit#:=0pt#; % extra space added to all sidebars + +body_height#:=225/36pt#; % height of tallest characters +asc_height#:=198/36pt#; % height of lowercase ascenders +cap_height#:=198/36pt#; % height of caps +fig_height#:=198/36pt#; % height of numerals +x_height#:=139.5/36pt#; % height of lowercase without ascenders +math_axis#:=99/36pt#; % axis of symmetry for math symbols +bar_height#:=71/36pt#; % height of crossbar in lowercase e +comma_depth#:=45/36pt#; % depth of comma below baseline +desc_depth#:=72/36pt#; % depth of lowercase descenders + +crisp#:=21/36pt#; % diameter of serif corners +tiny#:=21/36pt#; % diameter of rounded corners +fine#:=20/36pt#; % diameter of sharply rounded corners +thin_join#:=20/36pt#; % width of extrafine details +hair#:=24/36pt#; % lowercase hairline breadth +stem#:=24/36pt#; % lowercase stem breadth +curve#:=24/36pt#; % lowercase curve breadth +ess#:=21/36pt#; % breadth in middle of lowercase s +flare#:=30/36pt#; % diameter of bulbs or breadth of terminals +dot_size#:=33/36pt#; % diameter of dots +cap_hair#:=24/36pt#; % uppercase hairline breadth +cap_stem#:=24/36pt#; % uppercase stem breadth +cap_curve#:=24/36pt#; % uppercase curve breadth +cap_ess#:=24/36pt#; % breadth in middle of uppercase s +rule_thickness#:=24/36pt#; % thickness of lines in math symbols + +dish#:=0pt#; % amount erased at top or bottom of serifs +bracket#:=0pt#; % vertical distance from serif base to tangent +jut#:=31/36pt#; % protrusion of lowercase serifs +cap_jut#:=31/36pt#; % protrusion of uppercase serifs +beak_jut#:=0pt#; % horizontal protrusion of beak serifs +beak#:=31/36pt#; % vertical protrusion of beak serifs +vair#:=21/36pt#; % vertical diameter of hairlines +%notch_cut#:=24/36pt#; % maximum breadth above or below notches -drh- +notch_cut#:=30/36pt#; % maximum breadth above or below notches +bar#:=21/36pt#; % lowercase bar thickness +slab#:=21/36pt#; % serif and arm thickness +cap_bar#:=21/36pt#; % uppercase bar thickness +cap_band#:=21/36pt#; % uppercase thickness above/below lobes +%cap_notch_cut#:=24/36pt#; % max breadth above/below uppercase notches -drh- +cap_notch_cut#:=30/36pt#; % max breadth above/below uppercase notches +serif_drop#:=0pt#; % vertical drop of sloped serifs +stem_corr#:=0pt#; % for small refinements of stem breadth +vair_corr#:=0pt#; % for small refinements of hairline height +apex_corr#:=9/36pt#; % extra width at diagonal junctions + +o#:=3.5/36pt#; % amount of overshoot for curves +apex_o#:=3/36pt#; % amount of overshoot for diagonal junctions + +slant:=0; % tilt ratio $(\Delta x/\Delta y)$ +fudge:=0.81; % factor applied to weights of heavy characters +math_spread:=-1; % extra openness of math symbols +superness:=1/sqrt2; % parameter for superellipses +superpull:=0; % extra openness inside bowls +beak_darkness:=0; % fraction of triangle inside beak serifs +ligs:=0; % level of ligatures to be included + +square_dots:=false; % should dots be square? +hefty:=true; % should we try hard not to be overweight? +serifs:=true; % should serifs and bulbs be attached? +monospace:=true; % should all characters have the same width? +variant_g:=false; % should an italic-style g be used? +low_asterisk:=true; % should the asterisk be centered at the axis? +math_fitting:=false; % should math-mode spacing be used? + +generate roman % switch to the driver file + + diff --git a/support/rtflatex/mf/dcobti10.mf b/support/rtflatex/mf/dcobti10.mf new file mode 100644 index 0000000000..e815aaf8a1 --- /dev/null +++ b/support/rtflatex/mf/dcobti10.mf @@ -0,0 +1,6 @@ +% This is dcobxti10.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=10; +generate dcobxti diff --git a/support/rtflatex/mf/dcobti12.mf b/support/rtflatex/mf/dcobti12.mf new file mode 100644 index 0000000000..4c2b01fadd --- /dev/null +++ b/support/rtflatex/mf/dcobti12.mf @@ -0,0 +1,6 @@ +% This is dcobxti12.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=12; +generate dcobxti diff --git a/support/rtflatex/mf/dcobti17.mf b/support/rtflatex/mf/dcobti17.mf new file mode 100644 index 0000000000..e981e3f14a --- /dev/null +++ b/support/rtflatex/mf/dcobti17.mf @@ -0,0 +1,6 @@ +% This is dcobxti17.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=17; +generate dcobxti diff --git a/support/rtflatex/mf/dcobx.mf b/support/rtflatex/mf/dcobx.mf new file mode 100644 index 0000000000..eaee3bd352 --- /dev/null +++ b/support/rtflatex/mf/dcobx.mf @@ -0,0 +1,91 @@ +% This is DCOBX.MF in text format, as of February 13, 1991 +% +% DC fonts Version 1.0 (prerelease of EC fonts) +% +% [ heavily borrowed from the Computer Modern Roman family of +% fonts by D. E. Knuth ] +% +% Content: +% +% Parameter for +% +% European Computer Modern Bold Extend Roman +% +% +input outlines % Line added 5/7/89 + +outlining:=true; + +font_identifier:="DCOBX"; +font_size (gensize*pt#); +basedef ( 5, 6, 7, 8, 9, 10, 12); +gendef [1/36pt#]( u# )( 14.5, 16.2, 17.9, 19.6, 21.3, 23, 27); +gendef [1/36pt#]( uu# )( 14.5, 16.2, 17.9, 19.6, 21.3, 23, 27); +gendef [1/36pt#]( width_adj# )( 7, 7.8, 8.6, 9.4, 10.2, 11, 13); +gendef [1/36pt#]( serif_fit# )( 0, 0, 0, 0, 0, 0, 0); +gendef [1/36pt#]( cap_serif_fit# )( 3, 3.8, 4.6, 5.4, 6.2, 7, 8); +gendef [1/36pt#]( letter_fit# )( 3, 2, 1, 0, 0, 0, 0); +gendef [1/36pt#]( body_height# )( 135, 162, 189, 216, 243, 270, 324); +gendef [1/36pt#]( asc_height# )( 125, 150, 175, 200, 225, 250, 300); +gendef [1/36pt#]( cap_height# )( 123.5, 148.2, 172.9, 197.6, 222.3, 247, 296.4); +gendef [1/36pt#]( fig_height# )( 116, 139.2, 162.4, 185.6, 208.8, 232, 278.4); +gendef [1/36pt#]( x_height# )( 80, 96, 112, 128, 144, 160, 192); +gendef [1/36pt#]( math_axis# )( 45, 54, 63, 72, 81, 90, 108); +gendef [1/36pt#]( bar_height# )( 40, 49, 58, 67, 76, 85, 102); +gendef [1/36pt#]( comma_depth# )( 35, 42, 49, 56, 63, 70, 84); +gendef [1/36pt#]( desc_depth# )( 35, 42, 49, 56, 63, 70, 84); +gendef [1/36pt#]( acc_height# )( 37.5, 45, 52.5, 60, 67.5, 75, 90); +gendef [1/36pt#]( dot_height# )( 37.5, 45, 52.5, 60, 67.5, 75, 90); +gendef [1/36pt#]( udot_height# )( 29.5, 35.5, 41.3, 47.2, 53.1, 59, 70.8); +gendef [1/36pt#]( crisp# )( 0, 0, 0, 0, 0, 0, 0); +gendef [1/36pt#]( tiny# )( 9, 10, 11, 12, 13, 13, 13); +gendef [1/36pt#]( fine# )( 8, 9, 9, 10, 10, 10, 10); +gendef [1/36pt#]( thin_join# )( 8, 9, 9, 10, 10, 10, 10.5); +gendef [1/36pt#]( hair# )( 15, 15.4, 15.8, 16.2, 16.6, 17, 18.3); +gendef [1/36pt#]( stem# )( 24, 28, 32, 35, 38, 41, 47); +gendef [1/36pt#]( curve# )( 27, 31, 35, 39, 43, 46, 52); +gendef [1/36pt#]( ess# )( 19, 25, 29, 32, 35, 38, 44); +gendef [1/36pt#]( flare# )( 27, 31, 35, 39, 42, 45, 51); +gendef [1/36pt#]( dot_size# )( 31, 36, 41, 46, 51, 56, 62); +gendef [1/36pt#]( cap_hair# )( 17, 18, 18, 19, 19, 19, 20); +gendef [1/36pt#]( cap_stem# )( 28, 33, 38, 43, 47, 51, 57); +gendef [1/36pt#]( cap_curve# )( 31, 36, 41, 46, 51, 55, 61); +gendef [1/36pt#]( cap_ess# )( 24, 31, 37, 43, 48, 53, 59); +% gendef [pt#]( rule_thickness#)( .43, .47, .51, .54, .57, .60, .66); +gendef [pt#]( rule_thickness#)( .8, .8, .83, .86, .88, 1.0, 1.2); +gendef [1/36pt#]( dish# )( .7, .8, .9, 1, 1, 1, 1); +gendef [1/36pt#]( bracket# )( 5, 6, 7, 8, 9, 10, 12); +gendef [1/36pt#]( jut# )( 13, 15, 17, 19, 22, 25, 30); +gendef [1/36pt#]( cap_jut# )( 19, 23, 27, 31, 35, 39, 46); +gendef [1/36pt#]( beak_jut# )( 7, 7.8, 8.6, 9.4, 10.2, 11, 12.4); +gendef [1/36pt#]( beak# )( 25, 36, 46, 55, 63, 70, 84); +gendef [1/36pt#]( vair# )( 10, 11, 11.5, 12, 12.5, 13, 14.3); +% gendef [pt#]( notch_cut# )( 5, 6, 7, 8, 9, 10, 12); +gendef [pt#]( notch_cut# )( 7, 9, 10, 12, 14, 15, 17); +gendef [1/36pt#]( bar# )( 12, 13, 14, 15, 16, 17, 18.5); +gendef [1/36pt#]( slab# )( 12, 13, 14, 15, 16, 17, 18.5); +gendef [1/36pt#]( cap_bar# )( 12, 13, 14, 15, 16, 17, 18.5); +gendef [1/36pt#]( cap_band# )( 12, 13, 14, 15, 16, 17, 18.5); +% gendef [pt#]( cap_notch_cut# )( 5, 6, 7, 8, 9, 10, 12); +gendef [pt#]( cap_notch_cut# )( 7, 9, 10, 12, 14, 15, 17); +gendef [1/36pt#]( serif_drop# )( 1.5, 1.8, 2.1, 2.4, 2.7, 3, 3.6); +gendef [1/36pt#]( stem_corr# )( 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2); +gendef [1/36pt#]( vair_corr# )( 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.5); +gendef [1/36pt#]( apex_corr# )( 9, 5, 2, 0, 0, 0, 0); +gendef [1/36pt#]( o# )( 3, 3, 3, 4, 4, 4, 5); +gendef [1/36pt#]( apex_o# )( 3, 3, 3, 3, 3, 3, 4); +gendef ( slant )( 0, 0, 0, 0, 0, 0, 0); +gendef ( fudge )( 1, 1, 1, 1, 1, 1, 1); +gendef ( math_spread )( 1.5, 1.3, 1.1, .9, .7, .5, .4); +gendef ( ligs )( 2, 2, 2, 2, 2, 2, 2); +superness:=8/11; +superpull:=1/8; +beak_darkness:=.4; +square_dots:=false; +hefty:=false; +serifs:=true; +monospace:=false; +variant_g:=false; +low_asterisk:=false; +math_fitting:=false; +generate dxroman diff --git a/support/rtflatex/mf/dcobx10.mf b/support/rtflatex/mf/dcobx10.mf new file mode 100644 index 0000000000..9b1d490ebd --- /dev/null +++ b/support/rtflatex/mf/dcobx10.mf @@ -0,0 +1,6 @@ +% This is dcobx10.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=10; +generate dcobx diff --git a/support/rtflatex/mf/dcobx12.mf b/support/rtflatex/mf/dcobx12.mf new file mode 100644 index 0000000000..98cf61981d --- /dev/null +++ b/support/rtflatex/mf/dcobx12.mf @@ -0,0 +1,6 @@ +% This is dcobx12.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=12; +generate dcobx diff --git a/support/rtflatex/mf/dcobx5.mf b/support/rtflatex/mf/dcobx5.mf new file mode 100644 index 0000000000..a6f83308ca --- /dev/null +++ b/support/rtflatex/mf/dcobx5.mf @@ -0,0 +1,6 @@ +% This is dcobx5.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=5; +generate dcobx diff --git a/support/rtflatex/mf/dcobx6.mf b/support/rtflatex/mf/dcobx6.mf new file mode 100644 index 0000000000..a94170a421 --- /dev/null +++ b/support/rtflatex/mf/dcobx6.mf @@ -0,0 +1,6 @@ +% This is dcobx6.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=6; +generate dcobx diff --git a/support/rtflatex/mf/dcobx7.mf b/support/rtflatex/mf/dcobx7.mf new file mode 100644 index 0000000000..07341f5f52 --- /dev/null +++ b/support/rtflatex/mf/dcobx7.mf @@ -0,0 +1,6 @@ +% This is dcobx7.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=7; +generate dcobx diff --git a/support/rtflatex/mf/dcobx8.mf b/support/rtflatex/mf/dcobx8.mf new file mode 100644 index 0000000000..139b1838d5 --- /dev/null +++ b/support/rtflatex/mf/dcobx8.mf @@ -0,0 +1,6 @@ +% This is dcobx8.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=8; +generate dcobx diff --git a/support/rtflatex/mf/dcobx9.mf b/support/rtflatex/mf/dcobx9.mf new file mode 100644 index 0000000000..8b6e64cb19 --- /dev/null +++ b/support/rtflatex/mf/dcobx9.mf @@ -0,0 +1,6 @@ +% This is dcobx9.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=9; +generate dcobx diff --git a/support/rtflatex/mf/dcobxs10.mf b/support/rtflatex/mf/dcobxs10.mf new file mode 100644 index 0000000000..a6ac880328 --- /dev/null +++ b/support/rtflatex/mf/dcobxs10.mf @@ -0,0 +1,6 @@ +% This is dcobxsl10.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=10; +generate dcobxsl diff --git a/support/rtflatex/mf/dcobxs12.mf b/support/rtflatex/mf/dcobxs12.mf new file mode 100644 index 0000000000..3f25725466 --- /dev/null +++ b/support/rtflatex/mf/dcobxs12.mf @@ -0,0 +1,6 @@ +% This is dcobxsl12.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=12; +generate dcobxsl diff --git a/support/rtflatex/mf/dcobxs8.mf b/support/rtflatex/mf/dcobxs8.mf new file mode 100644 index 0000000000..e657c873de --- /dev/null +++ b/support/rtflatex/mf/dcobxs8.mf @@ -0,0 +1,6 @@ +% This is dcobxsl8.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=8; +generate dcobxsl diff --git a/support/rtflatex/mf/dcobxs9.mf b/support/rtflatex/mf/dcobxs9.mf new file mode 100644 index 0000000000..40f87a5000 --- /dev/null +++ b/support/rtflatex/mf/dcobxs9.mf @@ -0,0 +1,6 @@ +% This is dcobxsl9.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=9; +generate dcobxsl diff --git a/support/rtflatex/mf/dcobxsl.mf b/support/rtflatex/mf/dcobxsl.mf new file mode 100644 index 0000000000..0b36e15166 --- /dev/null +++ b/support/rtflatex/mf/dcobxsl.mf @@ -0,0 +1,91 @@ +% This is DCOBXSL.MF in text format, as of February 13, 1991 +% +% DC fonts Version 1.0 (prerelease of EC fonts) +% +% [ heavily borrowed from the Computer Modern Roman family of +% fonts by D. E. Knuth ] +% +% Content: +% +% Parameter for +% +% European Computer Modern Bold Extended Slanted Roman +% +% +input outlines % Line added 5/7/89 + +outlining:=true; + +font_identifier:="DCOBXS"; +font_size (gensize*pt#); +basedef ( 5, 6, 7, 8, 9, 10, 12); +gendef [1/36pt#]( u# )( 14.5, 16.2, 17.9, 19.6, 21.3, 23, 27); +gendef [1/36pt#]( uu# )( 14.5, 16.2, 17.9, 19.6, 21.3, 23, 27); +gendef [1/36pt#]( width_adj# )( 7, 7.8, 8.6, 9.4, 10.2, 11, 13); +gendef [1/36pt#]( serif_fit# )( 0, 0, 0, 0, 0, 0, 0); +gendef [1/36pt#]( cap_serif_fit# )( 3, 3.8, 4.6, 5.4, 6.2, 7, 8); +gendef [1/36pt#]( letter_fit# )( 3, 2, 1, 0, 0, 0, 0); +gendef [1/36pt#]( body_height# )( 135, 162, 189, 216, 243, 270, 324); +gendef [1/36pt#]( asc_height# )( 125, 150, 175, 200, 225, 250, 300); +gendef [1/36pt#]( cap_height# )( 123.5, 148.2, 172.9, 197.6, 222.3, 247, 296.4); +gendef [1/36pt#]( fig_height# )( 116, 139.2, 162.4, 185.6, 208.8, 232, 278.4); +gendef [1/36pt#]( x_height# )( 80, 96, 112, 128, 144, 160, 192); +gendef [1/36pt#]( math_axis# )( 45, 54, 63, 72, 81, 90, 108); +gendef [1/36pt#]( bar_height# )( 40, 49, 58, 67, 76, 85, 102); +gendef [1/36pt#]( comma_depth# )( 35, 42, 49, 56, 63, 70, 84); +gendef [1/36pt#]( desc_depth# )( 35, 42, 49, 56, 63, 70, 84); +gendef [1/36pt#]( acc_height# )( 37.5, 45, 52.5, 60, 67.5, 75, 90); +gendef [1/36pt#]( dot_height# )( 37.5, 45, 52.5, 60, 67.5, 75, 90); +gendef [1/36pt#]( udot_height# )( 29.5, 35.5, 41.3, 47.2, 53.1, 59, 70.8); +gendef [1/36pt#]( crisp# )( 0, 0, 0, 0, 0, 0, 0); +gendef [1/36pt#]( tiny# )( 9, 10, 11, 12, 13, 13, 13); +gendef [1/36pt#]( fine# )( 8, 9, 9, 10, 10, 10, 10); +gendef [1/36pt#]( thin_join# )( 8, 9, 9, 10, 10, 10, 10.5); +gendef [1/36pt#]( hair# )( 15, 15.4, 15.8, 16.2, 16.6, 17, 18.3); +gendef [1/36pt#]( stem# )( 24, 28, 32, 35, 38, 41, 47); +gendef [1/36pt#]( curve# )( 27, 31, 35, 39, 43, 46, 52); +gendef [1/36pt#]( ess# )( 19, 25, 29, 32, 35, 38, 44); +gendef [1/36pt#]( flare# )( 27, 31, 35, 39, 42, 45, 51); +gendef [1/36pt#]( dot_size# )( 31, 36, 41, 46, 51, 56, 62); +gendef [1/36pt#]( cap_hair# )( 17, 18, 18, 19, 19, 19, 20); +gendef [1/36pt#]( cap_stem# )( 28, 33, 38, 43, 47, 51, 57); +gendef [1/36pt#]( cap_curve# )( 31, 36, 41, 46, 51, 55, 61); +gendef [1/36pt#]( cap_ess# )( 24, 31, 37, 43, 48, 53, 59); +% gendef [pt#]( rule_thickness#)( .43, .47, .51, .54, .57, .60, .66); +gendef [pt#]( rule_thickness#)( .8, .8, .83, .86, .88, 1.0, 1.2); +gendef [1/36pt#]( dish# )( .7, .8, .9, 1, 1, 1, 1); +gendef [1/36pt#]( bracket# )( 5, 6, 7, 8, 9, 10, 12); +gendef [1/36pt#]( jut# )( 13, 15, 17, 19, 22, 25, 30); +gendef [1/36pt#]( cap_jut# )( 19, 23, 27, 31, 35, 39, 46); +gendef [1/36pt#]( beak_jut# )( 7, 7.8, 8.6, 9.4, 10.2, 11, 12.4); +gendef [1/36pt#]( beak# )( 25, 36, 46, 55, 63, 70, 84); +gendef [1/36pt#]( vair# )( 10, 11, 11.5, 12, 12.5, 13, 14.3); +% gendef [pt#]( notch_cut# )( 5, 6, 7, 8, 9, 10, 12); +gendef [pt#]( notch_cut# )( 7, 9, 10, 12, 14, 15, 17); +gendef [1/36pt#]( bar# )( 12, 13, 14, 15, 16, 17, 18.5); +gendef [1/36pt#]( slab# )( 12, 13, 14, 15, 16, 17, 18.5); +gendef [1/36pt#]( cap_bar# )( 12, 13, 14, 15, 16, 17, 18.5); +gendef [1/36pt#]( cap_band# )( 12, 13, 14, 15, 16, 17, 18.5); +% gendef [pt#]( cap_notch_cut# )( 5, 6, 7, 8, 9, 10, 12); +gendef [pt#]( cap_notch_cut# )( 7, 9, 10, 12, 14, 15, 17); +gendef [1/36pt#]( serif_drop# )( 1.5, 1.8, 2.1, 2.4, 2.7, 3, 3.6); +gendef [1/36pt#]( stem_corr# )( 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2); +gendef [1/36pt#]( vair_corr# )( 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.5); +gendef [1/36pt#]( apex_corr# )( 9, 5, 2, 0, 0, 0, 0); +gendef [1/36pt#]( o# )( 3, 3, 3, 4, 4, 4, 5); +gendef [1/36pt#]( apex_o# )( 3, 3, 3, 3, 3, 3, 4); +gendef ( slant )( [1/6], [1/6], [1/6], [1/6], [1/6], [1/6], [1/6]); +gendef ( fudge )( 1, 1, 1, 1, 1, 1, 1); +gendef ( math_spread )( 1.5, 1.3, 1.1, .9, .7, .5, .4); +gendef ( ligs )( 2, 2, 2, 2, 2, 2, 2); +superness:=8/11; +superpull:=1/8; +beak_darkness:=.4; +square_dots:=false; +hefty:=false; +serifs:=true; +monospace:=false; +variant_g:=false; +low_asterisk:=false; +math_fitting:=false; +generate dxroman diff --git a/support/rtflatex/mf/dcor.mf b/support/rtflatex/mf/dcor.mf new file mode 100644 index 0000000000..29b10761b6 --- /dev/null +++ b/support/rtflatex/mf/dcor.mf @@ -0,0 +1,89 @@ +% This is DCOR.MF in text format, as of February 13, 1991 +% +% DC fonts Version 1.0 (prerelease of EC fonts) +% +% [ heavily borrowed from the Computer Modern Roman family of +% fonts by D. E. Knuth ] +% +% Content: +% +% Parameter for +% +% European Computer Modern Roman +% +% +input outlines % Line added 5/7/89 + +outlining:=true; + +font_identifier:="DCOR"; +font_size gensize*pt#; +basedef ( 5, 6, 7, 8, 9, 10, 12, 17); +gendef [1/36pt#]( u# )( 12.5, 14, 15.5, 17, 18.5, 20, 23.5, 32.5); +gendef [1/36pt#]( uu# )( 12.5, 14, 15.5, 17, 18.5, 20, 23.5, 32.5); +gendef [1/36pt#]( width_adj# )( 0, 0, 0, 0, 0, 0, 0, 0); +gendef [1/36pt#]( serif_fit# )( 0, 0, 0, 0, 0, 0, 0, 0); +gendef [1/36pt#]( cap_serif_fit# )( 2, 2.8, 3.5, 4.1, 4.6, 5, 5.8, 8); +gendef [1/36pt#]( letter_fit# )( 5, 3, 2, 0, 0, 0, 0, [-.1]); +gendef [1/36pt#]( body_height# )( 135, 162, 189, 216, 243, 270, 324, 466); +gendef [1/36pt#]( asc_height# )( 125, 150, 175, 200, 225, 250, 300, 432); +gendef [1/36pt#]( cap_height# )( 123, 147.6, 172.2, 196.8, 221.4, 246, 295.2, 425); +gendef [1/36pt#]( fig_height# )( 116, 139.2, 162.4, 185.6, 208.8, 232, 278.4, 401); +gendef [1/36pt#]( x_height# )( 77.5, 93, 108.5, 124, 139.5, 155, 186, 267.8); +gendef [1/36pt#]( math_axis# )( 45, 54, 63, 72, 81, 90, 108, 155.5); +gendef [1/36pt#]( bar_height# )( 43.5, 52.2, 60.9, 69.6, 78.3, 87, 104.4, 150); +gendef [1/36pt#]( comma_depth# )( 35, 42, 49, 56, 63, 70, 84, 121); +gendef [1/36pt#]( desc_depth# )( 35, 42, 49, 56, 63, 70, 84, 121); +gendef [1/36pt#]( acc_height# )( 42.5, 49, 55.5, 62, 68.5, 75, 90, 127.5); +gendef [1/36pt#]( dot_height# )( 32, 36.6, 41.2, 56, 50.4, 56, 67.2, 90); +gendef [1/36pt#]( udot_height# )( 33.5, 38.5, 43.3, 48.4, 53.1, 59, 70.8, 95); +gendef [1/36pt#]( crisp# )( 0, 0, 0, 0, 0, 0, 0, 0); +gendef [1/36pt#]( tiny# )( 6, 7, 7, 8, 8, 8, 8, 8); +gendef [1/36pt#]( fine# )( 5, 6, 6, 7, 7, 7, 7, 7); +gendef [1/36pt#]( thin_join# )( 5, 6, 6, 7, 7, 7, 7.5, 9); +gendef [1/36pt#]( hair# )( 7.5, 8, 8.5, 9, 9, 9, 9.5, 11); +gendef [1/36pt#]( stem# )( 16, 18, 20, 22, 24, 25, 28, 33); +gendef [1/36pt#]( curve# )( 18, 20.5, 23, 25.5, 28, 30, 33, 41); +gendef [1/36pt#]( ess# )( 12, 17, 21, 23, 25, 27, 30, 35); +gendef [1/36pt#]( flare# )( 19, 21, 24, 27, 30, 33, 36, 45); +gendef [1/36pt#]( dot_size# )( 22, 26, 29, 32, 35, 38, 42, 51); +gendef [1/36pt#]( cap_hair# )( 8, 8.5, 9, 9.5, 10, 11, 11.5, 13); +gendef [1/36pt#]( cap_stem# )( 19, 21.5, 24, 26.5, 29, 32, 35, 40); +gendef [1/36pt#]( cap_curve# )( 21, 24, 27, 30, 33, 37, 40, 48); +gendef [1/36pt#]( cap_ess# )( 14, 19, 23, 27, 31, 35, 38, 43); +% gendef [pt#]( rule_thickness#)( .28, .31, .34, .36, .38, .4, .44, .6); +gendef [pt#]( rule_thickness#)( .43, .45, .47, .50, .60, .7, .75, 1.); +gendef [1/36pt#]( dish# )( .7, .8, .9, 1, 1, 1, 1, 1); +gendef [1/36pt#]( bracket# )( 10, 12, 14, 16, 18, 20, 24, 34); +gendef [1/36pt#]( jut# )( 15, 17, 19, 22, 25, 28, 33, 42); +gendef [1/36pt#]( cap_jut# )( 20, 23, 26, 29, 33, 37, 41, 50); +gendef [1/36pt#]( beak_jut# )( 6, 6.8, 7.6, 8.4, 9.2, 10, 11.4, 15); +gendef [1/36pt#]( beak# )( 35, 42, 49, 56, 63, 70, 84, 121); +gendef [1/36pt#]( vair# )( 6, 7, 7, 8, 8, 8, 8.5, 10); +gendef [pt#]( notch_cut# )( 5, 6, 7, 8, 9, 10, 12, 17); +gendef [1/36pt#]( bar# )( 8, 8.5, 9, 9.5, 10, 11, 12.5, 16); +gendef [1/36pt#]( slab# )( 8, 8.5, 9, 9.5, 10, 11, 12.5, 16); +gendef [1/36pt#]( cap_bar# )( 8, 8.5, 9, 9.5, 10, 11, 12.5, 16); +gendef [1/36pt#]( cap_band# )( 8, 8.5, 9, 9.5, 10, 11, 12.5, 16); +gendef [pt#]( cap_notch_cut# )( 5, 6, 7, 8, 9, 10, 12, 17); +gendef [1/36pt#]( serif_drop# )( 2, 2.4, 2.8, 3.2, 3.6, 4, 4.8, 7); +gendef [1/36pt#]( stem_corr# )( .7, .8, .9, 1, 1, 1, 1, 1); +gendef [1/36pt#]( vair_corr# )( .5, .7, .9, 1, 1, 1, 1, 1); +gendef [1/36pt#]( apex_corr# )( 0, 0, 0, 0, 0, 0, 0, 0); +gendef [1/36pt#]( o# )( 4, 4.5, 5, 6, 7, 8, 9, 10); +gendef [1/36pt#]( apex_o# )( 4, 4.5, 5, 6, 7, 8, 9, 10); +gendef ( slant )( 0, 0, 0, 0, 0, 0, 0, 0); +gendef ( fudge )( 1, 1, 1, 1, 1, 1, 1, 1); +gendef ( math_spread )( 1, .8, .6, .4, .2, 0, [-.2], [-.4]); +gendef ( ligs )( 1, 2, 2, 2, 2, 2, 2, 2); +superness:=1/sqrt 2; +superpull:=1/6; +beak_darkness:=11/30; +square_dots:=false; +hefty:=false; +serifs:=true; +monospace:=false; +variant_g:=false; +low_asterisk:=false; +math_fitting:=false; +generate dxroman diff --git a/support/rtflatex/mf/dcor10.mf b/support/rtflatex/mf/dcor10.mf new file mode 100644 index 0000000000..831de10f43 --- /dev/null +++ b/support/rtflatex/mf/dcor10.mf @@ -0,0 +1,6 @@ +% This is dcor10.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=10; +generate dcor diff --git a/support/rtflatex/mf/dcor12.mf b/support/rtflatex/mf/dcor12.mf new file mode 100644 index 0000000000..65be8e8bba --- /dev/null +++ b/support/rtflatex/mf/dcor12.mf @@ -0,0 +1,6 @@ +% This is dcor12.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=12; +generate dcor diff --git a/support/rtflatex/mf/dcor17.mf b/support/rtflatex/mf/dcor17.mf new file mode 100644 index 0000000000..454638d1cc --- /dev/null +++ b/support/rtflatex/mf/dcor17.mf @@ -0,0 +1,6 @@ +% This is dcor17.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=17.28; +generate dcor diff --git a/support/rtflatex/mf/dcor5.mf b/support/rtflatex/mf/dcor5.mf new file mode 100644 index 0000000000..c2c25668b0 --- /dev/null +++ b/support/rtflatex/mf/dcor5.mf @@ -0,0 +1,6 @@ +% This is dcor5.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=5; +generate dcor diff --git a/support/rtflatex/mf/dcor6.mf b/support/rtflatex/mf/dcor6.mf new file mode 100644 index 0000000000..8becff64ec --- /dev/null +++ b/support/rtflatex/mf/dcor6.mf @@ -0,0 +1,6 @@ +% This is dcor6.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=6; +generate dcor diff --git a/support/rtflatex/mf/dcor7.mf b/support/rtflatex/mf/dcor7.mf new file mode 100644 index 0000000000..20488d3719 --- /dev/null +++ b/support/rtflatex/mf/dcor7.mf @@ -0,0 +1,6 @@ +% This is dcor7.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=7; +generate dcor diff --git a/support/rtflatex/mf/dcor8.mf b/support/rtflatex/mf/dcor8.mf new file mode 100644 index 0000000000..ded7f6d883 --- /dev/null +++ b/support/rtflatex/mf/dcor8.mf @@ -0,0 +1,6 @@ +% This is dcor8.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=8; +generate dcor diff --git a/support/rtflatex/mf/dcor9.mf b/support/rtflatex/mf/dcor9.mf new file mode 100644 index 0000000000..4a8ea5aacf --- /dev/null +++ b/support/rtflatex/mf/dcor9.mf @@ -0,0 +1,6 @@ +% This is dcor9.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=9; +generate dcor diff --git a/support/rtflatex/mf/dcosbi10.mf b/support/rtflatex/mf/dcosbi10.mf new file mode 100644 index 0000000000..db98d97013 --- /dev/null +++ b/support/rtflatex/mf/dcosbi10.mf @@ -0,0 +1,6 @@ +% This is dcssbi10.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=10; +generate dcossbi diff --git a/support/rtflatex/mf/dcosbi12.mf b/support/rtflatex/mf/dcosbi12.mf new file mode 100644 index 0000000000..0296286360 --- /dev/null +++ b/support/rtflatex/mf/dcosbi12.mf @@ -0,0 +1,6 @@ +% This is dcssbi12.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=12; +generate dcossbi diff --git a/support/rtflatex/mf/dcosbi17.mf b/support/rtflatex/mf/dcosbi17.mf new file mode 100644 index 0000000000..3242a156bd --- /dev/null +++ b/support/rtflatex/mf/dcosbi17.mf @@ -0,0 +1,6 @@ +% This is dcssbi17.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=17.28; +generate dcossbi diff --git a/support/rtflatex/mf/dcosbi9.mf b/support/rtflatex/mf/dcosbi9.mf new file mode 100644 index 0000000000..792abdd0d5 --- /dev/null +++ b/support/rtflatex/mf/dcosbi9.mf @@ -0,0 +1,6 @@ +% This is dcssbi9.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=9; +generate dcossbi diff --git a/support/rtflatex/mf/dcoss.mf b/support/rtflatex/mf/dcoss.mf new file mode 100644 index 0000000000..a07368d303 --- /dev/null +++ b/support/rtflatex/mf/dcoss.mf @@ -0,0 +1,87 @@ +% This is DCSS.MF in text format, as of February 13, 1991 +% +% DC fonts Version 1.0 (prerelease of EC fonts) +% +% [ heavily borrowed from the Computer Modern Roman family of +% fonts by D. E. Knuth ] +% +% Content: +% +% Parameter for +% +% European Computer Modern Sans Serif +% +input outlines % Line added 5/7/89 + +outlining:=true; + +font_identifier:="DCOSS"; +font_size (gensize*pt#); +basedef ( 8, 9, 10, 12, 17); +gendef [1/36pt#]( u# )( 17, 18.5, 20, 23.5, 32.5); +gendef [1/36pt#]( uu# )( 17, 18.5, 20, 23.5, 32.5); +gendef [1/36pt#]( width_adj# )( 12, 13, 15, 17, 24); +gendef [1/36pt#]( serif_fit# )( [-6], [-6.5], [-7], [-9], [-12]); +gendef [1/36pt#]( cap_serif_fit# )( [-8.5], [-9], [-10], [-13], [-17]); +gendef [1/36pt#]( letter_fit# )( 0, 0, 0, 0, 0); +gendef [1/36pt#]( body_height# )( 216, 243, 270, 324, 466); +gendef [1/36pt#]( asc_height# )( 200, 225, 250, 300, 432); +gendef [1/36pt#]( cap_height# )( 200, 225, 250, 300, 432); +gendef [1/36pt#]( fig_height# )( 189, 236, 238, 283, 408); +gendef [1/36pt#]( x_height# )( 128, 144, 160, 192, 267.8); +gendef [1/36pt#]( math_axis# )( 72, 81, 90, 108, 155.5); +gendef [1/36pt#]( bar_height# )( 63, 71, 79, 97, 136); +gendef [1/36pt#]( comma_depth# )( 37, 41, 45, 54, 78); +gendef [1/36pt#]( desc_depth# )( 56, 63, 70, 84, 121); +gendef [1/36pt#]( acc_height# )( 60, 65, 70, 82, 110); +gendef [1/36pt#]( dot_height# )( 45.8, 50.4, 56, 67.2, 90); +gendef [1/36pt#]( udot_height# )( 48.2, 53.1, 59, 70.8, 100.3); +gendef [1/36pt#]( crisp# )( 0, 0, 0, 0, 0); +gendef [1/36pt#]( tiny# )( 0, 0, 0, 0, 0); +gendef [1/36pt#]( fine# )( 0, 0, 0, 0, 0); +gendef [1/36pt#]( thin_join# )( 15, 16, 17, 20, 28); +gendef [1/36pt#]( hair# )( 25, 27, 28, 33, 47); +gendef [1/36pt#]( stem# )( 25, 27, 28, 33, 47); +gendef [1/36pt#]( curve# )( 25, 27, 28, 33, 47); +gendef [1/36pt#]( ess# )( 25, 27, 28, 33, 47); +gendef [1/36pt#]( flare# )( 22, 24, 25, 30, 42); +gendef [1/36pt#]( dot_size# )( 26, 28, 30, 35, 50); +gendef [1/36pt#]( cap_hair# )( 25, 27, 28, 33, 47); +gendef [1/36pt#]( cap_stem# )( 29, 31, 32, 37, 52); +gendef [1/36pt#]( cap_curve# )( 29, 31, 32, 37, 52); +gendef [1/36pt#]( cap_ess# )( 28, 31, 32, 37, 52); +gendef [pt#]( rule_thickness#)( .36, .38, .4, .44, .6); +gendef [1/36pt#]( dish# )( 0, 0, 0, 0, 0); +gendef [1/36pt#]( bracket# )( 0, 0, 0, 0, 0); +gendef [1/36pt#]( jut# )( 0, 0, 0, 0, 0); +gendef [1/36pt#]( cap_jut# )( 0, 0, 0, 0, 0); +gendef [1/36pt#]( beak_jut# )( 0, 0, 0, 0, 0); +gendef [1/36pt#]( beak# )( .4, .5, .5, .6, .8); +gendef [1/36pt#]( vair# )( 19, 21, 22, 26, 38); +gendef [1/36pt#]( notch_cut# )( 16, 17, 18, 22, 32); +gendef [1/36pt#]( bar# )( 18, 20, 21, 25, 36); +gendef [1/36pt#]( slab# )( 20, 22, 23, 27, 40); +gendef [1/36pt#]( cap_bar# )( 19, 21, 22, 26, 38); +gendef [1/36pt#]( cap_band# )( 17, 19, 20, 24, 35); +gendef [1/36pt#]( cap_notch_cut# )( 22, 24, 25, 31, 46); +gendef [1/36pt#]( serif_drop# )( 2, 2, 2, 2, 2); +gendef [1/36pt#]( stem_corr# )( 1, 1, 1, 1, 1); +gendef [1/36pt#]( vair_corr# )( 1, 1, 1, 1, 1); +gendef [1/36pt#]( apex_corr# )( 4, 4.5, 5, 6, 7); +gendef [1/36pt#]( o# )( 6, 7, 8, 9, 10); +gendef [1/36pt#]( apex_o# )( 0, 0, 0, 0, 0); +gendef ( slant )( 0, 0, 0, 0, 0); +gendef ( ligs )( 2, 2, 2, 2, 2); +gendef ( fudge )( .93, .95, .96, .98, 1); +gendef ( math_spread )( .4, .2, 0, [-.2], [-.4]); +superness:=1/sqrt 2; +superpull:=1/20; +beak_darkness:=0; +square_dots:=true; +hefty:=true; +serifs:=false; +monospace:=false; +variant_g:=false; +low_asterisk:=false; +math_fitting:=false; +generate dxroman diff --git a/support/rtflatex/mf/dcoss10.mf b/support/rtflatex/mf/dcoss10.mf new file mode 100644 index 0000000000..9b58002fe2 --- /dev/null +++ b/support/rtflatex/mf/dcoss10.mf @@ -0,0 +1,6 @@ +% This is dcss10.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=10; +generate dcoss diff --git a/support/rtflatex/mf/dcoss12.mf b/support/rtflatex/mf/dcoss12.mf new file mode 100644 index 0000000000..b88741837a --- /dev/null +++ b/support/rtflatex/mf/dcoss12.mf @@ -0,0 +1,6 @@ +% This is dcss12.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=12; +generate dcoss diff --git a/support/rtflatex/mf/dcoss17.mf b/support/rtflatex/mf/dcoss17.mf new file mode 100644 index 0000000000..5f8811961a --- /dev/null +++ b/support/rtflatex/mf/dcoss17.mf @@ -0,0 +1,6 @@ +% This is dcss17.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=17.28; +generate dcoss diff --git a/support/rtflatex/mf/dcoss8.mf b/support/rtflatex/mf/dcoss8.mf new file mode 100644 index 0000000000..6441231e28 --- /dev/null +++ b/support/rtflatex/mf/dcoss8.mf @@ -0,0 +1,6 @@ +% This is dcss8.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=8; +generate dcoss diff --git a/support/rtflatex/mf/dcoss9.mf b/support/rtflatex/mf/dcoss9.mf new file mode 100644 index 0000000000..9ac1df8849 --- /dev/null +++ b/support/rtflatex/mf/dcoss9.mf @@ -0,0 +1,6 @@ +% This is dcss9.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=9; +generate dcoss diff --git a/support/rtflatex/mf/dcossb10.mf b/support/rtflatex/mf/dcossb10.mf new file mode 100644 index 0000000000..0a6ba76998 --- /dev/null +++ b/support/rtflatex/mf/dcossb10.mf @@ -0,0 +1,6 @@ +% This is dcssbx10.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=10; +generate dcossbx diff --git a/support/rtflatex/mf/dcossb12.mf b/support/rtflatex/mf/dcossb12.mf new file mode 100644 index 0000000000..1d2231b106 --- /dev/null +++ b/support/rtflatex/mf/dcossb12.mf @@ -0,0 +1,6 @@ +% This is dcssbx12.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=12; +generate dcossbx diff --git a/support/rtflatex/mf/dcossb17.mf b/support/rtflatex/mf/dcossb17.mf new file mode 100644 index 0000000000..db6f4e6777 --- /dev/null +++ b/support/rtflatex/mf/dcossb17.mf @@ -0,0 +1,6 @@ +% This is dcssbx17.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=17.28; +generate dcossbx diff --git a/support/rtflatex/mf/dcossb9.mf b/support/rtflatex/mf/dcossb9.mf new file mode 100644 index 0000000000..74b4fedb1d --- /dev/null +++ b/support/rtflatex/mf/dcossb9.mf @@ -0,0 +1,6 @@ +% This is dcssbx9.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=9; +generate dcossbx diff --git a/support/rtflatex/mf/dcossbi.mf b/support/rtflatex/mf/dcossbi.mf new file mode 100644 index 0000000000..1ede9914a4 --- /dev/null +++ b/support/rtflatex/mf/dcossbi.mf @@ -0,0 +1,91 @@ +% This is DCSSBI.MF in text format, as of October 1st, 1992 +% +% DC fonts Version 1.0 (prerelease of EC fonts) +% +% [ heavily borrowed from the Computer Modern Roman family of +% fonts by D. E. Knuth ] +% +% Content: +% +% Parameter for +% +% European Computer Modern Sans Serif Bold Extended +% +% +input outlines % Line added 5/7/89 + +outlining:=true; + +font_identifier:="DCOSBI"; +font_size gensize*pt#; +basedef ( 9, 10, 12, 17); +gendef [1/36pt#]( u# )( 19, 22, 27, 40); +gendef [1/36pt#]( uu# )( 19, 22, 27, 40); +gendef [1/36pt#]( width_adj# )( 19, 22, 19, 27); +gendef [1/36pt#]( serif_fit# )( [-8], [-9], [-10], [-14]); +gendef [1/36pt#]( cap_serif_fit# )( [-9], [-11], [-15], [-20]); +gendef [1/36pt#]( letter_fit# )( 0, 0, 0, 0); +gendef [1/36pt#]( body_height# )( 240, 270, 324, 450); +gendef [1/36pt#]( asc_height# )( 222, 250, 300, 425); +gendef [1/36pt#]( cap_height# )( 222, 250, 300, 425); +gendef [1/36pt#]( fig_height# )( 222, 250, 283, 400); +gendef [1/36pt#]( x_height# )( 146, 165, 198, 280); +gendef [1/36pt#]( math_axis# )( 80, 90, 108, 150); +gendef [1/36pt#]( bar_height# )( 80, 90, 95, 135); +gendef [1/36pt#]( comma_depth# )( 34, 38, 54, 75); +gendef [1/36pt#]( desc_depth# )( 62, 70, 84, 120); +% gendef [1/36pt#]( acc_height# )( 67.5, 75, 90, 127.5); +gendef [1/36pt#]( acc_height# )( 70.0, 80, 95, 132.5); +% gendef [1/36pt#]( dot_height# )( 67.5, 75, 90, 127.5); +gendef [1/36pt#]( dot_height# )( 70.0, 80, 95, 132.5); +gendef [1/36pt#]( udot_height# )( 53.1, 59, 70.8, 100.3); +gendef [1/36pt#]( crisp# )( 25, 26, 26, 26); +gendef [1/36pt#]( tiny# )( 24, 26, 26, 26); +gendef [1/36pt#]( fine# )( 7, 9, 9, 9); +gendef [1/36pt#]( thin_join# )( 8, 9, 10, 15); +gendef [1/36pt#]( hair# )( 43, 49, 50, 57); +gendef [1/36pt#]( stem# )( 44, 49, 50, 57); +gendef [1/36pt#]( curve# )( 44, 49, 50, 57); +gendef [1/36pt#]( ess# )( 35, 43, 44, 50); +gendef [1/36pt#]( flare# )( 39, 40, 41, 48); +gendef [1/36pt#]( dot_size# )( 46, 47, 48, 55); +gendef [1/36pt#]( cap_hair# )( 48, 49, 50, 57); +gendef [1/36pt#]( cap_stem# )( 51, 53, 54, 60); +gendef [1/36pt#]( cap_curve# )( 51, 53, 54, 60); +gendef [1/36pt#]( cap_ess# )( 49, 51, 52, 58); +gendef [1/36pt#]( rule_thickness#)( 29, 30, 31, 36); +gendef [1/36pt#]( dish# )( 0, 0, 0, 0); +gendef [1/36pt#]( bracket# )( 0, 0, 0, 0); +gendef [1/36pt#]( jut# )( 0, 0, 0, 0); +gendef [1/36pt#]( cap_jut# )( 0, 0, 0, 0); +gendef [1/36pt#]( beak_jut# )( 0, 0, 0, 0); +gendef [1/36pt#]( beak# )( 1.1, 1.5, 1.8, 3.5); +gendef [1/36pt#]( vair# )( 22, 26, 27, 35); +gendef [pt#]( notch_cut# )( 42, 49, 50, 57); +gendef [1/36pt#]( bar# )( 26, 26, 27, 35); +gendef [1/36pt#]( slab# )( 35, 36, 37, 45); +gendef [1/36pt#]( cap_bar# )( 33, 34, 35, 42); +gendef [1/36pt#]( cap_band# )( 30, 31, 32, 40); +gendef [pt#]( cap_notch_cut# )( 44, 45, 46, 53); +gendef [1/36pt#]( serif_drop# )( 2, 2, 2, 2); +gendef [1/36pt#]( stem_corr# )( 1, 1, 1, 1); +gendef [1/36pt#]( vair_corr# )( 2, 2, 2, 2); +gendef [1/36pt#]( apex_corr# )( 17, 18, 19, 20); +gendef [1/36pt#]( o# )( 7, 8, 9, 10); +gendef [1/36pt#]( apex_o# )( 0, 0, 0, 0); +gendef ( slant )( 2, 2, 2, 2); +gendef ( fudge )( .7, .88, .88, .88); +gendef ( math_spread )( .45, .5, .5, .5); +gendef ( ligs )( 2, 2, 2, 2); +slant:=sind 12/cosd 12; +superness:=3/4; +superpull:=1/18; +beak_darkness:=0; +square_dots:=true; +hefty:=true; +serifs:=false; +monospace:=false; +variant_g:=false; +low_asterisk:=false; +math_fitting:=false; +generate dxroman diff --git a/support/rtflatex/mf/dcossbx.mf b/support/rtflatex/mf/dcossbx.mf new file mode 100644 index 0000000000..0b67929e43 --- /dev/null +++ b/support/rtflatex/mf/dcossbx.mf @@ -0,0 +1,88 @@ +% This is DCSSBX.MF in text format, as of February 13, 1991 +% +% DC fonts Version 1.0 (prerelease of EC fonts) +% +% [ heavily borrowed from the Computer Modern Roman family of +% fonts by D. E. Knuth ] +% +% Content: +% +% Parameter for +% +% European Computer Modern Sans Serif Bold Extended +% +% +input outlines % Line added 5/7/89 + +outlining:=true; + +font_identifier:="DCOSSB"; +font_size gensize*pt#; +basedef ( 9, 10, 12, 17); +gendef [1/36pt#]( u# )( 19, 22, 27, 40); +gendef [1/36pt#]( uu# )( 19, 22, 27, 40); +gendef [1/36pt#]( width_adj# )( 19, 22, 19, 27); +gendef [1/36pt#]( serif_fit# )( [-8], [-9], [-10], [-14]); +gendef [1/36pt#]( cap_serif_fit# )( [-9], [-11], [-15], [-20]); +gendef [1/36pt#]( letter_fit# )( 0, 0, 0, 0); +gendef [1/36pt#]( body_height# )( 240, 270, 324, 450); +gendef [1/36pt#]( asc_height# )( 222, 250, 300, 425); +gendef [1/36pt#]( cap_height# )( 222, 250, 300, 425); +gendef [1/36pt#]( fig_height# )( 222, 250, 283, 400); +gendef [1/36pt#]( x_height# )( 146, 165, 198, 280); +gendef [1/36pt#]( math_axis# )( 80, 90, 108, 150); +gendef [1/36pt#]( bar_height# )( 80, 90, 95, 135); +gendef [1/36pt#]( comma_depth# )( 34, 38, 54, 75); +gendef [1/36pt#]( desc_depth# )( 62, 70, 84, 120); +gendef [1/36pt#]( acc_height# )( 67.5, 75, 90, 127.5); +gendef [1/36pt#]( dot_height# )( 67.5, 75, 90, 127.5); +gendef [1/36pt#]( udot_height# )( 53.1, 59, 70.8, 100.3); +gendef [1/36pt#]( crisp# )( 25, 26, 26, 26); +gendef [1/36pt#]( tiny# )( 24, 26, 26, 26); +gendef [1/36pt#]( fine# )( 7, 9, 9, 9); +gendef [1/36pt#]( thin_join# )( 8, 9, 10, 15); +gendef [1/36pt#]( hair# )( 43, 49, 50, 57); +gendef [1/36pt#]( stem# )( 44, 49, 50, 57); +gendef [1/36pt#]( curve# )( 44, 49, 50, 57); +gendef [1/36pt#]( ess# )( 35, 43, 44, 50); +gendef [1/36pt#]( flare# )( 39, 40, 41, 48); +gendef [1/36pt#]( dot_size# )( 46, 47, 48, 55); +gendef [1/36pt#]( cap_hair# )( 48, 49, 50, 57); +gendef [1/36pt#]( cap_stem# )( 51, 53, 54, 60); +gendef [1/36pt#]( cap_curve# )( 51, 53, 54, 60); +gendef [1/36pt#]( cap_ess# )( 49, 51, 52, 58); +gendef [1/36pt#]( rule_thickness#)( 29, 30, 31, 36); +gendef [1/36pt#]( dish# )( 0, 0, 0, 0); +gendef [1/36pt#]( bracket# )( 0, 0, 0, 0); +gendef [1/36pt#]( jut# )( 0, 0, 0, 0); +gendef [1/36pt#]( cap_jut# )( 0, 0, 0, 0); +gendef [1/36pt#]( beak_jut# )( 0, 0, 0, 0); +gendef [1/36pt#]( beak# )( 1.1, 1.5, 1.8, 3.5); +gendef [1/36pt#]( vair# )( 22, 26, 27, 35); +gendef [pt#]( notch_cut# )( 42, 49, 50, 57); +gendef [1/36pt#]( bar# )( 26, 26, 27, 35); +gendef [1/36pt#]( slab# )( 35, 36, 37, 45); +gendef [1/36pt#]( cap_bar# )( 33, 34, 35, 42); +gendef [1/36pt#]( cap_band# )( 30, 31, 32, 40); +gendef [pt#]( cap_notch_cut# )( 44, 45, 46, 53); +gendef [1/36pt#]( serif_drop# )( 2, 2, 2, 2); +gendef [1/36pt#]( stem_corr# )( 1, 1, 1, 1); +gendef [1/36pt#]( vair_corr# )( 2, 2, 2, 2); +gendef [1/36pt#]( apex_corr# )( 17, 18, 19, 20); +gendef [1/36pt#]( o# )( 7, 8, 9, 10); +gendef [1/36pt#]( apex_o# )( 0, 0, 0, 0); +gendef ( slant )( 0, 0, 0, 0); +gendef ( fudge )( .7, .88, .88, .88); +gendef ( math_spread )( .45, .5, .5, .5); +gendef ( ligs )( 2, 2, 2, 2); +superness:=3/4; +superpull:=1/18; +beak_darkness:=0; +square_dots:=true; +hefty:=true; +serifs:=false; +monospace:=false; +variant_g:=false; +low_asterisk:=false; +math_fitting:=false; +generate dxroman diff --git a/support/rtflatex/mf/dcossi10.mf b/support/rtflatex/mf/dcossi10.mf new file mode 100644 index 0000000000..51093b64eb --- /dev/null +++ b/support/rtflatex/mf/dcossi10.mf @@ -0,0 +1,6 @@ +% This is dcssi10.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=10; +generate dcossi diff --git a/support/rtflatex/mf/dcossi12.mf b/support/rtflatex/mf/dcossi12.mf new file mode 100644 index 0000000000..2103148d58 --- /dev/null +++ b/support/rtflatex/mf/dcossi12.mf @@ -0,0 +1,6 @@ +% This is dcssi12.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=12; +generate dcossi diff --git a/support/rtflatex/mf/dcossi17.mf b/support/rtflatex/mf/dcossi17.mf new file mode 100644 index 0000000000..c5b6685e90 --- /dev/null +++ b/support/rtflatex/mf/dcossi17.mf @@ -0,0 +1,6 @@ +% This is dcssi17.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=17.28; +generate dcossi diff --git a/support/rtflatex/mf/dcossi8.mf b/support/rtflatex/mf/dcossi8.mf new file mode 100644 index 0000000000..ea80050e40 --- /dev/null +++ b/support/rtflatex/mf/dcossi8.mf @@ -0,0 +1,6 @@ +% This is dcssi8.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=8; +generate dcossi diff --git a/support/rtflatex/mf/dcossi9.mf b/support/rtflatex/mf/dcossi9.mf new file mode 100644 index 0000000000..eaa6a2fc60 --- /dev/null +++ b/support/rtflatex/mf/dcossi9.mf @@ -0,0 +1,6 @@ +% This is dcssi9.mf in text format as of June, 22, 1992 +if unknown dxbase: input dxbase fi; + + +gensize:=9; +generate dcossi diff --git a/support/rtflatex/mf/dcossqi.mf b/support/rtflatex/mf/dcossqi.mf new file mode 100644 index 0000000000..5a67bd5b0c --- /dev/null +++ b/support/rtflatex/mf/dcossqi.mf @@ -0,0 +1,86 @@ +% This is DCSSQI.MF in text format, as of March 24, 1992 +% +% DC fonts Version 1.1 (prerelease of EC fonts) +% +% [ heavily borrowed from the Computer Modern Roman family of +% fonts by D. E. Knuth ] +% +% Content: +% +% Parameter for +% +% European Computer Modern Sans Serif Quotation Italics +% +% +font_identifier:="DCSSQI"; +font_size (gensize*pt#); +basedef ( 8); +gendef [1/36pt#]( u# )( 20); +gendef [1/36pt#]( uu# )( 20); +gendef [1/36pt#]( width_adj# )( 2); +gendef [1/36pt#]( serif_fit# )( [-10]); +gendef [1/36pt#]( cap_serif_fit# )( [-14]); +gendef [1/36pt#]( letter_fit# )( 0); +gendef [1/36pt#]( body_height# )( 220); +gendef [1/36pt#]( asc_height# )( 200); +gendef [1/36pt#]( cap_height# )( 197); +gendef [1/36pt#]( fig_height# )( 190); +gendef [1/36pt#]( x_height# )( 150); +gendef [1/36pt#]( math_axis# )( 80); +gendef [1/36pt#]( bar_height# )( 80); +gendef [1/36pt#]( comma_depth# )( 40); +gendef [1/36pt#]( desc_depth# )( 40); +gendef [1/36pt#]( acc_height# )( 60); +gendef [1/36pt#]( dot_height# )( 45.8); +gendef [1/36pt#]( udot_height# )( 48.2); +gendef [1/36pt#]( crisp# )( 18); +gendef [1/36pt#]( tiny# )( 18); +gendef [1/36pt#]( fine# )( 8); +gendef [1/36pt#]( thin_join# )( 8); +gendef [1/36pt#]( hair# )( 23); +gendef [1/36pt#]( stem# )( 23); +gendef [1/36pt#]( curve# )( 23); +gendef [1/36pt#]( ess# )( 23); +gendef [1/36pt#]( flare# )( 21); +gendef [1/36pt#]( dot_size# )( 28); +gendef [1/36pt#]( cap_hair# )( 23); +gendef [1/36pt#]( cap_stem# )( 27); +gendef [1/36pt#]( cap_curve# )( 27); +gendef [1/36pt#]( cap_ess# )( 27); +gendef [pt#]( rule_thickness#)( .55555); +gendef [1/36pt#]( dish# )( 0); +gendef [1/36pt#]( bracket# )( 0); +gendef [1/36pt#]( jut# )( 0); +gendef [1/36pt#]( cap_jut# )( 0); +gendef [1/36pt#]( beak_jut# )( 0); +gendef [1/36pt#]( beak# )( 0); +gendef [1/36pt#]( vair# )( 18); +gendef [1/36pt#]( notch_cut# )( 23); +gendef [1/36pt#]( bar# )( 18); +gendef [1/36pt#]( slab# )( 19); +gendef [1/36pt#]( cap_bar# )( 19); +gendef [1/36pt#]( cap_band# )( 19); +gendef [1/36pt#]( cap_notch_cut# )( 23); +gendef [1/36pt#]( serif_drop# )( 0); +gendef [1/36pt#]( stem_corr# )( .5); +gendef [1/36pt#]( vair_corr# )( .5); +gendef [1/36pt#]( apex_corr# )( 4); +gendef [1/36pt#]( o# )( 6); +gendef [1/36pt#]( apex_o# )( 2); +gendef ( slant )(.212556); +gendef ( ligs )( 2); +gendef ( fudge )( .95); +gendef ( math_spread )( 0); +superness:=1/sqrt 2; +superpull:=1/10; +beak_darkness:=0; +square_dots:=true; +hefty:=true; +serifs:=false; +monospace:=false; +variant_g:=true; +low_asterisk:=false; +math_fitting:=false; +generate dxroman + +endinput; diff --git a/support/rtflatex/mf/dcossqi8.mf b/support/rtflatex/mf/dcossqi8.mf new file mode 100644 index 0000000000..64d665115f --- /dev/null +++ b/support/rtflatex/mf/dcossqi8.mf @@ -0,0 +1,7 @@ +% This is dcssqi8.mf in text format as of Sep, 2, 1991 +if unknown dxbase: input dxbase fi; + + +gensize:=8; +generate dcossqi + diff --git a/support/rtflatex/mf/outlines.mf b/support/rtflatex/mf/outlines.mf new file mode 100644 index 0000000000..73766a9932 --- /dev/null +++ b/support/rtflatex/mf/outlines.mf @@ -0,0 +1,49 @@ +% This is OUTLINES.MF as of 5/7/89 +% Outline routine - by Doug Henderson +% Minor enhancements for ww laser printers and MFT compatibility Don Hosek + +boolean outlining; +% only outline when told to explicitly with |outlining:=true;| +outlining:=false; + +message"Loading the font outline macros."; +def outline = +if outlining: + cull currentpicture keeping (1,infinity); + picture v; v:=currentpicture; + cull currentpicture keeping (1,1) withweight 3; + addto currentpicture also v - v shifted right + -v shifted left - v shifted up - v shifted down; + cull currentpicture keeping (1,4); + % next code for super hi-res typesetters such \] + % as the Linotronic 100 at 1270dpi and the PTI 2000dpi \] + % replacing pixel x with the following pattern of \] + % pixels in the currentpicture: \] + % \tt\quad XXX \] + % \tt\quad XxX \] + % \tt\quad XXX \] + % to create darker lines for outlines \] + if (pixels_per_inch >= 1270) : + v:=currentpicture; + addto currentpicture also v shifted right + + v shifted left + v shifted up + v shifted down; + cullit; + % and the next code is for medium resolution printers such \] + % as the Varityper(600dpi) and the APSu5(723dpi) or \] + % write-white laser printers such as the Xerox 8790 \] + % replacing pixel x with: \] + % \tt\quad XX \] + % \tt\quad Xx \] + % to create slightly darker lines for outlines \] + elseif (pixels_per_inch >= 600) + or (write_white=1) : % Say {\tt MF \mode=rcc; write_white:=1 input fn} + addto currentpicture also currentpicture shifted left; + addto currentpicture also currentpicture shifted up; + fi + showit; +fi +enddef; +extra_endchar:=extra_endchar & "outline;"; + +if unknown write_white: write_white:=0; fi + diff --git a/support/rtflatex/p2c.h b/support/rtflatex/p2c.h new file mode 100644 index 0000000000..e4cf5d3e76 --- /dev/null +++ b/support/rtflatex/p2c.h @@ -0,0 +1,531 @@ +#ifndef P2C_H +#define P2C_H + + +/* Header file for code generated by "p2c", the Pascal-to-C translator */ + +/* "p2c" Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation. + * By Dave Gillespie, daveg@synaptics.com. Version 1.21alpha-07.Dec.93. + * This file may be copied, modified, etc. in any way. It is not restricted + * by the licence agreement accompanying p2c itself. + */ + + +#include <stdio.h> + + + +/* If the following heuristic fails, compile -DBSD=0 for non-BSD systems, + or -DBSD=1 for BSD systems. */ + +#ifdef M_XENIX +# define BSD 0 +#endif + +#ifdef vms +# define BSD 0 +# ifndef __STDC__ +# define __STDC__ 1 +# endif +#endif + +#ifdef __TURBOC__ +# define MSDOS 1 +#endif + +#ifdef MSDOS +# define BSD 0 +#endif + +#ifdef FILE /* a #define in BSD, a typedef in SYSV (hp-ux, at least) */ +# ifndef BSD /* (a convenient, but horrible kludge!) */ +# define BSD 1 +# endif +#endif + +#ifdef BSD +# if !BSD +# undef BSD +# endif +#endif + + +#if (defined(__STDC__) && !defined(M_XENIX)) || defined(__TURBOC__) +# include <stdlib.h> +# include <stddef.h> +# define HAS_STDLIB +# if defined(vms) || defined(__TURBOC__) +# define NON_ANSI_CAT +# endif +#else +# ifndef BSD +# ifndef __TURBOC__ +# include <memory.h> +# endif +# endif +# ifdef hpux +# ifdef _INCLUDE__STDC__ +# include <stddef.h> +# include <stdlib.h> +# define HAS_STDLIB +# endif +# endif +# include <sys/types.h> +# if !defined(MSDOS) || defined(__TURBOC__) +# define NON_ANSI_CAT +# endif +#endif + +#if defined(NON_ANSI_CAT) && !defined(ANSI_CAT) +# ifdef NON_ANSI_CAT_ALTERNATE +# define __CAT__(a,b)a/**/b +# else +# define __ID__(a)a +# define __CAT__(a,b)__ID__(a)b +# endif +#else +# define __CAT__(a,b)a##b +#endif + + +#ifdef BSD +# include <strings.h> +# define memcpy(a,b,n) (bcopy(b,a,n),a) +# define memcmp(a,b,n) bcmp(a,b,n) +# define strchr(s,c) index(s,c) +# define strrchr(s,c) rindex(s,c) +#else +# include <string.h> +#endif + +#include <ctype.h> +#include <math.h> +#include <setjmp.h> +#include <assert.h> + + +#ifndef NO_LACK +#ifdef vms + +#define LACK_LABS +#define LACK_MEMMOVE +#define LACK_MEMCPY + +#else + +#define LACK_LABS /* Undefine these if your library has these */ +#define LACK_MEMMOVE + +#endif +#endif + + +typedef struct __p2c_jmp_buf { + struct __p2c_jmp_buf *next; + jmp_buf jbuf; +} __p2c_jmp_buf; + + +/* Warning: The following will not work if setjmp is used simultaneously. + This also violates the ANSI restriction about using vars after longjmp, + but a typical implementation of longjmp will get it right anyway. */ + +#ifndef FAKE_TRY +# define TRY(x) do { __p2c_jmp_buf __try_jb; \ + __try_jb.next = __top_jb; \ + if (!setjmp((__top_jb = &__try_jb)->jbuf)) { +# define RECOVER(x) __top_jb = __try_jb.next; } else { +# define RECOVER2(x,L) __top_jb = __try_jb.next; } else { \ + if (0) { L: __top_jb = __try_jb.next; } +# define ENDTRY(x) } } while (0) +#else +# define TRY(x) if (1) { +# define RECOVER(x) } else do { +# define RECOVER2(x,L) } else do { L: ; +# define ENDTRY(x) } while (0) +#endif + + + +#ifdef M_XENIX /* avoid compiler bug */ +# define SHORT_MAX (32767) +# define SHORT_MIN (-32768) +#endif + + +/* The following definitions work only on twos-complement machines */ +#ifndef SHORT_MAX +# define SHORT_MAX ((short)(((unsigned short) -1) >> 1)) +# define SHORT_MIN (~SHORT_MAX) +#endif + +#ifndef INT_MAX +# define INT_MAX ((int)(((unsigned int) -1) >> 1)) +# define INT_MIN (~INT_MAX) +#endif + +#ifndef LONG_MAX +# define LONG_MAX ((long)(((unsigned long) -1) >> 1)) +# define LONG_MIN (~LONG_MAX) +#endif + +#ifndef SEEK_SET +# define SEEK_SET 0 +# define SEEK_CUR 1 +# define SEEK_END 2 +#endif + +#ifndef EXIT_SUCCESS +# ifdef vms +# define EXIT_SUCCESS 1 +# define EXIT_FAILURE (02000000000L) +# else +# define EXIT_SUCCESS 0 +# define EXIT_FAILURE 1 +# endif +#endif + + +#define SETBITS 32 + + +#if defined(__STDC__) || defined(__TURBOC__) +# if !defined(vms) && !defined(M_LINT) +# define Signed signed +# else +# define Signed +# endif +# define Void void /* Void f() = procedure */ +# ifndef Const +# define Const const +# endif +# ifndef Volatile +# define Volatile volatile +# endif +# ifdef M_LINT +# define PP(x) () +# define PV() () +typedef char *Anyptr; +# else +# define PP(x) x /* function prototype */ +# define PV() (void) /* null function prototype */ +typedef void *Anyptr; +# endif +#else +# define Signed +# define Void void +# ifndef Const +# define Const +# endif +# ifndef Volatile +# define Volatile +# endif +# define PP(x) () +# define PV() () +typedef char *Anyptr; +#endif + +#ifdef __GNUC__ +# define Inline inline +#else +# define Inline +#endif + +#define Register register /* Register variables */ +#define Char char /* Characters (not bytes) */ + +#ifndef Static +# define Static static /* Private global funcs and vars */ +#endif + +#ifndef Local +# define Local static /* Nested functions */ +#endif + +typedef Signed char schar; +typedef unsigned char uchar; +typedef unsigned char boolean; + +#ifndef NO_DECLARE_ALFA +typedef Char alfa[10]; +#endif + +#ifndef true +# define true 1 +# define false 0 +#endif + +#ifndef TRUE +# define TRUE 1 +# define FALSE 0 +#endif + + +typedef struct { + Anyptr proc, link; +} _PROCEDURE; + +#ifndef _FNSIZE +# define _FNSIZE 120 +#endif + + +extern Void PASCAL_MAIN PP( (int, Char **) ); +extern Char **P_argv; +extern int P_argc; +extern short P_escapecode; +extern int P_ioresult; +extern __p2c_jmp_buf *__top_jb; + + +#ifdef P2C_H_PROTO /* if you have Ansi C but non-prototyped header files */ +extern Char *strcat PP( (Char *, Const Char *) ); +extern Char *strchr PP( (Const Char *, int) ); +extern int strcmp PP( (Const Char *, Const Char *) ); +extern Char *strcpy PP( (Char *, Const Char *) ); +extern size_t strlen PP( (Const Char *) ); +extern Char *strncat PP( (Char *, Const Char *, size_t) ); +extern int strncmp PP( (Const Char *, Const Char *, size_t) ); +extern Char *strncpy PP( (Char *, Const Char *, size_t) ); +extern Char *strrchr PP( (Const Char *, int) ); + +extern Anyptr memchr PP( (Const Anyptr, int, size_t) ); +extern Anyptr memmove PP( (Anyptr, Const Anyptr, size_t) ); +extern Anyptr memset PP( (Anyptr, int, size_t) ); +#ifndef memcpy +extern Anyptr memcpy PP( (Anyptr, Const Anyptr, size_t) ); +extern int memcmp PP( (Const Anyptr, Const Anyptr, size_t) ); +#endif + +extern int atoi PP( (Const Char *) ); +extern double atof PP( (Const Char *) ); +extern long atol PP( (Const Char *) ); +extern double strtod PP( (Const Char *, Char **) ); +extern long strtol PP( (Const Char *, Char **, int) ); +#endif /*P2C_H_PROTO*/ + +#ifndef HAS_STDLIB +#ifndef NO_DECLARE_MALLOC +extern Anyptr malloc PP( (size_t) ); +extern Void free PP( (Anyptr) ); +#endif +#endif + +extern int _OutMem PV(); +extern int _CaseCheck PV(); +extern int _NilCheck PV(); +extern int _Escape PP( (int) ); +extern int _EscIO PP( (int) ); +extern int _EscIO2 PP( (int, Char *) ); + +extern long ipow PP( (long, long) ); +extern long P_imax PP( (long, long) ); +extern long P_imin PP( (long, long) ); +extern double P_rmax PP( (double, double) ); +extern double P_rmin PP( (double, double) ); +extern Char *strsub PP( (Char *, Char *, int, int) ); +extern Char *strltrim PP( (Char *) ); +extern Char *strrtrim PP( (Char *) ); +extern Char *strrpt PP( (Char *, Char *, int) ); +extern Char *strpad PP( (Char *, Char *, int, int) ); +extern int strpos2 PP( (Char *, Char *, int) ); +extern long memavail PV(); +extern int P_peek PP( (FILE *) ); +extern int P_eof PP( (FILE *) ); +extern int P_eoln PP( (FILE *) ); +extern Void P_readpaoc PP( (FILE *, Char *, int) ); +extern Void P_readlnpaoc PP( (FILE *, Char *, int) ); +extern long P_maxpos PP( (FILE *) ); +extern Char *P_trimname PP( (Char *, int) ); +extern long *P_setunion PP( (long *, long *, long *) ); +extern long *P_setint PP( (long *, long *, long *) ); +extern long *P_setdiff PP( (long *, long *, long *) ); +extern long *P_setxor PP( (long *, long *, long *) ); +extern int P_inset PP( (unsigned, long *) ); +extern int P_setequal PP( (long *, long *) ); +extern int P_subset PP( (long *, long *) ); +extern long *P_addset PP( (long *, unsigned) ); +extern long *P_addsetr PP( (long *, unsigned, unsigned) ); +extern long *P_remset PP( (long *, unsigned) ); +extern long *P_setcpy PP( (long *, long *) ); +extern long *P_expset PP( (long *, long) ); +extern long P_packset PP( (long *) ); +extern int P_getcmdline PP( (int, int, Char *) ); +extern Void TimeStamp PP( (int *, int *, int *, + int *, int *, int *) ); +extern Void P_sun_argv PP( (char *, int, int) ); +extern FILE *_skipspaces PP( (FILE *) ); +extern FILE *_skipnlspaces PP( (FILE *) ); + + +/* I/O error handling */ +#define _CHKIO(cond,ior,val,def) ((cond) ? P_ioresult=0,(val) \ + : P_ioresult=(ior),(def)) +#define _SETIO(cond,ior) (P_ioresult = (cond) ? 0 : (ior)) + +/* Following defines are suitable for the HP Pascal operating system */ +#define FileNotFound 10 +#define FileNotOpen 13 +#define FileWriteError 38 +#define BadInputFormat 14 +#define EndOfFile 30 + +#define FILENOTFOUND 10 +#define FILENOTOPEN 13 +#define FILEWRITEERROR 38 +#define BADINPUTFORMAT 14 +#define ENDOFFILE 30 + +/* Creating temporary files */ +#if (defined(BSD) || defined(NO_TMPFILE)) && !defined(HAVE_TMPFILE) +# define tmpfile() (fopen(tmpnam(NULL), "w+")) +#endif + +/* File buffers */ +#define FILEBUF(f,sc,type) sc int __CAT__(f,_BFLAGS); \ + sc type __CAT__(f,_BUFFER) +#define FILEBUFNC(f,type) int __CAT__(f,_BFLAGS); \ + type __CAT__(f,_BUFFER) + +#define RESETBUF(f,type) (__CAT__(f,_BFLAGS) = 1) +#define SETUPBUF(f,type) (__CAT__(f,_BFLAGS) = 0) + +#define GETFBUF(f,type) (*((__CAT__(f,_BFLAGS) == 1 && \ + ((__CAT__(f,_BFLAGS) = 2), \ + fread(&__CAT__(f,_BUFFER), \ + sizeof(type),1,(f)))),\ + &__CAT__(f,_BUFFER))) +#define AGETFBUF(f,type) ((__CAT__(f,_BFLAGS) == 1 && \ + ((__CAT__(f,_BFLAGS) = 2), \ + fread(__CAT__(f,_BUFFER), \ + sizeof(type),1,(f)))),\ + __CAT__(f,_BUFFER)) + +#define PUTFBUF(f,type,v) (GETFBUF(f,type) = (v)) +#define CPUTFBUF(f,v) (PUTFBUF(f,char,v)) +#define APUTFBUF(f,type,v) (memcpy(AGETFBUF(f,type), (v), \ + sizeof(__CAT__(f,_BUFFER)))) + +#define GET(f,type) (__CAT__(f,_BFLAGS) == 1 ? \ + fread(&__CAT__(f,_BUFFER),sizeof(type),1,(f)) : \ + (__CAT__(f,_BFLAGS) = 1)) + +#define PUT(f,type) (fwrite(&__CAT__(f,_BUFFER),sizeof(type),1,(f)), \ + (__CAT__(f,_BFLAGS) = 0)) +#define CPUT(f) (PUT(f,char)) + +#define BUFEOF(f) (__CAT__(f,_BFLAGS) != 2 && P_eof(f)) +#define BUFFPOS(f) (ftell(f) - (__CAT__(f,_BFLAGS) == 2)) + +typedef struct { + FILE *f; + int f_BFLAGS; /* FILEBUFNC(f,Char); */ + Char f_BUFFER; + Char name[_FNSIZE]; +} _TEXT; + +/* Memory allocation */ +#ifdef __GCC__ +# define Malloc(n) (malloc(n) ?: (Anyptr)_OutMem()) +#else +extern Anyptr __MallocTemp__; +# define Malloc(n) ((__MallocTemp__ = malloc(n)) ? __MallocTemp__ : (Anyptr)_OutMem()) +#endif +#define FreeR(p) (free((Anyptr)(p))) /* used if arg is an rvalue */ +#define Free(p) (free((Anyptr)(p)), (p)=NULL) + +/* sign extension */ +#define SEXT(x,n) ((x) | -(((x) & (1L<<((n)-1))) << 1)) + +/* packed arrays */ /* BEWARE: these are untested! */ +#define P_getbits_UB(a,i,n,L) ((int)((a)[(i)>>(L)-(n)] >> \ + (((~(i))&((1<<(L)-(n))-1)) << (n)) & \ + (1<<(1<<(n)))-1)) + +#define P_getbits_SB(a,i,n,L) ((int)((a)[(i)>>(L)-(n)] << \ + (16 - ((((~(i))&((1<<(L)-(n))-1))+1) <<\ + (n)) >> (16-(1<<(n)))))) + +#define P_putbits_UB(a,i,x,n,L) ((a)[(i)>>(L)-(n)] |= \ + (x) << (((~(i))&((1<<(L)-(n))-1)) << (n))) + +#define P_putbits_SB(a,i,x,n,L) ((a)[(i)>>(L)-(n)] |= \ + ((x) & (1<<(1<<(n)))-1) << \ + (((~(i))&((1<<(L)-(n))-1)) << (n))) + +#define P_clrbits_B(a,i,n,L) ((a)[(i)>>(L)-(n)] &= \ + ~( ((1<<(1<<(n)))-1) << \ + (((~(i))&((1<<(L)-(n))-1)) << (n))) ) + +/* small packed arrays */ +#define P_getbits_US(v,i,n) ((int)((v) >> ((i)<<(n)) & (1<<(1<<(n)))-1)) +#define P_getbits_SS(v,i,n) ((int)((long)(v) << (SETBITS - (((i)+1) << (n))) >> (SETBITS-(1<<(n))))) +#define P_putbits_US(v,i,x,n) ((v) |= (x) << ((i) << (n))) +#define P_putbits_SS(v,i,x,n) ((v) |= ((x) & (1<<(1<<(n)))-1) << ((i)<<(n))) +#define P_clrbits_S(v,i,n) ((v) &= ~( ((1<<(1<<(n)))-1) << ((i)<<(n)) )) + +#define P_max(a,b) ((a) > (b) ? (a) : (b)) +#define P_min(a,b) ((a) < (b) ? (a) : (b)) + + +/* Fix ANSI-isms */ + +#ifdef LACK_LABS +# ifndef labs +# define labs my_labs + extern long my_labs PP( (long) ); +# endif +#endif + +#ifdef LACK_MEMMOVE +# ifndef memmove +# define memmove my_memmove + extern Anyptr my_memmove PP( (Anyptr, Const Anyptr, size_t) ); +# endif +#endif + +#ifdef LACK_MEMCPY +# ifndef memcpy +# define memcpy my_memcpy + extern Anyptr my_memcpy PP( (Anyptr, Const Anyptr, size_t) ); +# endif +# ifndef memcmp +# define memcmp my_memcmp + extern int my_memcmp PP( (Const Anyptr, Const Anyptr, size_t) ); +# endif +# ifndef memset +# define memset my_memset + extern Anyptr my_memset PP( (Anyptr, int, size_t) ); +# endif +#endif + +/* Fix toupper/tolower on Suns and other stupid BSD systems */ +#ifdef toupper +# undef toupper +# undef tolower +# define toupper(c) my_toupper(c) +# define tolower(c) my_tolower(c) +#endif + +#ifndef _toupper +# if 'A' == 65 && 'a' == 97 +# define _toupper(c) ((c)-'a'+'A') +# define _tolower(c) ((c)-'A'+'a') +# else +# ifdef toupper +# undef toupper /* hope these are shadowing real functions, */ +# undef tolower /* because my_toupper calls _toupper! */ +# endif +# define _toupper(c) toupper(c) +# define _tolower(c) tolower(c) +# endif +#endif + + +#endif /* P2C_H */ + + + +/* End. */ + + diff --git a/support/rtflatex/p2c_mods.h b/support/rtflatex/p2c_mods.h new file mode 100644 index 0000000000..ff622f1d5c --- /dev/null +++ b/support/rtflatex/p2c_mods.h @@ -0,0 +1 @@ +/* This file is supposed to contain your local changes to p2c.h=>p2crtf.h */ diff --git a/support/rtflatex/p2clib.h b/support/rtflatex/p2clib.h new file mode 100644 index 0000000000..0597714560 --- /dev/null +++ b/support/rtflatex/p2clib.h @@ -0,0 +1,532 @@ +#ifndef P2C_H +#define P2C_H + + +/* Header file for code generated by "p2c", the Pascal-to-C translator */ + +/* "p2c" Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation. + * By Dave Gillespie, daveg@synaptics.com. Version 1.21alpha-07.Dec.93. + * This file may be copied, modified, etc. in any way. It is not restricted + * by the licence agreement accompanying p2c itself. + */ + + +#include <stdio.h> + + + +/* If the following heuristic fails, compile -DBSD=0 for non-BSD systems, + or -DBSD=1 for BSD systems. */ + +#ifdef M_XENIX +# define BSD 0 +#endif + +#ifdef vms +# define BSD 0 +# ifndef __STDC__ +# define __STDC__ 1 +# endif +#endif + +#ifdef __TURBOC__ +# define MSDOS 1 +#endif + +#ifdef MSDOS +# define BSD 0 +#endif + +#ifdef FILE /* a #define in BSD, a typedef in SYSV (hp-ux, at least) */ +# ifndef BSD /* (a convenient, but horrible kludge!) */ +# define BSD 1 +# endif +#endif + +#ifdef BSD +# if !BSD +# undef BSD +# endif +#endif + + +#if (defined(__STDC__) && !defined(M_XENIX)) || defined(__TURBOC__) +# include <stdlib.h> +# include <stddef.h> +# define HAS_STDLIB +# if defined(vms) || defined(__TURBOC__) +# define NON_ANSI_CAT +# endif +#else +# ifndef BSD +# ifndef __TURBOC__ +# include <memory.h> +# endif +# endif +# ifdef hpux +# ifdef _INCLUDE__STDC__ +# include <stddef.h> +# include <stdlib.h> +# define HAS_STDLIB +# endif +# endif +# include <sys/types.h> +# if !defined(MSDOS) || defined(__TURBOC__) +# define NON_ANSI_CAT +# endif +#endif + +#if defined(NON_ANSI_CAT) && !defined(ANSI_CAT) +# ifdef NON_ANSI_CAT_ALTERNATE +# define __CAT__(a,b)a/**/b +# else +# define __ID__(a)a +# define __CAT__(a,b)__ID__(a)b +# endif +#else +# define __CAT__(a,b)a##b +#endif + + +#ifdef BSD +# include <strings.h> +# define memcpy(a,b,n) (bcopy(b,a,n),a) +# define memcmp(a,b,n) bcmp(a,b,n) +# define strchr(s,c) index(s,c) +# define strrchr(s,c) rindex(s,c) +#else +# include <string.h> +#endif + +#include <ctype.h> +#include <math.h> +#include <setjmp.h> +#include <assert.h> + + +#ifndef NO_LACK +#ifdef vms + +#define LACK_LABS +#define LACK_MEMMOVE +#define LACK_MEMCPY + +#else + +#define LACK_LABS /* Undefine these if your library has these */ +#define LACK_MEMMOVE + +#endif +#endif + + +typedef struct __p2c_jmp_buf { + struct __p2c_jmp_buf *next; + jmp_buf jbuf; +} __p2c_jmp_buf; + + +/* Warning: The following will not work if setjmp is used simultaneously. + This also violates the ANSI restriction about using vars after longjmp, + but a typical implementation of longjmp will get it right anyway. */ + +#ifndef FAKE_TRY +# define TRY(x) do { __p2c_jmp_buf __try_jb; \ + __try_jb.next = __top_jb; \ + if (!setjmp((__top_jb = &__try_jb)->jbuf)) { +# define RECOVER(x) __top_jb = __try_jb.next; } else { +# define RECOVER2(x,L) __top_jb = __try_jb.next; } else { \ + if (0) { L: __top_jb = __try_jb.next; } +# define ENDTRY(x) } } while (0) +#else +# define TRY(x) if (1) { +# define RECOVER(x) } else do { +# define RECOVER2(x,L) } else do { L: ; +# define ENDTRY(x) } while (0) +#endif + + + +#ifdef M_XENIX /* avoid compiler bug */ +# define SHORT_MAX (32767) +# define SHORT_MIN (-32768) +#endif + + +/* The following definitions work only on twos-complement machines */ +#ifndef SHORT_MAX +# define SHORT_MAX ((short)(((unsigned short) -1) >> 1)) +# define SHORT_MIN (~SHORT_MAX) +#endif + +#ifndef INT_MAX +# define INT_MAX ((int)(((unsigned int) -1) >> 1)) +# define INT_MIN (~INT_MAX) +#endif + +#ifndef LONG_MAX +# define LONG_MAX ((long)(((unsigned long) -1) >> 1)) +# define LONG_MIN (~LONG_MAX) +#endif + +#ifndef SEEK_SET +# define SEEK_SET 0 +# define SEEK_CUR 1 +# define SEEK_END 2 +#endif + +#ifndef EXIT_SUCCESS +# ifdef vms +# define EXIT_SUCCESS 1 +# define EXIT_FAILURE (02000000000L) +# else +# define EXIT_SUCCESS 0 +# define EXIT_FAILURE 1 +# endif +#endif + + +#define SETBITS 32 + + +#if defined(__STDC__) || defined(__TURBOC__) +# if !defined(vms) && !defined(M_LINT) +# define Signed signed +# else +# define Signed +# endif +# define Void void /* Void f() = procedure */ +# ifndef Const +# define Const const +# endif +# ifndef Volatile +# define Volatile volatile +# endif +# ifdef M_LINT +# define PP(x) () +# define PV() () +typedef char *Anyptr; +# else +# define PP(x) x /* function prototype */ +# define PV() (void) /* null function prototype */ +typedef void *Anyptr; +# endif +#else +# define Signed +# define Void void +# ifndef Const +# define Const +# endif +# ifndef Volatile +# define Volatile +# endif +# define PP(x) () +# define PV() () +typedef char *Anyptr; +#endif + +#ifdef __GNUC__ +# define Inline inline +#else +# define Inline +#endif + +#define Register register /* Register variables */ +#define Char char /* Characters (not bytes) */ + +#ifndef Static +# define Static static /* Private global funcs and vars */ +#endif + +#ifndef Local +# define Local static /* Nested functions */ +#endif + +typedef Signed char schar; +typedef unsigned char uchar; +typedef unsigned char boolean; + +#ifndef NO_DECLARE_ALFA +typedef Char alfa[10]; +#endif + +#ifndef true +# define true 1 +# define false 0 +#endif + +#ifndef TRUE +# define TRUE 1 +# define FALSE 0 +#endif + + +typedef struct { + Anyptr proc, link; +} _PROCEDURE; + +#ifndef _FNSIZE +# define _FNSIZE 120 +#endif + + +extern Void PASCAL_MAIN PP( (int, Char **) ); +extern Char **P_argv; +extern int P_argc; +extern short P_escapecode; +extern int P_ioresult; +extern __p2c_jmp_buf *__top_jb; + + +#ifdef P2C_H_PROTO /* if you have Ansi C but non-prototyped header files */ +extern Char *strcat PP( (Char *, Const Char *) ); +extern Char *strchr PP( (Const Char *, int) ); +extern int strcmp PP( (Const Char *, Const Char *) ); +extern Char *strcpy PP( (Char *, Const Char *) ); +extern size_t strlen PP( (Const Char *) ); +extern Char *strncat PP( (Char *, Const Char *, size_t) ); +extern int strncmp PP( (Const Char *, Const Char *, size_t) ); +extern Char *strncpy PP( (Char *, Const Char *, size_t) ); +extern Char *strrchr PP( (Const Char *, int) ); + +extern Anyptr memchr PP( (Const Anyptr, int, size_t) ); +extern Anyptr memmove PP( (Anyptr, Const Anyptr, size_t) ); +extern Anyptr memset PP( (Anyptr, int, size_t) ); +#ifndef memcpy +extern Anyptr memcpy PP( (Anyptr, Const Anyptr, size_t) ); +extern int memcmp PP( (Const Anyptr, Const Anyptr, size_t) ); +#endif + +extern int atoi PP( (Const Char *) ); +extern double atof PP( (Const Char *) ); +extern long atol PP( (Const Char *) ); +extern double strtod PP( (Const Char *, Char **) ); +extern long strtol PP( (Const Char *, Char **, int) ); +#endif /*P2C_H_PROTO*/ + +#ifndef HAS_STDLIB +#ifndef NO_DECLARE_MALLOC +extern Anyptr malloc PP( (size_t) ); +extern Void free PP( (Anyptr) ); +#endif +#endif + +extern int _OutMem PV(); +extern int _CaseCheck PV(); +extern int _NilCheck PV(); +extern int _Escape PP( (int) ); +extern int _EscIO PP( (int) ); +extern int _EscIO2 PP( (int, Char *) ); + +extern long ipow PP( (long, long) ); +extern long P_imax PP( (long, long) ); +extern long P_imin PP( (long, long) ); +extern double P_rmax PP( (double, double) ); +extern double P_rmin PP( (double, double) ); +extern Char *strsub PP( (Char *, Char *, int, int) ); +extern Char *strltrim PP( (Char *) ); +extern Char *strrtrim PP( (Char *) ); +extern Char *strrpt PP( (Char *, Char *, int) ); +extern Char *strpad PP( (Char *, Char *, int, int) ); +extern int strpos2 PP( (Char *, Char *, int) ); +extern long memavail PV(); +extern int P_peek PP( (FILE *) ); +extern int P_eof PP( (FILE *) ); +extern int P_eoln PP( (FILE *) ); +extern Void P_readpaoc PP( (FILE *, Char *, int) ); +extern Void P_readlnpaoc PP( (FILE *, Char *, int) ); +extern long P_maxpos PP( (FILE *) ); +extern Char *P_trimname PP( (Char *, int) ); +extern long *P_setunion PP( (long *, long *, long *) ); +extern long *P_setint PP( (long *, long *, long *) ); +extern long *P_setdiff PP( (long *, long *, long *) ); +extern long *P_setxor PP( (long *, long *, long *) ); +extern int P_inset PP( (unsigned, long *) ); +extern int P_setequal PP( (long *, long *) ); +extern int P_subset PP( (long *, long *) ); +extern long *P_addset PP( (long *, unsigned) ); +extern long *P_addsetr PP( (long *, unsigned, unsigned) ); +extern long *P_remset PP( (long *, unsigned) ); +extern long *P_setcpy PP( (long *, long *) ); +extern long *P_expset PP( (long *, long) ); +extern long P_packset PP( (long *) ); +extern int P_getcmdline PP( (int, int, Char *) ); +extern Void TimeStamp PP( (int *, int *, int *, + int *, int *, int *) ); +extern Void P_sun_argv PP( (char *, int, int) ); +extern FILE *_skipspaces PP( (FILE *) ); +extern FILE *_skipnlspaces PP( (FILE *) ); + + +/* I/O error handling */ +#define _CHKIO(cond,ior,val,def) ((cond) ? P_ioresult=0,(val) \ + : P_ioresult=(ior),(def)) +#define _SETIO(cond,ior) (P_ioresult = (cond) ? 0 : (ior)) + +/* Following defines are suitable for the HP Pascal operating system */ +#define FileNotFound 10 +#define FileNotOpen 13 +#define FileWriteError 38 +#define BadInputFormat 14 +#define EndOfFile 30 + +#define FILENOTFOUND 10 +#define FILENOTOPEN 13 +#define FILEWRITEERROR 38 +#define BADINPUTFORMAT 14 +#define ENDOFFILE 30 + +/* Creating temporary files */ +#if (defined(BSD) || defined(NO_TMPFILE)) && !defined(HAVE_TMPFILE) +# define tmpfile() (fopen(tmpnam(NULL), "w+")) +#endif + +/* File buffers */ +#define FILEBUF(f,sc,type) sc int __CAT__(f,_BFLAGS); \ + sc type __CAT__(f,_BUFFER) +#define FILEBUFNC(f,type) int __CAT__(f,_BFLAGS); \ + type __CAT__(f,_BUFFER) + +#define RESETBUF(f,type) (__CAT__(f,_BFLAGS) = 1) +#define SETUPBUF(f,type) (__CAT__(f,_BFLAGS) = 0) + +#define GETFBUF(f,type) (*((__CAT__(f,_BFLAGS) == 1 && \ + ((__CAT__(f,_BFLAGS) = 2), \ + fread(&__CAT__(f,_BUFFER), \ + sizeof(type),1,(f)))),\ + &__CAT__(f,_BUFFER))) +#define AGETFBUF(f,type) ((__CAT__(f,_BFLAGS) == 1 && \ + ((__CAT__(f,_BFLAGS) = 2), \ + fread(__CAT__(f,_BUFFER), \ + sizeof(type),1,(f)))),\ + __CAT__(f,_BUFFER)) + +#define PUTFBUF(f,type,v) (GETFBUF(f,type) = (v)) +#define CPUTFBUF(f,v) (PUTFBUF(f,char,v)) +#define APUTFBUF(f,type,v) (memcpy(AGETFBUF(f,type), (v), \ + sizeof(__CAT__(f,_BUFFER)))) + +#define GET(f,type) (__CAT__(f,_BFLAGS) == 1 ? \ + fread(&__CAT__(f,_BUFFER),sizeof(type),1,(f)) : \ + (__CAT__(f,_BFLAGS) = 1)) + +#define PUT(f,type) (fwrite(&__CAT__(f,_BUFFER),sizeof(type),1,(f)), \ + (__CAT__(f,_BFLAGS) = 0)) +#define CPUT(f) (PUT(f,char)) + +#define BUFEOF(f) (__CAT__(f,_BFLAGS) != 2 && P_eof(f)) +#define BUFFPOS(f) (ftell(f) - (__CAT__(f,_BFLAGS) == 2)) + +typedef struct { + FILE *f; + int f_BFLAGS; /* FILEBUFNC(f,Char); */ + Char f_BUFFER; + Char name[_FNSIZE]; +} _TEXT; + +/* Memory allocation */ +#ifdef __GCC__ +# define Malloc(n) (malloc(n) ?: (Anyptr)_OutMem()) +#else +extern Anyptr __MallocTemp__; +# define Malloc(n) ((__MallocTemp__ = malloc(n)) ? __MallocTemp__ : (Anyptr)_OutMem()) +#endif +#define FreeR(p) (free((Anyptr)(p))) /* used if arg is an rvalue */ +#define Free(p) (free((Anyptr)(p)), (p)=NULL) + +/* sign extension */ +#define SEXT(x,n) ((x) | -(((x) & (1L<<((n)-1))) << 1)) + +/* packed arrays */ /* BEWARE: these are untested! */ +#define P_getbits_UB(a,i,n,L) ((int)((a)[(i)>>(L)-(n)] >> \ + (((~(i))&((1<<(L)-(n))-1)) << (n)) & \ + (1<<(1<<(n)))-1)) + +#define P_getbits_SB(a,i,n,L) ((int)((a)[(i)>>(L)-(n)] << \ + (16 - ((((~(i))&((1<<(L)-(n))-1))+1) <<\ + (n)) >> (16-(1<<(n)))))) + +#define P_putbits_UB(a,i,x,n,L) ((a)[(i)>>(L)-(n)] |= \ + (x) << (((~(i))&((1<<(L)-(n))-1)) << (n))) + +#define P_putbits_SB(a,i,x,n,L) ((a)[(i)>>(L)-(n)] |= \ + ((x) & (1<<(1<<(n)))-1) << \ + (((~(i))&((1<<(L)-(n))-1)) << (n))) + +#define P_clrbits_B(a,i,n,L) ((a)[(i)>>(L)-(n)] &= \ + ~( ((1<<(1<<(n)))-1) << \ + (((~(i))&((1<<(L)-(n))-1)) << (n))) ) + +/* small packed arrays */ +#define P_getbits_US(v,i,n) ((int)((v) >> ((i)<<(n)) & (1<<(1<<(n)))-1)) +#define P_getbits_SS(v,i,n) ((int)((long)(v) << (SETBITS - (((i)+1) << (n))) >> (SETBITS-(1<<(n))))) +#define P_putbits_US(v,i,x,n) ((v) |= (x) << ((i) << (n))) +#define P_putbits_SS(v,i,x,n) ((v) |= ((x) & (1<<(1<<(n)))-1) << ((i)<<(n))) +#define P_clrbits_S(v,i,n) ((v) &= ~( ((1<<(1<<(n)))-1) << ((i)<<(n)) )) + +#define P_max(a,b) ((a) > (b) ? (a) : (b)) +#define P_min(a,b) ((a) < (b) ? (a) : (b)) + + +/* Fix ANSI-isms */ + +#ifdef LACK_LABS +# ifndef labs +# define labs my_labs + extern long my_labs PP( (long) ); +# endif +#endif + +#ifdef LACK_MEMMOVE +# ifndef memmove +# define memmove my_memmove + extern Anyptr my_memmove PP( (Anyptr, Const Anyptr, size_t) ); +# endif +#endif + +#ifdef LACK_MEMCPY +# ifndef memcpy +# define memcpy my_memcpy + extern Anyptr my_memcpy PP( (Anyptr, Const Anyptr, size_t) ); +# endif +# ifndef memcmp +# define memcmp my_memcmp + extern int my_memcmp PP( (Const Anyptr, Const Anyptr, size_t) ); +# endif +# ifndef memset +# define memset my_memset + extern Anyptr my_memset PP( (Anyptr, int, size_t) ); +# endif +#endif + +/* Fix toupper/tolower on Suns and other stupid BSD systems */ +#ifdef toupper +# undef toupper +# undef tolower +# define toupper(c) my_toupper(c) +# define tolower(c) my_tolower(c) +#endif + +#ifndef _toupper +# if 'A' == 65 && 'a' == 97 +# define _toupper(c) ((c)-'a'+'A') +# define _tolower(c) ((c)-'A'+'a') +# else +# ifdef toupper +# undef toupper /* hope these are shadowing real functions, */ +# undef tolower /* because my_toupper calls _toupper! */ +# endif +# define _toupper(c) toupper(c) +# define _tolower(c) tolower(c) +# endif +#endif + + +#endif /* P2C_H */ + + + +/* End. */ + + +
\ No newline at end of file diff --git a/support/rtflatex/p2clib_m.c b/support/rtflatex/p2clib_m.c new file mode 100644 index 0000000000..5c5fe8b8d7 --- /dev/null +++ b/support/rtflatex/p2clib_m.c @@ -0,0 +1,1117 @@ + +/* Run-time library for use with "p2c", the Pascal to C translator */ + +/* "p2c" Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation. + * By Dave Gillespie, daveg@synaptics.com. Version --VERSION--. + * This file may be copied, modified, etc. in any way. It is not restricted + * by the licence agreement accompanying p2c itself. + */ + + + +/* #include "p2c.h" % modif D. Taupin */ + + +#ifndef NO_TIME +# include <time.h> +#endif + + +#define Isspace(c) isspace(c) /* or "((c) == ' ')" if preferred */ + + + + +int P_argc; +char **P_argv; + +short P_escapecode; +int P_ioresult; + +long EXCP_LINE; /* Used by Pascal workstation system */ + +Anyptr __MallocTemp__; + +__p2c_jmp_buf *__top_jb; + + + + +void PASCAL_MAIN(argc, argv) +int argc; +char **argv; +{ + P_argc = argc; + P_argv = argv; + __top_jb = NULL; + +#ifdef LOCAL_INIT + LOCAL_INIT(); +#endif +} + + + + + +/* In case your system lacks these... */ + +long my_labs(x) +long x; +{ + return((x > 0) ? x : -x); +} + + +#ifdef __STDC__ +Anyptr my_memmove(Anyptr d, Const Anyptr s, size_t n) +#else +Anyptr my_memmove(d, s, n) +Anyptr d, s; +register int n; +#endif +{ + register char *dd = (char *)d, *ss = (char *)s; + if (dd < ss || dd - ss >= n) { +#if defined(bcopy) && defined(memcpy) + my_memcpy(dd, ss, n); +#else + memcpy(dd, ss, n); +#endif + } else if (n > 0) { + dd += n; + ss += n; + while (n-- > 0) + *--dd = *--ss; + } + return d; +} + + +#ifdef __STDC__ +Anyptr my_memcpy(Anyptr d, Const Anyptr s, size_t n) +#else +Anyptr my_memcpy(d, s, n) +Anyptr d, s; +register int n; +#endif +{ + register char *ss = (char *)s, *dd = (char *)d; + while (n-- > 0) + *dd++ = *ss++; + return d; +} + +#ifdef __STDC__ +int my_memcmp(Const Anyptr s1, Const Anyptr s2, size_t n) +#else +int my_memcmp(s1, s2, n) +Anyptr s1, s2; +register int n; +#endif +{ + register char *a = (char *)s1, *b = (char *)s2; + register int i; + while (n-- > 0) + if ((i = (*a++) - (*b++)) != 0) + return i; + return 0; +} + +#ifdef __STDC__ +Anyptr my_memset(Anyptr d, int c, size_t n) +#else +Anyptr my_memset(d, c, n) +Anyptr d; +register int c; +register int n; +#endif +{ + register char *dd = (char *)d; + while (n-- > 0) + *dd++ = c; + return d; +} + + +int my_toupper(c) +int c; +{ + if (islower(c)) + return _toupper(c); + else + return c; +} + + +int my_tolower(c) +int c; +{ + if (isupper(c)) + return _tolower(c); + else + return c; +} + + + + +long ipow(a, b) +long a, b; +{ + long v; + + if (a == 0 || a == 1) + return a; + if (a == -1) + return (b & 1) ? -1 : 1; + if (b < 0) + return 0; + if (a == 2) + return 1L << b; + v = (b & 1) ? a : 1; + while ((b >>= 1) > 0) { + a *= a; + if (b & 1) + v *= a; + } + return v; +} + + +long P_imax(a, b) +long a, b; +{ + if (a > b) + return a; + else + return b; +} + +long P_imin(a, b) +long a, b; +{ + if (a < b) + return a; + else + return b; +} + + +double P_rmax(a, b) +double a, b; +{ + if (a > b) + return a; + else + return b; +} + +double P_rmin(a, b) +double a, b; +{ + if (a < b) + return a; + else + return b; +} + + + + +/* Common string functions: */ + +/* Store in "ret" the substring of length "len" starting from "pos" (1-based). + Store a shorter or null string if out-of-range. Return "ret". */ + +char *strsub(ret, s, pos, len) +register char *ret, *s; +register int pos, len; +{ + register char *s2; + + if (--pos < 0 || len <= 0) { + *ret = 0; + return ret; + } + while (pos > 0) { + if (!*s++) { + *ret = 0; + return ret; + } + pos--; + } + s2 = ret; + while (--len >= 0) { + if (!(*s2++ = *s++)) + return ret; + } + *s2 = 0; + return ret; +} + + +/* Return the index of the first occurrence of "pat" as a substring of "s", + starting at index "pos" (1-based). Result is 1-based, 0 if not found. */ + +int strpos2(s, pat, pos) +char *s; +register char *pat; +register int pos; +{ + register char *cp, ch; + register int slen; + + if (--pos < 0) + return 0; + slen = strlen(s) - pos; + cp = s + pos; + if (!(ch = *pat++)) + return 0; + pos = strlen(pat); + slen -= pos; + while (--slen >= 0) { + if (*cp++ == ch && !strncmp(cp, pat, pos)) + return cp - s; + } + return 0; +} + + +/* Case-insensitive version of strcmp. */ + +int strcicmp(s1, s2) +register char *s1, *s2; +{ + register unsigned char c1, c2; + + while (*s1) { + if (*s1++ != *s2++) { + if (!s2[-1]) + return 1; + c1 = toupper(s1[-1]); + c2 = toupper(s2[-1]); + if (c1 != c2) + return c1 - c2; + } + } + if (*s2) + return -1; + return 0; +} + + + + +/* HP and Turbo Pascal string functions: */ + +/* Trim blanks at left end of string. */ + +char *strltrim(s) +register char *s; +{ + while (Isspace(*s++)) ; + return s - 1; +} + + +/* Trim blanks at right end of string. */ + +char *strrtrim(s) +register char *s; +{ + register char *s2 = s; + + if (!*s) + return s; + while (*++s2) ; + while (s2 > s && Isspace(*--s2)) + *s2 = 0; + return s; +} + + +/* Store in "ret" "num" copies of string "s". Return "ret". */ + +char *strrpt(ret, s, num) +char *ret; +register char *s; +register int num; +{ + register char *s2 = ret; + register char *s1; + + while (--num >= 0) { + s1 = s; + while ((*s2++ = *s1++)) ; + s2--; + } + return ret; +} + + +/* Store in "ret" string "s" with enough pad chars added to reach "size". */ + +char *strpad(ret, s, padchar, num) +char *ret; +register char *s; +register int padchar, num; +{ + register char *d = ret; + + if (s == d) { + while (*d++) ; + } else { + while ((*d++ = *s++)) ; + } + num -= (--d - ret); + while (--num >= 0) + *d++ = padchar; + *d = 0; + return ret; +} + + +/* Copy the substring of length "len" from index "spos" of "s" (1-based) + to index "dpos" of "d", lengthening "d" if necessary. Length and + indices must be in-range. */ + +void strmove(len, s, spos, d, dpos) +register char *s, *d; +register int len, spos, dpos; +{ + s += spos - 1; + d += dpos - 1; + while (*d && --len >= 0) + *d++ = *s++; + if (len > 0) { + while (--len >= 0) + *d++ = *s++; + *d = 0; + } +} + + +/* Delete the substring of length "len" at index "pos" from "s". + Delete less if out-of-range. */ + +void strdelete(s, pos, len) +register char *s; +register int pos, len; +{ + register int slen; + + if (--pos < 0) + return; + slen = strlen(s) - pos; + if (slen <= 0) + return; + s += pos; + if (slen <= len) { + *s = 0; + return; + } + while ((*s = s[len])) s++; +} + + +/* Insert string "src" at index "pos" of "dst". */ + +void strinsert(src, dst, pos) +register char *src, *dst; +register int pos; +{ + register int slen, dlen; + + if (--pos < 0) + return; + dlen = strlen(dst); + dst += dlen; + dlen -= pos; + if (dlen <= 0) { + strcpy(dst, src); + return; + } + slen = strlen(src); + do { + dst[slen] = *dst; + --dst; + } while (--dlen >= 0); + dst++; + while (--slen >= 0) + *dst++ = *src++; +} + + + + +/* File functions */ + +/* Peek at next character of input stream; return EOF at end-of-file. */ + +int P_peek(f) +FILE *f; +{ + int ch; + + ch = getc(f); + if (ch == EOF) + return EOF; + ungetc(ch, f); + return (ch == '\n') ? ' ' : ch; +} + + +/* Check if at end of file, using Pascal "eof" semantics. End-of-file for + stdin is broken; remove the special case for it to be broken in a + different way. */ + +int P_eof(f) +FILE *f; +{ + register int ch; + + if (feof(f)) + return 1; +#ifdef HAVE_ISATTY + if (isatty(fileno(f))) +#else + if (f == stdin) +#endif + return 0; /* not safe to look-ahead on the keyboard! */ + ch = getc(f); + if (ch == EOF) + return 1; + ungetc(ch, f); + return 0; +} + + +/* Check if at end of line (or end of entire file). */ + +int P_eoln(f) +FILE *f; +{ + register int ch; + + ch = getc(f); + if (ch == EOF) + return 1; + ungetc(ch, f); + return (ch == '\n'); +} + + +/* Skip whitespace (including newlines) in a file. */ + +FILE *_skipnlspaces(f) +FILE *f; +{ + register int ch; + + do { + ch = getc(f); + } while (ch == ' ' || ch == '\t' || ch == '\n'); + if (ch != EOF) + ungetc(ch, f); + return f; +} + + +/* Skip whitespace (not including newlines) in a file. */ + +FILE *_skipspaces(f) +FILE *f; +{ + register int ch; + + do { + ch = getc(f); + } while (ch == ' ' || ch == '\t'); + if (ch != EOF) + ungetc(ch, f); + return f; +} + + +/* Read a packed array of characters from a file. */ + +Void P_readpaoc(f, s, len) +FILE *f; +char *s; +int len; +{ + int ch; + + for (;;) { + if (len <= 0) + return; + ch = getc(f); + if (ch == EOF || ch == '\n') + break; + *s++ = ch; + --len; + } + while (--len >= 0) + *s++ = ' '; + if (ch != EOF) + ungetc(ch, f); +} + +Void P_readlnpaoc(f, s, len) +FILE *f; +char *s; +int len; +{ + int ch; + + for (;;) { + ch = getc(f); + if (ch == EOF || ch == '\n') + break; + if (len > 0) { + *s++ = ch; + --len; + } + } + while (--len >= 0) + *s++ = ' '; +} + + +/* Compute maximum legal "seek" index in file (0-based). */ + +long P_maxpos(f) +FILE *f; +{ + long savepos = ftell(f); + long val; + + if (fseek(f, 0L, SEEK_END)) + return -1; + val = ftell(f); + if (fseek(f, savepos, SEEK_SET)) + return -1; + return val; +} + + +/* Use packed array of char for a file name. */ + +Char *P_trimname(fn, len) +register Char *fn; +register int len; +{ + static Char fnbuf[256]; + register Char *cp = fnbuf; + + while (--len >= 0 && *fn && !isspace(*fn)) + *cp++ = *fn++; + *cp = 0; + return fnbuf; +} + + + + +/* Pascal's "memavail" doesn't make much sense in Unix with virtual memory. + We fix memory size as 10Meg as a reasonable compromise. */ + +long memavail() +{ + return 10000000; /* worry about this later! */ +} + +long maxavail() +{ + return memavail(); +} + + + + +/* Sets are stored as an array of longs. S[0] is the size of the set; + S[N] is the N'th 32-bit chunk of the set. S[0] equals the maximum + I such that S[I] is nonzero. S[0] is zero for an empty set. Within + each long, bits are packed from lsb to msb. The first bit of the + set is the element with ordinal value 0. (Thus, for a "set of 5..99", + the lowest five bits of the first long are unused and always zero.) */ + +/* (Sets with 32 or fewer elements are normally stored as plain longs.) */ + +long *P_setunion(d, s1, s2) /* d := s1 + s2 */ +register long *d, *s1, *s2; +{ + long *dbase = d++; + register int sz1 = *s1++, sz2 = *s2++; + while (sz1 > 0 && sz2 > 0) { + *d++ = *s1++ | *s2++; + sz1--, sz2--; + } + while (--sz1 >= 0) + *d++ = *s1++; + while (--sz2 >= 0) + *d++ = *s2++; + *dbase = d - dbase - 1; + return dbase; +} + + +long *P_setint(d, s1, s2) /* d := s1 * s2 */ +register long *d, *s1, *s2; +{ + long *dbase = d++; + register int sz1 = *s1++, sz2 = *s2++; + while (--sz1 >= 0 && --sz2 >= 0) + *d++ = *s1++ & *s2++; + while (--d > dbase && !*d) ; + *dbase = d - dbase; + return dbase; +} + + +long *P_setdiff(d, s1, s2) /* d := s1 - s2 */ +register long *d, *s1, *s2; +{ + long *dbase = d++; + register int sz1 = *s1++, sz2 = *s2++; + while (--sz1 >= 0 && --sz2 >= 0) + *d++ = *s1++ & ~*s2++; + if (sz1 >= 0) { + while (sz1-- >= 0) + *d++ = *s1++; + } + while (--d > dbase && !*d) ; + *dbase = d - dbase; + return dbase; +} + + +long *P_setxor(d, s1, s2) /* d := s1 / s2 */ +register long *d, *s1, *s2; +{ + long *dbase = d++; + register int sz1 = *s1++, sz2 = *s2++; + while (sz1 > 0 && sz2 > 0) { + *d++ = *s1++ ^ *s2++; + sz1--, sz2--; + } + while (--sz1 >= 0) + *d++ = *s1++; + while (--sz2 >= 0) + *d++ = *s2++; + while (--d > dbase && !*d) ; + *dbase = d - dbase; + return dbase; +} + + +int P_inset(val, s) /* val IN s */ +register unsigned val; +register long *s; +{ + register int bit; + bit = val % SETBITS; + val /= SETBITS; + if (val < *s++ && ((1L<<bit) & s[val])) + return 1; + return 0; +} + + +long *P_addset(s, val) /* s := s + [val] */ +register long *s; +register unsigned val; +{ + register long *sbase = s; + register int bit, size; + bit = val % SETBITS; + val /= SETBITS; + size = *s; + if (++val > size) { + s += size; + while (val > size) + *++s = 0, size++; + *sbase = size; + } else + s += val; + *s |= 1L<<bit; + return sbase; +} + + +long *P_addsetr(s, v1, v2) /* s := s + [v1..v2] */ +register long *s; +register unsigned v1, v2; +{ + register long *sbase = s; + register int b1, b2, size; + if ((int)v1 > (int)v2) + return sbase; + b1 = v1 % SETBITS; + v1 /= SETBITS; + b2 = v2 % SETBITS; + v2 /= SETBITS; + size = *s; + v1++; + if (++v2 > size) { + while (v2 > size) + s[++size] = 0; + s[v2] = 0; + *s = v2; + } + s += v1; + if (v1 == v2) { + *s |= (~((-2L)<<(b2-b1))) << b1; + } else { + *s++ |= (-1L) << b1; + while (++v1 < v2) + *s++ = -1; + *s |= ~((-2L) << b2); + } + return sbase; +} + + +long *P_remset(s, val) /* s := s - [val] */ +register long *s; +register unsigned val; +{ + register int bit; + bit = val % SETBITS; + val /= SETBITS; + if (++val <= *s) { + if (!(s[val] &= ~(1L<<bit))) + while (*s && !s[*s]) + (*s)--; + } + return s; +} + + +int P_setequal(s1, s2) /* s1 = s2 */ +register long *s1, *s2; +{ + register int size = *s1++; + if (*s2++ != size) + return 0; + while (--size >= 0) { + if (*s1++ != *s2++) + return 0; + } + return 1; +} + + +int P_subset(s1, s2) /* s1 <= s2 */ +register long *s1, *s2; +{ + register int sz1 = *s1++, sz2 = *s2++; + if (sz1 > sz2) + return 0; + while (--sz1 >= 0) { + if (*s1++ & ~*s2++) + return 0; + } + return 1; +} + + +long *P_setcpy(d, s) /* d := s */ +register long *d, *s; +{ + register long *save_d = d; + +#ifdef SETCPY_MEMCPY + memcpy(d, s, (*s + 1) * sizeof(long)); +#else + register int i = *s + 1; + while (--i >= 0) + *d++ = *s++; +#endif + return save_d; +} + + +/* s is a "smallset", i.e., a 32-bit or less set stored + directly in a long. */ + +long *P_expset(d, s) /* d := s */ +register long *d; +register long s; +{ + if (s) { + d[1] = s; + *d = 1; + } else + *d = 0; + return d; +} + + +long P_packset(s) /* convert s to a small-set */ +register long *s; +{ + if (*s++) + return *s; + else + return 0; +} + + + + + +/* Oregon Software Pascal extensions, courtesy of William Bader */ + +int P_getcmdline(l, h, line) +int l, h; +Char *line; +{ + int i, len; + char *s; + + h = h - l + 1; + len = 0; + for(i = 1; i < P_argc; i++) { + s = P_argv[i]; + while (*s) { + if (len >= h) return len; + line[len++] = *s++; + } + if (len >= h) return len; + line[len++] = ' '; + } + return len; +} + +Void TimeStamp(Day, Month, Year, Hour, Min, Sec) +int *Day, *Month, *Year, *Hour, *Min, *Sec; +{ +#ifndef NO_TIME + struct tm *tm; + long clock; + + time(&clock); + tm = localtime(&clock); + *Day = tm->tm_mday; + *Month = tm->tm_mon + 1; /* Jan = 0 */ + *Year = tm->tm_year; + if (*Year < 1900) + *Year += 1900; /* year since 1900 */ + *Hour = tm->tm_hour; + *Min = tm->tm_min; + *Sec = tm->tm_sec; +#endif +} + +Void VAXdate(s) +char *s; +{ + long clock; + char *c; + int i; + static int where[] = {8, 9, 0, 4, 5, 6, 0, 20, 21, 22, 23}; + + time(&clock); + c = ctime(&clock); + for (i = 0; i < 11; i++) + s[i] = my_toupper(c[where[i]]); + s[2] = '-'; + s[6] = '-'; +} + +Void VAXtime(s) +char *s; +{ + long clock; + char *c; + int i; + + time(&clock); + c = ctime(&clock); + for (i = 0; i < 8; i++) + s[i] = c[i+11]; + s[8] = '.'; + s[9] = '0'; + s[10] = '0'; +} + + + + +/* SUN Berkeley Pascal extensions */ + +Void P_sun_argv(s, len, n) +register char *s; +register int len, n; +{ + register char *cp; + + if ((unsigned)n < P_argc) + cp = P_argv[n]; + else + cp = ""; + while (*cp && --len >= 0) + *s++ = *cp++; + while (--len >= 0) + *s++ = ' '; +} + + + + +int _OutMem() +{ + return _Escape(-2); +} + +int _CaseCheck() +{ + return _Escape(-9); +} + +int _NilCheck() +{ + return _Escape(-3); +} + + + + + +/* The following is suitable for the HP Pascal operating system. + It might want to be revised when emulating another system. */ + +char *_ShowEscape(buf, code, ior, prefix) +char *buf, *prefix; +int code, ior; +{ + char *bufp; + + if (prefix && *prefix) { + strcpy(buf, prefix); + strcat(buf, ": "); + bufp = buf + strlen(buf); + } else { + bufp = buf; + } + if (code == -10) { + sprintf(bufp, "Pascal system I/O error %d", ior); + switch (ior) { + case 3: + strcat(buf, " (illegal I/O request)"); + break; + case 7: + strcat(buf, " (bad file name)"); + break; + case FileNotFound: /*10*/ + strcat(buf, " (file not found)"); + break; + case FileNotOpen: /*13*/ + strcat(buf, " (file not open)"); + break; + case BadInputFormat: /*14*/ + strcat(buf, " (bad input format)"); + break; + case 24: + strcat(buf, " (not open for reading)"); + break; + case 25: + strcat(buf, " (not open for writing)"); + break; + case 26: + strcat(buf, " (not open for direct access)"); + break; + case 28: + strcat(buf, " (string subscript out of range)"); + break; + case EndOfFile: /*30*/ + strcat(buf, " (end-of-file)"); + break; + case FileWriteError: /*38*/ + strcat(buf, " (file write error)"); + break; + } + } else { + sprintf(bufp, "Pascal system error %d", code); + switch (code) { + case -2: + strcat(buf, " (out of memory)"); + break; + case -3: + strcat(buf, " (reference to NIL pointer)"); + break; + case -4: + strcat(buf, " (integer overflow)"); + break; + case -5: + strcat(buf, " (divide by zero)"); + break; + case -6: + strcat(buf, " (real math overflow)"); + break; + case -8: + strcat(buf, " (value range error)"); + break; + case -9: + strcat(buf, " (CASE value range error)"); + break; + case -12: + strcat(buf, " (bus error)"); + break; + case -20: + strcat(buf, " (stopped by user)"); + break; + } + } + return buf; +} + + +int _Escape(code) +int code; +{ + char buf[100]; + + P_escapecode = code; + if (__top_jb) { + __p2c_jmp_buf *jb = __top_jb; + __top_jb = jb->next; + longjmp(jb->jbuf, 1); + } + if (code == 0) + exit(EXIT_SUCCESS); + if (code == -1) + exit(EXIT_FAILURE); + fprintf(stderr, "%s\n", _ShowEscape(buf, P_escapecode, P_ioresult, "")); + exit(EXIT_FAILURE); +} + +int _EscIO(code) +int code; +{ + P_ioresult = code; + return _Escape(-10); +} + +int _EscIO2(code, name) +int code; +char *name; +{ + P_ioresult = code; + if (!__top_jb && name && *name) { + char buf[100]; + fprintf(stderr, "%s: %s\n", + name, _ShowEscape(buf, P_escapecode, P_ioresult, "")); + exit(EXIT_FAILURE); + } + return _Escape(-10); +} + + + +/* End. */ + + + diff --git a/support/rtflatex/p2crtf.h b/support/rtflatex/p2crtf.h new file mode 100644 index 0000000000..201a19c7c9 --- /dev/null +++ b/support/rtflatex/p2crtf.h @@ -0,0 +1,512 @@ +#ifndef P2C_H +#define P2C_H +#define HAS_STDLIB + + +/* Header file for code generated by "p2c", the Pascal-to-C translator */ + +/* "p2c" Copyright (C) 1989, 1990, 1991 Free Software Foundation. + * By Dave Gillespie, daveg@csvax.cs.caltech.edu. Version 1.20. + * This file may be copied, modified, etc. in any way. It is not restricted + * by the licence agreement accompanying p2c itself. + */ + + +#include <stdio.h> + + + +/* If the following heuristic fails, compile -DBSD=0 for non-BSD systems, + or -DBSD=1 for BSD systems. */ + +#ifdef M_XENIX +# define BSD 0 +#endif + +#ifdef vms +# define BSD 0 +# ifndef __STDC__ +# define __STDC__ 1 +# endif +#endif + +#ifdef __TURBOC__ +# define MSDOS 1 +#endif + +#ifdef MSDOS +# define BSD 0 +#endif + +#ifdef FILE /* a #define in BSD, a typedef in SYSV (hp-ux, at least) */ +# ifndef BSD /* (a convenient, but horrible kludge!) */ +# define BSD 1 +# endif +#endif + +#ifdef BSD +# if !BSD +# undef BSD +# endif +#endif + + +#if (defined(__STDC__) && !defined(M_XENIX)) || defined(__TURBOC__) +# include <stddef.h> +# include <stdlib.h> +# define HAS_STDLIB +# if defined(vms) || defined(__TURBOC__) +# define __ID__(a)a +# endif +#else +# ifndef BSD +# ifndef __TURBOC__ +# include <memory.h> +# endif +# endif +# ifdef hpux +# ifdef _INCLUDE__STDC__ +# include <stddef.h> +# include <stdlib.h> +# endif +# endif +# include <sys/types.h> +# if !defined(MSDOS) || defined(__TURBOC__) +# define __ID__(a)a +# endif +#endif + +#ifdef __ID__ +# define __CAT__(a,b)__ID__(a)b +#else +# define __CAT__(a,b)a##b +#endif + + +#ifdef BSD +# include <strings.h> +# define memcpy(a,b,n) (bcopy(b,a,n),a) +# define memcmp(a,b,n) bcmp(a,b,n) +# define strchr(s,c) index(s,c) +# define strrchr(s,c) rindex(s,c) +#else +# include <string.h> +#endif + +#include <ctype.h> +#include <math.h> +#include <setjmp.h> +#include <assert.h> + + +#ifndef NO_LACK +#ifdef vms + +#define LACK_LABS +#define LACK_MEMMOVE +#define LACK_MEMCPY + +#else + +#define LACK_LABS /* Undefine these if your library has these */ +#define LACK_MEMMOVE + +#endif +#endif + + +typedef struct __p2c_jmp_buf { + struct __p2c_jmp_buf *next; + jmp_buf jbuf; +} __p2c_jmp_buf; + + +/* Warning: The following will not work if setjmp is used simultaneously. + This also violates the ANSI restriction about using vars after longjmp, + but a typical implementation of longjmp will get it right anyway. */ + +#ifndef FAKE_TRY +# define TRY(x) do { __p2c_jmp_buf __try_jb; \ + __try_jb.next = __top_jb; \ + if (!setjmp((__top_jb = &__try_jb)->jbuf)) { +# define RECOVER(x) __top_jb = __try_jb.next; } else { +# define RECOVER2(x,L) __top_jb = __try_jb.next; } else { \ + if (0) { L: __top_jb = __try_jb.next; } +# define ENDTRY(x) } } while (0) +#else +# define TRY(x) if (1) { +# define RECOVER(x) } else do { +# define RECOVER2(x,L) } else do { L: ; +# define ENDTRY(x) } while (0) +#endif + + + +#ifdef M_XENIX /* avoid compiler bug */ +# define SHORT_MAX (32767) +# define SHORT_MIN (-32768) +#endif + + +/* The following definitions work only on twos-complement machines */ +#ifndef SHORT_MAX +# define SHORT_MAX ((short)(((unsigned short) -1) >> 1)) +# define SHORT_MIN (~SHORT_MAX) +#endif + +#ifndef INT_MAX +# define INT_MAX ((int)(((unsigned int) -1) >> 1)) +# define INT_MIN (~INT_MAX) +#endif + +#ifndef LONG_MAX +# define LONG_MAX ((long)(((unsigned long) -1) >> 1)) +# define LONG_MIN (~LONG_MAX) +#endif + +#ifndef SEEK_SET +# define SEEK_SET 0 +# define SEEK_CUR 1 +# define SEEK_END 2 +#endif + +#ifndef EXIT_SUCCESS +# ifdef vms +# define EXIT_SUCCESS 1 +# define EXIT_FAILURE (02000000000L) +# else +# define EXIT_SUCCESS 0 +# define EXIT_FAILURE 1 +# endif +#endif + + +#define SETBITS 32 + + +#if defined(__STDC__) || defined(__TURBOC__) +# if !defined(vms) && !defined(M_LINT) +# define Signed signed +# else +# define Signed +# endif +# define Void void /* Void f() = procedure */ +# ifndef Const +# define Const const +# endif +# ifndef Volatile +# define Volatile volatile +# endif +# ifdef M_LINT +# define PP(x) () +# define PV() () +typedef char *Anyptr; +# else +# define PP(x) x /* function prototype */ +# define PV() (void) /* null function prototype */ +typedef void *Anyptr; +# endif +#else +# define Signed +# define Void void +# ifndef Const +# define Const +# endif +# ifndef Volatile +# define Volatile +# endif +# define PP(x) () +# define PV() () +typedef char *Anyptr; +#endif + +#ifdef __GNUC__ +# define Inline inline +#else +# define Inline +#endif + +#define Register register /* Register variables */ +#define Char char /* Characters (not bytes) */ + +#ifndef Static +# define Static static /* Private global funcs and vars */ +#endif + +#ifndef Local +# define Local static /* Nested functions */ +#endif + +typedef Signed char schar; +typedef unsigned char uchar; +typedef unsigned char boolean; + +#ifndef true +# define true 1 +# define false 0 +#endif + +#ifndef TRUE +# define TRUE 1 +# define FALSE 0 +#endif + + +typedef struct { + Anyptr proc, link; +} _PROCEDURE; + +#ifndef _FNSIZE +# define _FNSIZE 120 +#endif + + +extern Void PASCAL_MAIN PP( (int, Char **) ); +extern Char **P_argv; +extern int P_argc; +extern short P_escapecode; +extern int P_ioresult; +extern __p2c_jmp_buf *__top_jb; + + +#ifdef P2C_H_PROTO /* if you have Ansi C but non-prototyped header files */ +extern Char *strcat PP( (Char *, Const Char *) ); +extern Char *strchr PP( (Const Char *, int) ); +extern int strcmp PP( (Const Char *, Const Char *) ); +extern Char *strcpy PP( (Char *, Const Char *) ); +extern size_t strlen PP( (Const Char *) ); +extern Char *strncat PP( (Char *, Const Char *, size_t) ); +extern int strncmp PP( (Const Char *, Const Char *, size_t) ); +extern Char *strncpy PP( (Char *, Const Char *, size_t) ); +extern Char *strrchr PP( (Const Char *, int) ); + +extern Anyptr memchr PP( (Const Anyptr, int, size_t) ); +extern Anyptr memmove PP( (Anyptr, Const Anyptr, size_t) ); +extern Anyptr memset PP( (Anyptr, int, size_t) ); +#ifndef memcpy +extern Anyptr memcpy PP( (Anyptr, Const Anyptr, size_t) ); +extern int memcmp PP( (Const Anyptr, Const Anyptr, size_t) ); +#endif + +extern int atoi PP( (Const Char *) ); +extern double atof PP( (Const Char *) ); +extern long atol PP( (Const Char *) ); +extern double strtod PP( (Const Char *, Char **) ); +extern long strtol PP( (Const Char *, Char **, int) ); +#endif /*P2C_H_PROTO*/ + +#ifndef HAS_STDLIB +extern Anyptr malloc PP( (size_t) ); +extern Void free PP( (Anyptr) ); +#endif + +extern int _OutMem PV(); +extern int _CaseCheck PV(); +extern int _NilCheck PV(); +extern int _Escape PP( (int) ); +extern int _EscIO PP( (int) ); + +extern long ipow PP( (long, long) ); +extern Char *strsub PP( (Char *, Char *, int, int) ); +extern Char *strltrim PP( (Char *) ); +extern Char *strrtrim PP( (Char *) ); +extern Char *strrpt PP( (Char *, Char *, int) ); +extern Char *strpad PP( (Char *, Char *, int, int) ); +extern int strpos2 PP( (Char *, Char *, int) ); +extern long memavail PV(); +extern int P_peek PP( (FILE *) ); +extern int P_eof PP( (FILE *) ); +extern int P_eoln PP( (FILE *) ); +extern Void P_readpaoc PP( (FILE *, Char *, int) ); +extern Void P_readlnpaoc PP( (FILE *, Char *, int) ); +extern long P_maxpos PP( (FILE *) ); +extern Char *P_trimname PP( (Char *, int) ); +extern long *P_setunion PP( (long *, long *, long *) ); +extern long *P_setint PP( (long *, long *, long *) ); +extern long *P_setdiff PP( (long *, long *, long *) ); +extern long *P_setxor PP( (long *, long *, long *) ); +extern int P_inset PP( (unsigned, long *) ); +extern int P_setequal PP( (long *, long *) ); +extern int P_subset PP( (long *, long *) ); +extern long *P_addset PP( (long *, unsigned) ); +extern long *P_addsetr PP( (long *, unsigned, unsigned) ); +extern long *P_remset PP( (long *, unsigned) ); +extern long *P_setcpy PP( (long *, long *) ); +extern long *P_expset PP( (long *, long) ); +extern long P_packset PP( (long *) ); +extern int P_getcmdline PP( (int, int, Char *) ); +extern Void TimeStamp PP( (int *, int *, int *, + int *, int *, int *) ); +extern Void P_sun_argv PP( (char *, int, int) ); + + +/* I/O error handling */ +#define _CHKIO(cond,ior,val,def) ((cond) ? P_ioresult=0,(val) \ + : P_ioresult=(ior),(def)) +#define _SETIO(cond,ior) (P_ioresult = (cond) ? 0 : (ior)) + +/* Following defines are suitable for the HP Pascal operating system */ +#define FileNotFound 10 +#define FileNotOpen 13 +#define FileWriteError 38 +#define BadInputFormat 14 +#define EndOfFile 30 + +#define FILENOTFOUND 10 +#define FILENOTOPEN 13 +#define FILEWRITEERROR 38 +#define BADINPUTFORMAT 14 +#define ENDOFFILE 30 + +/* Creating temporary files */ +#if (defined(BSD) || defined(NO_TMPFILE)) && !defined(HAVE_TMPFILE) +# define tmpfile() (fopen(tmpnam(NULL), "w+")) +#endif + +/* File buffers */ +#define FILEBUF(f,sc,type) sc int __CAT__(f,_BFLAGS); \ + sc type __CAT__(f,_BUFFER) +#define FILEBUFNC(f,type) int __CAT__(f,_BFLAGS); \ + type __CAT__(f,_BUFFER) + +#define RESETBUF(f,type) (__CAT__(f,_BFLAGS) = 1) +#define SETUPBUF(f,type) (__CAT__(f,_BFLAGS) = 0) + +#define GETFBUF(f,type) (*((__CAT__(f,_BFLAGS) == 1 && \ + ((__CAT__(f,_BFLAGS) = 2), \ + fread(&__CAT__(f,_BUFFER), \ + sizeof(type),1,(f)))),\ + &__CAT__(f,_BUFFER))) +#define AGETFBUF(f,type) ((__CAT__(f,_BFLAGS) == 1 && \ + ((__CAT__(f,_BFLAGS) = 2), \ + fread(__CAT__(f,_BUFFER), \ + sizeof(type),1,(f)))),\ + __CAT__(f,_BUFFER)) + +#define PUTFBUF(f,type,v) (GETFBUF(f,type) = (v)) +#define CPUTFBUF(f,v) (PUTFBUF(f,char,v)) +#define APUTFBUF(f,type,v) (memcpy(AGETFBUF(f,type), (v), \ + sizeof(__CAT__(f,_BUFFER)))) + +#define GET(f,type) (__CAT__(f,_BFLAGS) == 1 ? \ + fread(&__CAT__(f,_BUFFER),sizeof(type),1,(f)) : \ + (__CAT__(f,_BFLAGS) = 1)) + +#define PUT(f,type) (fwrite(&__CAT__(f,_BUFFER),sizeof(type),1,(f)), \ + (__CAT__(f,_BFLAGS) = 0)) +#define CPUT(f) (PUT(f,char)) + +#define BUFEOF(f) (__CAT__(f,_BFLAGS) != 2 && P_eof(f)) +#define BUFFPOS(f) (ftell(f) - (__CAT__(f,_BFLAGS) == 2)) + +typedef struct { + FILE *f; + FILEBUFNC(f,Char); + Char name[_FNSIZE]; +} _TEXT; + +/* Memory allocation */ +#ifdef __GCC__ +# define Malloc(n) (malloc(n) ?: (Anyptr)_OutMem()) +#else +extern Anyptr __MallocTemp__; +# define Malloc(n) ((__MallocTemp__ = malloc(n)) ? __MallocTemp__ : (Anyptr)_OutMem()) +#endif +#define FreeR(p) (free((Anyptr)(p))) /* used if arg is an rvalue */ +#define Free(p) (free((Anyptr)(p)), (p)=NULL) + +/* sign extension */ +#define SEXT(x,n) ((x) | -(((x) & (1L<<((n)-1))) << 1)) + +/* packed arrays */ /* BEWARE: these are untested! */ +#define P_getbits_UB(a,i,n,L) ((int)((a)[(i)>>(L)-(n)] >> \ + (((~(i))&((1<<(L)-(n))-1)) << (n)) & \ + (1<<(1<<(n)))-1)) + +#define P_getbits_SB(a,i,n,L) ((int)((a)[(i)>>(L)-(n)] << \ + (16 - ((((~(i))&((1<<(L)-(n))-1))+1) <<\ + (n)) >> (16-(1<<(n)))))) + +#define P_putbits_UB(a,i,x,n,L) ((a)[(i)>>(L)-(n)] |= \ + (x) << (((~(i))&((1<<(L)-(n))-1)) << (n))) + +#define P_putbits_SB(a,i,x,n,L) ((a)[(i)>>(L)-(n)] |= \ + ((x) & (1<<(1<<(n)))-1) << \ + (((~(i))&((1<<(L)-(n))-1)) << (n))) + +#define P_clrbits_B(a,i,n,L) ((a)[(i)>>(L)-(n)] &= \ + ~( ((1<<(1<<(n)))-1) << \ + (((~(i))&((1<<(L)-(n))-1)) << (n))) ) + +/* small packed arrays */ +#define P_getbits_US(v,i,n) ((int)((v) >> ((i)<<(n)) & (1<<(1<<(n)))-1)) +#define P_getbits_SS(v,i,n) ((int)((long)(v) << (SETBITS - (((i)+1) << (n))) >> (SETBITS-(1<<(n))))) +#define P_putbits_US(v,i,x,n) ((v) |= (x) << ((i) << (n))) +#define P_putbits_SS(v,i,x,n) ((v) |= ((x) & (1<<(1<<(n)))-1) << ((i)<<(n))) +#define P_clrbits_S(v,i,n) ((v) &= ~( ((1<<(1<<(n)))-1) << ((i)<<(n)) )) + +#define P_max(a,b) ((a) > (b) ? (a) : (b)) +#define P_min(a,b) ((a) < (b) ? (a) : (b)) + + +/* Fix ANSI-isms */ + +#ifdef LACK_LABS +# ifndef labs +# define labs my_labs + extern long my_labs PP( (long) ); +# endif +#endif + +#ifdef LACK_MEMMOVE +# ifndef memmove +# define memmove my_memmove + extern Anyptr my_memmove PP( (Anyptr, Const Anyptr, size_t) ); +# endif +#endif + +#ifdef LACK_MEMCPY +# ifndef memcpy +# define memcpy my_memcpy + extern Anyptr my_memcpy PP( (Anyptr, Const Anyptr, size_t) ); +# endif +# ifndef memcmp +# define memcmp my_memcmp + extern int my_memcmp PP( (Const Anyptr, Const Anyptr, size_t) ); +# endif +# ifndef memset +# define memset my_memset + extern Anyptr my_memset PP( (Anyptr, int, size_t) ); +# endif +#endif + +/* Fix toupper/tolower on Suns and other stupid BSD systems */ +#ifdef toupper +# undef toupper +# undef tolower +# define toupper(c) my_toupper(c) +# define tolower(c) my_tolower(c) +#endif + +#ifndef _toupper +# if 'A' == 65 && 'a' == 97 +# define _toupper(c) ((c)-'a'+'A') +# define _tolower(c) ((c)-'A'+'a') +# else +# ifdef toupper +# undef toupper /* hope these are shadowing real functions, */ +# undef tolower /* because my_toupper calls _toupper! */ +# endif +# define _toupper(c) toupper(c) +# define _tolower(c) tolower(c) +# endif +#endif + + +#endif /* P2C_H */ + + + +/* End. */ + + diff --git a/support/rtflatex/p2crtf_o.h b/support/rtflatex/p2crtf_o.h new file mode 100644 index 0000000000..d5b2c8db8c --- /dev/null +++ b/support/rtflatex/p2crtf_o.h @@ -0,0 +1,514 @@ +#ifndef P2C_H +#define P2C_H + +/* modif by D. Taupin */ +# define HAS_STDLIB + +/* Header file for code generated by "p2c", the Pascal-to-C translator */ + +/* "p2c" Copyright (C) 1989, 1990, 1991 Free Software Foundation. + * By Dave Gillespie, daveg@csvax.cs.caltech.edu. Version 1.20. + * This file may be copied, modified, etc. in any way. It is not restricted + * by the licence agreement accompanying p2c itself. + */ + + +#include <stdio.h> + + + +/* If the following heuristic fails, compile -DBSD=0 for non-BSD systems, + or -DBSD=1 for BSD systems. */ + +#ifdef M_XENIX +# define BSD 0 +#endif + +#ifdef vms +# define BSD 0 +# ifndef __STDC__ +# define __STDC__ 1 +# endif +#endif + +#ifdef __TURBOC__ +# define MSDOS 1 +#endif + +#ifdef MSDOS +# define BSD 0 +#endif + +#ifdef FILE /* a #define in BSD, a typedef in SYSV (hp-ux, at least) */ +# ifndef BSD /* (a convenient, but horrible kludge!) */ +# define BSD 1 +# endif +#endif + +#ifdef BSD +# if !BSD +# undef BSD +# endif +#endif + + +#if (defined(__STDC__) && !defined(M_XENIX)) || defined(__TURBOC__) +# include <stddef.h> +# include <stdlib.h> +# define HAS_STDLIB +# if defined(vms) || defined(__TURBOC__) +# define __ID__(a)a +# endif +#else +# ifndef BSD +# ifndef __TURBOC__ +# include <memory.h> +# endif +# endif +# ifdef hpux +# ifdef _INCLUDE__STDC__ +# include <stddef.h> +# include <stdlib.h> +# endif +# endif +# include <sys/types.h> +# if !defined(MSDOS) || defined(__TURBOC__) +# define __ID__(a)a +# endif +#endif + +#ifdef __ID__ +# define __CAT__(a,b)__ID__(a)b +#else +# define __CAT__(a,b)a##b +#endif + + +#ifdef BSD +# include <strings.h> +# define memcpy(a,b,n) (bcopy(b,a,n),a) +# define memcmp(a,b,n) bcmp(a,b,n) +# define strchr(s,c) index(s,c) +# define strrchr(s,c) rindex(s,c) +#else +# include <string.h> +#endif + +#include <ctype.h> +#include <math.h> +#include <setjmp.h> +#include <assert.h> + + +#ifndef NO_LACK +#ifdef vms + +#define LACK_LABS +#define LACK_MEMMOVE +#define LACK_MEMCPY + +#else + +#define LACK_LABS /* Undefine these if your library has these */ +#define LACK_MEMMOVE + +#endif +#endif + + +typedef struct __p2c_jmp_buf { + struct __p2c_jmp_buf *next; + jmp_buf jbuf; +} __p2c_jmp_buf; + + +/* Warning: The following will not work if setjmp is used simultaneously. + This also violates the ANSI restriction about using vars after longjmp, + but a typical implementation of longjmp will get it right anyway. */ + +#ifndef FAKE_TRY +# define TRY(x) do { __p2c_jmp_buf __try_jb; \ + __try_jb.next = __top_jb; \ + if (!setjmp((__top_jb = &__try_jb)->jbuf)) { +# define RECOVER(x) __top_jb = __try_jb.next; } else { +# define RECOVER2(x,L) __top_jb = __try_jb.next; } else { \ + if (0) { L: __top_jb = __try_jb.next; } +# define ENDTRY(x) } } while (0) +#else +# define TRY(x) if (1) { +# define RECOVER(x) } else do { +# define RECOVER2(x,L) } else do { L: ; +# define ENDTRY(x) } while (0) +#endif + + + +#ifdef M_XENIX /* avoid compiler bug */ +# define SHORT_MAX (32767) +# define SHORT_MIN (-32768) +#endif + + +/* The following definitions work only on twos-complement machines */ +#ifndef SHORT_MAX +# define SHORT_MAX ((short)(((unsigned short) -1) >> 1)) +# define SHORT_MIN (~SHORT_MAX) +#endif + +#ifndef INT_MAX +# define INT_MAX ((int)(((unsigned int) -1) >> 1)) +# define INT_MIN (~INT_MAX) +#endif + +#ifndef LONG_MAX +# define LONG_MAX ((long)(((unsigned long) -1) >> 1)) +# define LONG_MIN (~LONG_MAX) +#endif + +#ifndef SEEK_SET +# define SEEK_SET 0 +# define SEEK_CUR 1 +# define SEEK_END 2 +#endif + +#ifndef EXIT_SUCCESS +# ifdef vms +# define EXIT_SUCCESS 1 +# define EXIT_FAILURE (02000000000L) +# else +# define EXIT_SUCCESS 0 +# define EXIT_FAILURE 1 +# endif +#endif + + +#define SETBITS 32 + + +#if defined(__STDC__) || defined(__TURBOC__) +# if !defined(vms) && !defined(M_LINT) +# define Signed signed +# else +# define Signed +# endif +# define Void void /* Void f() = procedure */ +# ifndef Const +# define Const const +# endif +# ifndef Volatile +# define Volatile volatile +# endif +# ifdef M_LINT +# define PP(x) () +# define PV() () +typedef char *Anyptr; +# else +# define PP(x) x /* function prototype */ +# define PV() (void) /* null function prototype */ +typedef void *Anyptr; +# endif +#else +# define Signed +# define Void void +# ifndef Const +# define Const +# endif +# ifndef Volatile +# define Volatile +# endif +# define PP(x) () +# define PV() () +typedef char *Anyptr; +#endif + +#ifdef __GNUC__ +# define Inline inline +#else +# define Inline +#endif + +#define Register register /* Register variables */ +#define Char char /* Characters (not bytes) */ + +#ifndef Static +# define Static static /* Private global funcs and vars */ +#endif + +#ifndef Local +# define Local static /* Nested functions */ +#endif + +typedef Signed char schar; +typedef unsigned char uchar; +typedef unsigned char boolean; + +#ifndef true +# define true 1 +# define false 0 +#endif + +#ifndef TRUE +# define TRUE 1 +# define FALSE 0 +#endif + + +typedef struct { + Anyptr proc, link; +} _PROCEDURE; + +#ifndef _FNSIZE +# define _FNSIZE 120 +#endif + + +extern Void PASCAL_MAIN PP( (int, Char **) ); +extern Char **P_argv; +extern int P_argc; +extern short P_escapecode; +extern int P_ioresult; +extern __p2c_jmp_buf *__top_jb; + + +#ifdef P2C_H_PROTO /* if you have Ansi C but non-prototyped header files */ +extern Char *strcat PP( (Char *, Const Char *) ); +extern Char *strchr PP( (Const Char *, int) ); +extern int strcmp PP( (Const Char *, Const Char *) ); +extern Char *strcpy PP( (Char *, Const Char *) ); +extern size_t strlen PP( (Const Char *) ); +extern Char *strncat PP( (Char *, Const Char *, size_t) ); +extern int strncmp PP( (Const Char *, Const Char *, size_t) ); +extern Char *strncpy PP( (Char *, Const Char *, size_t) ); +extern Char *strrchr PP( (Const Char *, int) ); + +extern Anyptr memchr PP( (Const Anyptr, int, size_t) ); +extern Anyptr memmove PP( (Anyptr, Const Anyptr, size_t) ); +extern Anyptr memset PP( (Anyptr, int, size_t) ); +#ifndef memcpy +extern Anyptr memcpy PP( (Anyptr, Const Anyptr, size_t) ); +extern int memcmp PP( (Const Anyptr, Const Anyptr, size_t) ); +#endif + +extern int atoi PP( (Const Char *) ); +extern double atof PP( (Const Char *) ); +extern long atol PP( (Const Char *) ); +extern double strtod PP( (Const Char *, Char **) ); +extern long strtol PP( (Const Char *, Char **, int) ); +#endif /*P2C_H_PROTO*/ + +#ifndef HAS_STDLIB +extern Anyptr malloc PP( (size_t) ); +extern Void free PP( (Anyptr) ); +#endif + +extern int _OutMem PV(); +extern int _CaseCheck PV(); +extern int _NilCheck PV(); +extern int _Escape PP( (int) ); +extern int _EscIO PP( (int) ); + +extern long ipow PP( (long, long) ); +extern Char *strsub PP( (Char *, Char *, int, int) ); +extern Char *strltrim PP( (Char *) ); +extern Char *strrtrim PP( (Char *) ); +extern Char *strrpt PP( (Char *, Char *, int) ); +extern Char *strpad PP( (Char *, Char *, int, int) ); +extern int strpos2 PP( (Char *, Char *, int) ); +extern long memavail PV(); +extern int P_peek PP( (FILE *) ); +extern int P_eof PP( (FILE *) ); +extern int P_eoln PP( (FILE *) ); +extern Void P_readpaoc PP( (FILE *, Char *, int) ); +extern Void P_readlnpaoc PP( (FILE *, Char *, int) ); +extern long P_maxpos PP( (FILE *) ); +extern Char *P_trimname PP( (Char *, int) ); +extern long *P_setunion PP( (long *, long *, long *) ); +extern long *P_setint PP( (long *, long *, long *) ); +extern long *P_setdiff PP( (long *, long *, long *) ); +extern long *P_setxor PP( (long *, long *, long *) ); +extern int P_inset PP( (unsigned, long *) ); +extern int P_setequal PP( (long *, long *) ); +extern int P_subset PP( (long *, long *) ); +extern long *P_addset PP( (long *, unsigned) ); +extern long *P_addsetr PP( (long *, unsigned, unsigned) ); +extern long *P_remset PP( (long *, unsigned) ); +extern long *P_setcpy PP( (long *, long *) ); +extern long *P_expset PP( (long *, long) ); +extern long P_packset PP( (long *) ); +extern int P_getcmdline PP( (int, int, Char *) ); +extern Void TimeStamp PP( (int *, int *, int *, + int *, int *, int *) ); +extern Void P_sun_argv PP( (char *, int, int) ); + + +/* I/O error handling */ +#define _CHKIO(cond,ior,val,def) ((cond) ? P_ioresult=0,(val) \ + : P_ioresult=(ior),(def)) +#define _SETIO(cond,ior) (P_ioresult = (cond) ? 0 : (ior)) + +/* Following defines are suitable for the HP Pascal operating system */ +#define FileNotFound 10 +#define FileNotOpen 13 +#define FileWriteError 38 +#define BadInputFormat 14 +#define EndOfFile 30 + +#define FILENOTFOUND 10 +#define FILENOTOPEN 13 +#define FILEWRITEERROR 38 +#define BADINPUTFORMAT 14 +#define ENDOFFILE 30 + +/* Creating temporary files */ +#if (defined(BSD) || defined(NO_TMPFILE)) && !defined(HAVE_TMPFILE) +# define tmpfile() (fopen(tmpnam(NULL), "w+")) +#endif + +/* File buffers */ +#define FILEBUF(f,sc,type) sc int __CAT__(f,_BFLAGS); \ + sc type __CAT__(f,_BUFFER) +#define FILEBUFNC(f,type) int __CAT__(f,_BFLAGS); \ + type __CAT__(f,_BUFFER) + +#define RESETBUF(f,type) (__CAT__(f,_BFLAGS) = 1) +#define SETUPBUF(f,type) (__CAT__(f,_BFLAGS) = 0) + +#define GETFBUF(f,type) (*((__CAT__(f,_BFLAGS) == 1 && \ + ((__CAT__(f,_BFLAGS) = 2), \ + fread(&__CAT__(f,_BUFFER), \ + sizeof(type),1,(f)))),\ + &__CAT__(f,_BUFFER))) +#define AGETFBUF(f,type) ((__CAT__(f,_BFLAGS) == 1 && \ + ((__CAT__(f,_BFLAGS) = 2), \ + fread(__CAT__(f,_BUFFER), \ + sizeof(type),1,(f)))),\ + __CAT__(f,_BUFFER)) + +#define PUTFBUF(f,type,v) (GETFBUF(f,type) = (v)) +#define CPUTFBUF(f,v) (PUTFBUF(f,char,v)) +#define APUTFBUF(f,type,v) (memcpy(AGETFBUF(f,type), (v), \ + sizeof(__CAT__(f,_BUFFER)))) + +#define GET(f,type) (__CAT__(f,_BFLAGS) == 1 ? \ + fread(&__CAT__(f,_BUFFER),sizeof(type),1,(f)) : \ + (__CAT__(f,_BFLAGS) = 1)) + +#define PUT(f,type) (fwrite(&__CAT__(f,_BUFFER),sizeof(type),1,(f)), \ + (__CAT__(f,_BFLAGS) = 0)) +#define CPUT(f) (PUT(f,char)) + +#define BUFEOF(f) (__CAT__(f,_BFLAGS) != 2 && P_eof(f)) +#define BUFFPOS(f) (ftell(f) - (__CAT__(f,_BFLAGS) == 2)) + +typedef struct { + FILE *f; + FILEBUFNC(f,Char); + Char name[_FNSIZE]; +} _TEXT; + +/* Memory allocation */ +#ifdef __GCC__ +# define Malloc(n) (malloc(n) ?: (Anyptr)_OutMem()) +#else +extern Anyptr __MallocTemp__; +# define Malloc(n) ((__MallocTemp__ = malloc(n)) ? __MallocTemp__ : (Anyptr)_OutMem()) +#endif +#define FreeR(p) (free((Anyptr)(p))) /* used if arg is an rvalue */ +#define Free(p) (free((Anyptr)(p)), (p)=NULL) + +/* sign extension */ +#define SEXT(x,n) ((x) | -(((x) & (1L<<((n)-1))) << 1)) + +/* packed arrays */ /* BEWARE: these are untested! */ +#define P_getbits_UB(a,i,n,L) ((int)((a)[(i)>>(L)-(n)] >> \ + (((~(i))&((1<<(L)-(n))-1)) << (n)) & \ + (1<<(1<<(n)))-1)) + +#define P_getbits_SB(a,i,n,L) ((int)((a)[(i)>>(L)-(n)] << \ + (16 - ((((~(i))&((1<<(L)-(n))-1))+1) <<\ + (n)) >> (16-(1<<(n)))))) + +#define P_putbits_UB(a,i,x,n,L) ((a)[(i)>>(L)-(n)] |= \ + (x) << (((~(i))&((1<<(L)-(n))-1)) << (n))) + +#define P_putbits_SB(a,i,x,n,L) ((a)[(i)>>(L)-(n)] |= \ + ((x) & (1<<(1<<(n)))-1) << \ + (((~(i))&((1<<(L)-(n))-1)) << (n))) + +#define P_clrbits_B(a,i,n,L) ((a)[(i)>>(L)-(n)] &= \ + ~( ((1<<(1<<(n)))-1) << \ + (((~(i))&((1<<(L)-(n))-1)) << (n))) ) + +/* small packed arrays */ +#define P_getbits_US(v,i,n) ((int)((v) >> ((i)<<(n)) & (1<<(1<<(n)))-1)) +#define P_getbits_SS(v,i,n) ((int)((long)(v) << (SETBITS - (((i)+1) << (n))) >> (SETBITS-(1<<(n))))) +#define P_putbits_US(v,i,x,n) ((v) |= (x) << ((i) << (n))) +#define P_putbits_SS(v,i,x,n) ((v) |= ((x) & (1<<(1<<(n)))-1) << ((i)<<(n))) +#define P_clrbits_S(v,i,n) ((v) &= ~( ((1<<(1<<(n)))-1) << ((i)<<(n)) )) + +#define P_max(a,b) ((a) > (b) ? (a) : (b)) +#define P_min(a,b) ((a) < (b) ? (a) : (b)) + + +/* Fix ANSI-isms */ + +#ifdef LACK_LABS +# ifndef labs +# define labs my_labs + extern long my_labs PP( (long) ); +# endif +#endif + +#ifdef LACK_MEMMOVE +# ifndef memmove +# define memmove my_memmove + extern Anyptr my_memmove PP( (Anyptr, Const Anyptr, size_t) ); +# endif +#endif + +#ifdef LACK_MEMCPY +# ifndef memcpy +# define memcpy my_memcpy + extern Anyptr my_memcpy PP( (Anyptr, Const Anyptr, size_t) ); +# endif +# ifndef memcmp +# define memcmp my_memcmp + extern int my_memcmp PP( (Const Anyptr, Const Anyptr, size_t) ); +# endif +# ifndef memset +# define memset my_memset + extern Anyptr my_memset PP( (Anyptr, int, size_t) ); +# endif +#endif + +/* Fix toupper/tolower on Suns and other stupid BSD systems */ +#ifdef toupper +# undef toupper +# undef tolower +# define toupper(c) my_toupper(c) +# define tolower(c) my_tolower(c) +#endif + +#ifndef _toupper +# if 'A' == 65 && 'a' == 97 +# define _toupper(c) ((c)-'a'+'A') +# define _tolower(c) ((c)-'A'+'a') +# else +# ifdef toupper +# undef toupper /* hope these are shadowing real functions, */ +# undef tolower /* because my_toupper calls _toupper! */ +# endif +# define _toupper(c) toupper(c) +# define _tolower(c) tolower(c) +# endif +#endif + + +#endif /* P2C_H */ + + + +/* End. */ + + +
\ No newline at end of file diff --git a/support/rtflatex/rtflatex.c b/support/rtflatex/rtflatex.c new file mode 100644 index 0000000000..a7f7385bfe --- /dev/null +++ b/support/rtflatex/rtflatex.c @@ -0,0 +1,4699 @@ +/* Output from p2c 1.21alpha2-dt-Jul.95, the Pascal-to-C translator */ +/* From input file "rtflatex.pas" */ + + +#include "p2crtf.h" +#include "p2c_mods.h" +#include "p2clib_m.c" + + +/* version 2.15 */ + + +#define lmx 511 +#define olmx 1023 +#define maxlevel 72 +#define maxkeyln 64 +#define bfslen 24 +#define numsizes 16 +#define maxfonts 128 +#define maxstyles 12 +#define max_skip_strings 8 +#define maxRTFstyles 64 +#define RTFstyle_length 128 + + +typedef Char string24[bfslen + 1]; + +typedef Char string2[3]; + +typedef Char string5[6]; + +typedef Char string128[129]; + +typedef Char string255[256]; + +typedef Char exline_type[olmx]; +typedef Char string_RTFstyle[RTFstyle_length + 1]; + + +Static FILE *inputfile, *outputfile, *figurefile, *logfile, *skipfile; +Static short catcode[256], digit[256], majusc[256], letter[256]; +Static string24 acc_transl[256], ftech_transl[256]; +Static Char prev_line[lmx], inpline[lmx]; +Static exline_type exline; +Static short tex_verbose, verbose, icharz, numl, kout, kinp, prev_kinp, + bracelvl; +Static short lvlcode[maxlevel + 1], tab_nb_cellx[maxlevel + 1], + tab_nb_ands[maxlevel + 1], tab_cellx[maxlevel + 1]; +Static Char kar, hexaone, hexatwo; +Static string255 next_rtf; +Static boolean removed_ok, write_log, do_it_again, no_space_conv, use_sl, + latex209, latex_header, base_flag, envir_closed_ok, + last_percent, simplify_ok, no_RTFrtf, par_to_begin; +Static short num_styles, input_line_number, numfonts, num_word_fonts, stdsize, + stdkz; +Static string24 close_kar[maxlevel + 1], form_code[maxlevel + 1], + bfslcode[maxlevel + 1], sizecode[maxlevel + 1], + currsize[maxlevel + 1], currbfsl[maxlevel + 1], + spacingcode[maxlevel + 1], active_RTFf[maxlevel + 1]; +Static short center_flag[maxlevel + 1], flushright_flag[maxlevel + 1], + math_mode[maxlevel + 1]; +Static boolean underl_flag[maxlevel + 1], auto_close[maxlevel + 1]; +Static string24 sizekey[numsizes]; +Static short sizeval[3][numsizes]; +Static short sizemags[3][numsizes]; +Static string24 newfonts[maxfonts], word_fonts[maxfonts], + equiv_fonts[maxfonts], font_names[maxfonts]; +Static short word_font_num[maxfonts]; +Static string255 inkeyw; +Static short num_diff_sizes, keyw, cat, ikar, numval, numsign, num_hexa, + num_skip_strings, decl_font_num, num_latex_options, num_indent, + i, j, k, l, m, n; +Static string24 works, worksa, worksb, latex_style, end_math_code; +Static string24 latex_options[maxstyles + 1]; +Static string24 environ_type[11]; +Static string255 skip_strings[max_skip_strings]; +Static short leftskip, rightskip, leftcurskip, rightcurskip, save_skip, + space_after, displ_skip; +Static string_RTFstyle RTFstyles[maxRTFstyles]; +Static short ref_styles[256]; + +Static boolean clbrdrr, clbrdrl, clbrdrt, clbrdrb; + +/* indications to build file names of figure bitmaps */ +Static string128 figure_name, figure_path, figure_type; +Static string24 pict_name; +Static long rtfpicw, rtfpich, pict_char_number, pict_byte_number; +Static short pict_last_hexa, pict_number; +Static boolean pict_left_hexa; +Static Char last_kar; +Static Char inputfile_NAME[_FNSIZE]; +Static Char outputfile_NAME[_FNSIZE]; +Static Char figurefile_NAME[_FNSIZE]; +Static Char logfile_NAME[_FNSIZE]; +Static Char skipfile_NAME[_FNSIZE]; + + +/*---------------------------------------------------------------------------*/ +/* resets all integers to 0, all strings to '', for safety */ + +Static Void clean_all() +{ + short z; + + for (z = 1; z <= lmx; z++) + prev_line[k-1] = ' '; + for (z = 1; z <= lmx; z++) + inpline[k-1] = ' '; + for (z = 1; z <= olmx; z++) + exline[k-1] = ' '; + + tex_verbose = 0; + verbose = 0; + icharz = 0; + numl = 0; + kout = 0; + kinp = 0; + prev_kinp = 0; + bracelvl = 0; + + for (z = 0; z <= maxlevel; z++) { + lvlcode[z] = 0; + tab_nb_cellx[z] = 0; + tab_nb_ands[z] = 0; + tab_cellx[z] = 0; + } + kar = ' '; + hexaone = ' '; + hexatwo = ' '; + + *next_rtf = '\0'; + removed_ok = false; + write_log = false; + do_it_again = false; + no_space_conv = false; + use_sl = false; + latex209 = false; + latex_header = false; + base_flag = false; + envir_closed_ok = false; + last_percent = false; + simplify_ok = false; + no_RTFrtf = false; + par_to_begin = false; + + num_styles = 0; + input_line_number = 0; + numfonts = 0; + num_word_fonts = 0; + stdsize = 0; + stdkz = 0; + + for (z = 0; z <= maxlevel; z++) { + *close_kar[z] = '\0'; + *form_code[z] = '\0'; + *bfslcode[z] = '\0'; + *sizecode[z] = '\0'; + *currsize[z] = '\0'; + *currbfsl[z] = '\0'; + *spacingcode[z] = '\0'; + *active_RTFf[z] = '\0'; + center_flag[z] = 0; + flushright_flag[z] = 0; + math_mode[z] = 0; + underl_flag[z] = false; + auto_close[z] = false; + } + /* sizekey : array[1..numsizes] of string24; */ + /* sizeval : array[1..3,1..numsizes] of integer; */ + /* sizemags : array[1..3,1..numsizes] of integer; */ + for (z = 0; z <= maxfonts - 1; z++) { + *newfonts[z] = '\0'; + *word_fonts[z] = '\0'; + *equiv_fonts[z] = '\0'; + *font_names[z] = '\0'; + word_font_num[z] = 0; + } + *inkeyw = '\0'; + num_diff_sizes = 0; + keyw = 0; + cat = 0; + ikar = 0; + numval = 0; + numsign = 0; + num_hexa = 0; + num_skip_strings = 0; + decl_font_num = 0; + num_latex_options = 0; + num_indent = 0; + i = 0; + j = 0; + k = 0; + l = 0; + m = 0; + n = 0; + *works = '\0'; + *worksa = '\0'; + *worksb = '\0'; + *latex_style = '\0'; + *end_math_code = '\0'; + + for (z = 0; z <= maxstyles; z++) + *latex_options[z] = '\0'; + for (z = 0; z <= 10; z++) + *environ_type[z] = '\0'; + for (z = 0; z <= max_skip_strings - 1; z++) + *skip_strings[z] = '\0'; + leftskip = 0; + rightskip = 0; + leftcurskip = 0; + rightcurskip = 0; + save_skip = 0; + space_after = 0; + displ_skip = 0; + + for (z = 0; z <= maxRTFstyles - 1; z++) + *RTFstyles[z] = '\0'; + for (z = 0; z <= 255; z++) + ref_styles[z] = 0; + + clbrdrr = false; + clbrdrl = false; + clbrdrt = false; + clbrdrb = false; + + /* indications to build file names of figure bitmaps */ + *figure_name = '\0'; + *figure_path = '\0'; + *figure_type = '\0'; + *pict_name = '\0'; + rtfpicw = 0; + rtfpich = 0; + pict_char_number = 0; + pict_byte_number = 0; + pict_last_hexa = 0; + pict_number = 0; + pict_left_hexa = false; + last_kar = ' '; +} + + +/*---------------------------------------------------------------------------*/ + +Static Void title() +{ + printf(" MICROSOFT RTF(Word[Perfect]) to LaTeX conversion\n"); + printf(" Daniel Taupin, CNRS, 20th September 1996\n"); + printf(" Universite de Paris-Sud, Orsay, France\n"); + printf(" Version 2.15\n"); + printf(" E-mail: taupin@lps.u-psud.fr\n"); +} + + +/*---------------------------------------------------------------------------*/ +/* converts a hexa character into a number from 0 to 15 */ + +Static short hx_to_i(kar) +Char kar; +{ + short ikar = kar; + short okar; + + if (ikar < '0') { + okar = 0; + return okar; + } + if (ikar <= '9') { + okar = ikar - '0'; + return okar; + } + if (ikar <= 'Z') { + okar = ikar + 10 - 'A'; + return okar; + } + if (ikar <= 'z') + okar = ikar + 10 - 'a'; + else + okar = 0; + /*END IF ikar */ + return okar; +} + + +/*---------------------------------------------------------------------------*/ +/* converts a string of two hexa character into a number from 0 to 255 */ + +Static short hs_to_i(input_stg) +Char *input_stg; +{ + return (hx_to_i(input_stg[0]) * 16 + hx_to_i(input_stg[1])); +} + + +/*---------------------------------------------------------------------------*/ +/* truncate at bfslen a string */ + +Static Char *truncate24(Result, a) +Char *Result; +Char *a; +{ + sprintf(Result, "%.*s", bfslen, a); + return Result; +/* p2c: rtflatex.h, line 173: + * Note: Possible faulty string assignment [145] */ +/* p2c: rtflatex.h, line 173: + * Note: string[24] := string[255] => unpredictable crashes */ +} + + +/* version 2.15 */ + +/*---------------------------------------------------------------------------*/ +/* finds the '.' initiating the postfix of the given file name */ + +Static short pos_postfix(xx) +Char *xx; +{ + short Result = 0; + short i, FORLIM; + + FORLIM = strlen(xx); + for (i = 1; i <= FORLIM; i++) { /*END DO*/ + if (xx[i-1] == '.') + Result = i; + else if (xx[i-1] == ']') + Result = 0; + else if (xx[i-1] == '/') + Result = 0; + else if (xx[i-1] == '\\') + Result = 0; + else if (xx[i-1] == ':') + Result = 0; + } + /*END IF*/ + return Result; +} + + +/*---------------------------------------------------------------------------*/ +/* the signed variant of str(n,stg) */ + +Static Void sign_str(num, out_sign_str) +short num; +Char *out_sign_str; +{ + string255 sign_work; + Char STR2[256]; + + sprintf(sign_work, "%d", num); + /* if (num<0) then out_sign_str:='-'+sign_work */ + if (num < 0) { + sprintf(STR2, "-%s", sign_work); + truncate24(out_sign_str, STR2); + } else { + truncate24(out_sign_str, sign_work); + /*END IF*/ + } +} + + +/*---------------------------------------------------------------------------*/ +/* prints/displays a message */ + +Static Void print_msg(verbose_level, msg) +short verbose_level; +Char *msg; +{ + if (verbose >= verbose_level) + fputs(msg, stdout); + if (write_log) + fputs(msg, logfile); +} + + +/*---------------------------------------------------------------------------*/ +/* prints/displays a message with RETURN */ + +Static Void println_msg(verbose_level, msg) +short verbose_level; +Char *msg; +{ + if (verbose >= verbose_level) + puts(msg); + if (write_log) + fprintf(logfile, "%s\n", msg); +} + + +/* ======================================================================= */ +/* used at initialization to store one size name (Latex) and its magnitudes */ + +Static Void sizeone(i, s, j, k, l, mag10, mag11, mag12) +short i; +Char *s; +short j, k, l, mag10, mag11, mag12; +{ + truncate24(sizekey[i-1], s); + sizeval[0][i-1] = j; + sizemags[0][i-1] = mag10; + sizeval[1][i-1] = k; + sizemags[1][i-1] = mag11; + sizeval[2][i-1] = l; + sizemags[2][i-1] = mag12; +} + + +/* ======================================================================= */ +/* initialization of LaTeX font heights <==> size keywords */ + +Static Void sizeinit() +{ + short k; + + sizeone(1, "HUGE", 720, 720, 840, 2986, 2986, 3583); + sizeone(2, "Huge", 600, 600, 720, 2488, 2488, 2986); + sizeone(3, "huge", 500, 500, 600, 2074, 2074, 2488); + sizeone(4, "LARGE", 440, 440, 500, 1728, 1728, 2074); + sizeone(5, "Large", 360, 360, 440, 1440, 1440, 1728); + sizeone(6, "large", 280, 280, 360, 1200, 1200, 1440); + sizeone(7, "normalsize", 240, 272, 290, 1000, 1095, 1200); + sizeone(8, "small", 220, 240, 272, 900, 1000, 1095); + sizeone(9, "footnotesize", 190, 220, 240, 800, 900, 1000); + sizeone(10, "scriptsize", 160, 190, 190, 700, 800, 800); + sizeone(11, "tiny", 120, 140, 140, 500, 600, 600); + for (k = 12; k <= 16; k++) + sizeone(k, "tiny", 0, 0, 0, 500, 600, 600); + num_diff_sizes = 11; + + for (k = 0; k <= 10; k++) + strcpy(environ_type[k], "\\RTFerror"); + + strcpy(environ_type[0], "document"); + strcpy(environ_type[1], "center"); + strcpy(environ_type[2], "flushright"); + +} + + +/* ======================================================================= */ + +Static Void mac_init() +{ + short k; + + /* install the conversions of RTF accents (coded \'xx in hexa) */ + /* build a list of conversion of accented letters */ + + for (k = 0; k <= 255; k++) + *acc_transl[k] = '\0'; + + strcpy(acc_transl[hs_to_i("80")], "\"A"); + strcpy(acc_transl[hs_to_i("81")], "\\AA{}"); + strcpy(acc_transl[hs_to_i("82")], "\\c{C}"); + strcpy(acc_transl[hs_to_i("83")], "\\'E"); + strcpy(acc_transl[hs_to_i("84")], "\\~N"); + strcpy(acc_transl[hs_to_i("85")], "\\\"O"); + strcpy(acc_transl[hs_to_i("86")], "\\\"U"); + strcpy(acc_transl[hs_to_i("87")], "\\'a"); + strcpy(acc_transl[hs_to_i("88")], "\\`a"); + strcpy(acc_transl[hs_to_i("89")], "\\^a"); + strcpy(acc_transl[hs_to_i("8a")], "\\\"a"); + strcpy(acc_transl[hs_to_i("8b")], "\\~a"); + strcpy(acc_transl[hs_to_i("8c")], "\\aa{}"); + strcpy(acc_transl[hs_to_i("8d")], "\\c{c}"); + strcpy(acc_transl[hs_to_i("8e")], "\\'e"); + strcpy(acc_transl[hs_to_i("8f")], "\\`e"); + strcpy(acc_transl[hs_to_i("90")], "\\^e"); + strcpy(acc_transl[hs_to_i("91")], "\\\"e"); + strcpy(acc_transl[hs_to_i("93")], "\\'{\\i}"); + strcpy(acc_transl[hs_to_i("93")], "\\`{\\i}"); + strcpy(acc_transl[hs_to_i("94")], "\\^{\\i}"); + strcpy(acc_transl[hs_to_i("95")], "\\\"{\\i}"); + strcpy(acc_transl[hs_to_i("96")], "\\~n"); + strcpy(acc_transl[hs_to_i("97")], "\\'o"); + strcpy(acc_transl[hs_to_i("98")], "\\`o"); + strcpy(acc_transl[hs_to_i("99")], "\\^o"); + strcpy(acc_transl[hs_to_i("9a")], "\\\"o"); + strcpy(acc_transl[hs_to_i("9b")], "\\~o"); + strcpy(acc_transl[hs_to_i("9c")], "\\'u"); + strcpy(acc_transl[hs_to_i("9d")], "\\`u"); + strcpy(acc_transl[hs_to_i("9e")], "\\^u"); + strcpy(acc_transl[hs_to_i("9f")], "\\\"u"); + strcpy(acc_transl[hs_to_i("a0")], "\\dag{}"); + strcpy(acc_transl[hs_to_i("a1")], "\\degree{}"); + strcpy(acc_transl[hs_to_i("a3")], "\\pound{}"); + strcpy(acc_transl[hs_to_i("a4")], "\\S{}"); + strcpy(acc_transl[hs_to_i("a7")], "\\ss{}"); + strcpy(acc_transl[hs_to_i("ae")], "\\AE{}"); + strcpy(acc_transl[hs_to_i("af")], "\\O{}"); + strcpy(acc_transl[hs_to_i("b0")], "$\\infty "); + strcpy(acc_transl[hs_to_i("b1")], "$\\pm "); + strcpy(acc_transl[hs_to_i("b2")], "$\\leq "); + strcpy(acc_transl[hs_to_i("b3")], "$\\geq "); + strcpy(acc_transl[hs_to_i("b5")], "$\\mu "); + strcpy(acc_transl[hs_to_i("b6")], "$\\partial "); + strcpy(acc_transl[hs_to_i("b7")], "$\\Sigma "); + strcpy(acc_transl[hs_to_i("b8")], "$\\Pi "); + strcpy(acc_transl[hs_to_i("b9")], "$\\pi "); + strcpy(acc_transl[hs_to_i("bd")], "${1\\over2}"); + strcpy(acc_transl[hs_to_i("bf")], "\\o{}"); + strcpy(acc_transl[hs_to_i("c6")], "$\\Delta "); + strcpy(acc_transl[hs_to_i("c9")], "..."); + strcpy(acc_transl[hs_to_i("cb")], "\\`A"); + strcpy(acc_transl[hs_to_i("cc")], "\\~A"); + strcpy(acc_transl[hs_to_i("cd")], "\\~O"); + strcpy(acc_transl[hs_to_i("ce")], "\\OE{}"); + strcpy(acc_transl[hs_to_i("cf")], "\\oe{}"); + strcpy(acc_transl[hs_to_i("d0")], "--{}"); + strcpy(acc_transl[hs_to_i("d1")], "---{}"); + strcpy(acc_transl[hs_to_i("d2")], "``"); + strcpy(acc_transl[hs_to_i("d3")], "''"); + strcpy(acc_transl[hs_to_i("d4")], "`{}"); + strcpy(acc_transl[hs_to_i("d5")], "'{}"); + strcpy(acc_transl[hs_to_i("d6")], "$\\div "); + strcpy(acc_transl[hs_to_i("d8")], "\\\"y"); + strcpy(acc_transl[hs_to_i("e1")], "$\\cdot "); + strcpy(acc_transl[hs_to_i("e4")], "\\\"a"); + strcpy(acc_transl[hs_to_i("e5")], "\\^A"); + strcpy(acc_transl[hs_to_i("e6")], "\\^E"); + strcpy(acc_transl[hs_to_i("e7")], "\\'A"); + strcpy(acc_transl[hs_to_i("e8")], "\\\"E"); + strcpy(acc_transl[hs_to_i("e9")], "\\`E"); + strcpy(acc_transl[hs_to_i("ea")], "\\'I"); + strcpy(acc_transl[hs_to_i("eb")], "\\^I"); + strcpy(acc_transl[hs_to_i("ec")], "\\\"I"); + strcpy(acc_transl[hs_to_i("ed")], "\\`I"); + strcpy(acc_transl[hs_to_i("ee")], "\\'O"); + strcpy(acc_transl[hs_to_i("ef")], "\\^O"); + strcpy(acc_transl[hs_to_i("f1")], "\\`O"); + strcpy(acc_transl[hs_to_i("f2")], "\\'U"); + strcpy(acc_transl[hs_to_i("f3")], "\\^U"); + strcpy(acc_transl[hs_to_i("f4")], "\\`U"); + strcpy(acc_transl[hs_to_i("f6")], "\\\"o"); + strcpy(acc_transl[hs_to_i("fb")], "\\degree{}"); + strcpy(acc_transl[hs_to_i("fc")], "\\\"u"); + +} + + +/* ======================================================================= */ + +Static Void ansi_init() +{ + short k; + + /* install the conversions of RTF accents (coded \'xx in hexa) */ + /* build a list of conversion of accented letters */ + + for (k = 0; k <= 255; k++) + *acc_transl[k] = '\0'; + + strcpy(acc_transl[hs_to_i("a1")], "!`"); + strcpy(acc_transl[hs_to_i("a3")], "\\pound{}"); + strcpy(acc_transl[hs_to_i("a7")], "\\S{}"); + strcpy(acc_transl[hs_to_i("a8")], "\\\"{ }"); + strcpy(acc_transl[hs_to_i("a9")], "\\copyright{}"); + strcpy(acc_transl[hs_to_i("ab")], "<<"); + strcpy(acc_transl[hs_to_i("b0")], "\\degree{}"); + strcpy(acc_transl[hs_to_i("b1")], "$\\pm "); + strcpy(acc_transl[hs_to_i("b4")], "\\'{ }"); + strcpy(acc_transl[hs_to_i("b5")], "$\\mu "); + strcpy(acc_transl[hs_to_i("b7")], "$\\cdot "); + strcpy(acc_transl[hs_to_i("b8")], "\\c{ }"); + strcpy(acc_transl[hs_to_i("bb")], ">>"); + strcpy(acc_transl[hs_to_i("bc")], "${1\\over4}"); + strcpy(acc_transl[hs_to_i("bd")], "${1\\over2}"); + strcpy(acc_transl[hs_to_i("be")], "${3\\over4}"); + strcpy(acc_transl[hs_to_i("bf")], "?`"); + + strcpy(acc_transl[hs_to_i("c0")], "\\`A"); + strcpy(acc_transl[hs_to_i("c1")], "\\'A"); + strcpy(acc_transl[hs_to_i("c2")], "\\^A"); + strcpy(acc_transl[hs_to_i("c3")], "\\~A"); + strcpy(acc_transl[hs_to_i("c4")], "\\\"A"); + strcpy(acc_transl[hs_to_i("c5")], "\\AA{}"); + strcpy(acc_transl[hs_to_i("c6")], "\\AE{}"); + strcpy(acc_transl[hs_to_i("c7")], "\\c{C}"); + strcpy(acc_transl[hs_to_i("c8")], "\\`E"); + strcpy(acc_transl[hs_to_i("c9")], "\\'E"); + strcpy(acc_transl[hs_to_i("ca")], "\\^E"); + strcpy(acc_transl[hs_to_i("cb")], "\\\"E"); + strcpy(acc_transl[hs_to_i("cc")], "\\`I"); + strcpy(acc_transl[hs_to_i("cd")], "\\'I"); + strcpy(acc_transl[hs_to_i("ce")], "\\^I"); + strcpy(acc_transl[hs_to_i("cf")], "\\\"I"); + + strcpy(acc_transl[hs_to_i("d1")], "\\~N"); + strcpy(acc_transl[hs_to_i("d2")], "\\`O"); + strcpy(acc_transl[hs_to_i("d3")], "\\'O"); + strcpy(acc_transl[hs_to_i("d4")], "\\^O"); + strcpy(acc_transl[hs_to_i("d5")], "\\~O"); + strcpy(acc_transl[hs_to_i("d6")], "\\\"O"); + strcpy(acc_transl[hs_to_i("d8")], "\\O"); + strcpy(acc_transl[hs_to_i("d9")], "\\`U"); + strcpy(acc_transl[hs_to_i("da")], "\\'U"); + strcpy(acc_transl[hs_to_i("db")], "\\^U"); + strcpy(acc_transl[hs_to_i("dc")], "\\\"U"); + strcpy(acc_transl[hs_to_i("dd")], "\\'Y"); + strcpy(acc_transl[hs_to_i("df")], "\\ss{}"); + + + strcpy(acc_transl[hs_to_i("e0")], "\\`a"); + strcpy(acc_transl[hs_to_i("e1")], "\\'a"); + strcpy(acc_transl[hs_to_i("e2")], "\\^a"); + strcpy(acc_transl[hs_to_i("e3")], "\\~a"); + strcpy(acc_transl[hs_to_i("e4")], "\\\"a"); + strcpy(acc_transl[hs_to_i("e5")], "\\aa{}"); + strcpy(acc_transl[hs_to_i("e6")], "\\ae{}"); + strcpy(acc_transl[hs_to_i("e7")], "\\c{c}"); + strcpy(acc_transl[hs_to_i("e8")], "\\`e"); + strcpy(acc_transl[hs_to_i("e9")], "\\'e"); + strcpy(acc_transl[hs_to_i("ea")], "\\^e"); + strcpy(acc_transl[hs_to_i("eb")], "\\\"e"); + strcpy(acc_transl[hs_to_i("ec")], "\\`i"); + strcpy(acc_transl[hs_to_i("ed")], "\\'i"); + strcpy(acc_transl[hs_to_i("ee")], "\\^i"); + strcpy(acc_transl[hs_to_i("ef")], "\\\"i"); + + strcpy(acc_transl[hs_to_i("f1")], "\\~n"); + strcpy(acc_transl[hs_to_i("f2")], "\\`o"); + strcpy(acc_transl[hs_to_i("f3")], "\\'o"); + strcpy(acc_transl[hs_to_i("f4")], "\\^o"); + strcpy(acc_transl[hs_to_i("f5")], "\\~o"); + strcpy(acc_transl[hs_to_i("f6")], "\\\"o"); + strcpy(acc_transl[hs_to_i("f8")], "\\o"); + strcpy(acc_transl[hs_to_i("f9")], "\\`u"); + strcpy(acc_transl[hs_to_i("fa")], "\\'u"); + strcpy(acc_transl[hs_to_i("fb")], "\\^u"); + strcpy(acc_transl[hs_to_i("fc")], "\\\"u"); + strcpy(acc_transl[hs_to_i("fd")], "\\'y"); + strcpy(acc_transl[hs_to_i("ff")], "\\\"y"); + + + +} + + +/* ======================================================================= */ + +Static Void charinit() +{ + short K; + + for (K = 0; K <= 255; K++) + catcode[K] = 12; + for (K = 'A'; K <= 'Z'; K++) + catcode[K] = 11; + for (K = 'a'; K <= 'z'; K++) + catcode[K] = 11; + for (K = '0'; K <= '9'; K++) + catcode[K] = 16; + K = ' '; + catcode[K] = 10; + K = '{'; + catcode[K] = 1; + K = '}'; + catcode[K] = 2; + K = '('; + catcode[K] = 3; + K = ')'; + catcode[K] = 4; + K = '\\'; + catcode[K] = 0; + + icharz = '0'; + + /* build an empty list of conversion of accented letters */ + + for (K = 0; K <= 255; K++) + *acc_transl[K] = '\0'; + + /* Now install the conversions of "ftech" characters into math codes +... or letters*/ + + for (K = 0; K <= 255; K++) + *ftech_transl[K] = '\0'; + strcpy(ftech_transl['a'], "\\alpha "); + strcpy(ftech_transl['A'], "\\Alpha "); + strcpy(ftech_transl['b'], "\\beta "); + strcpy(ftech_transl['B'], "\\Beta "); + strcpy(ftech_transl['c'], "\\chi "); + strcpy(ftech_transl['C'], "\\Chi "); + strcpy(ftech_transl['d'], "\\delta "); + strcpy(ftech_transl['D'], "\\Delta "); + strcpy(ftech_transl['e'], "\\varepsilon "); + strcpy(ftech_transl['E'], "\\Epsilon "); + strcpy(ftech_transl['f'], "\\phi "); + strcpy(ftech_transl['F'], "\\Phi "); + strcpy(ftech_transl['g'], "\\gamma "); + strcpy(ftech_transl['G'], "\\Gamma "); + strcpy(ftech_transl['h'], "\\eta "); + strcpy(ftech_transl['H'], "\\Eta "); + strcpy(ftech_transl['i'], "\\iota "); + strcpy(ftech_transl['I'], "\\Iota "); + strcpy(ftech_transl['j'], "\\varphi "); + strcpy(ftech_transl['J'], "\\vartheta "); + strcpy(ftech_transl['k'], "\\kappa "); + strcpy(ftech_transl['K'], "\\Kappa "); + strcpy(ftech_transl['l'], "\\lambda "); + strcpy(ftech_transl['L'], "\\Lambda "); + strcpy(ftech_transl['m'], "\\mu "); + strcpy(ftech_transl['M'], "\\Mu "); + strcpy(ftech_transl['n'], "\\nu "); + strcpy(ftech_transl['N'], "\\Nu"); + strcpy(ftech_transl['o'], "o"); + strcpy(ftech_transl['O'], "\\Omicron "); + strcpy(ftech_transl['p'], "\\pi "); + strcpy(ftech_transl['P'], "\\Pi "); + strcpy(ftech_transl['q'], "\\theta "); + strcpy(ftech_transl['Q'], "\\Theta "); + strcpy(ftech_transl['r'], "\\rho "); + strcpy(ftech_transl['R'], "\\Rho "); + strcpy(ftech_transl['s'], "\\sigma "); + strcpy(ftech_transl['S'], "\\Sigma "); + strcpy(ftech_transl['t'], "\\tau "); + strcpy(ftech_transl['T'], "\\Tau "); + strcpy(ftech_transl['u'], "\\upsilon "); + strcpy(ftech_transl['U'], "\\varUpsilon "); + strcpy(ftech_transl['v'], "\\varpi "); + strcpy(ftech_transl['V'], "\\varsigma "); + strcpy(ftech_transl['w'], "\\omega "); + strcpy(ftech_transl['W'], "\\Omega "); + strcpy(ftech_transl['x'], "\\xi "); + strcpy(ftech_transl['X'], "\\Xi "); + strcpy(ftech_transl['y'], "\\psi "); + strcpy(ftech_transl['Y'], "\\Psi "); + strcpy(ftech_transl['z'], "\\zeta "); + strcpy(ftech_transl['Z'], "\\Zeta "); + + strcpy(ftech_transl['@'], "\\cong "); + strcpy(ftech_transl['~'], "\\sim "); + strcpy(ftech_transl['"'], "\\forall "); + strcpy(ftech_transl['$'], "\\exists "); + + strcpy(ftech_transl[hs_to_i("27")], "\\ni "); + strcpy(ftech_transl[hs_to_i("5e")], "\\bot "); + strcpy(ftech_transl[hs_to_i("a0")], "\\dag "); + strcpy(ftech_transl[hs_to_i("a1")], "\\Upsilon "); + strcpy(ftech_transl[hs_to_i("a2")], "'"); + strcpy(ftech_transl[hs_to_i("a3")], "\\leq "); + strcpy(ftech_transl[hs_to_i("a4")], "/"); + strcpy(ftech_transl[hs_to_i("a5")], "\\infty "); + strcpy(ftech_transl[hs_to_i("a6")], "\\cap "); + strcpy(ftech_transl[hs_to_i("a7")], "\\clubsuit "); + strcpy(ftech_transl[hs_to_i("a9")], "\\heartsuit "); + strcpy(ftech_transl[hs_to_i("aa")], "\\spadesuit "); + strcpy(ftech_transl[hs_to_i("ab")], "\\leftrightarrow "); + strcpy(ftech_transl[hs_to_i("ac")], "\\leftarrow "); + strcpy(ftech_transl[hs_to_i("ad")], "\\uparrow "); + strcpy(ftech_transl[hs_to_i("ae")], "\\rightarrow "); + strcpy(ftech_transl[hs_to_i("af")], "\\downarrow "); + strcpy(ftech_transl[hs_to_i("b0")], "^{\\circ}"); + strcpy(ftech_transl[hs_to_i("b1")], "\\pm "); + strcpy(ftech_transl[hs_to_i("b2")], "''"); + strcpy(ftech_transl[hs_to_i("b3")], "\\geq "); + strcpy(ftech_transl[hs_to_i("b4")], "\\times "); + strcpy(ftech_transl[hs_to_i("b5")], "\\propto "); + strcpy(ftech_transl[hs_to_i("b6")], "\\partial "); + strcpy(ftech_transl[hs_to_i("b7")], "\\bullet "); + strcpy(ftech_transl[hs_to_i("b8")], "\\div "); + strcpy(ftech_transl[hs_to_i("b9")], "\\neq "); + strcpy(ftech_transl[hs_to_i("ba")], "\\equiv "); + strcpy(ftech_transl[hs_to_i("bb")], "\\approx "); + strcpy(ftech_transl[hs_to_i("bc")], "\\ldots "); + strcpy(ftech_transl[hs_to_i("bd")], "\\mid "); + strcpy(ftech_transl[hs_to_i("c0")], "\\aleph "); + strcpy(ftech_transl[hs_to_i("c1")], "\\Im "); + strcpy(ftech_transl[hs_to_i("c2")], "\\Re "); + strcpy(ftech_transl[hs_to_i("c3")], "\\wp "); + strcpy(ftech_transl[hs_to_i("c4")], "\\otimes "); + strcpy(ftech_transl[hs_to_i("c5")], "\\oplus "); + strcpy(ftech_transl[hs_to_i("c6")], "\\oslash "); + strcpy(ftech_transl[hs_to_i("c7")], "\\cap "); + strcpy(ftech_transl[hs_to_i("c8")], "\\cup "); + strcpy(ftech_transl[hs_to_i("c9")], "\\supset "); + strcpy(ftech_transl[hs_to_i("ca")], "\\supseteq "); + strcpy(ftech_transl[hs_to_i("cb")], "\\not\\subset "); + strcpy(ftech_transl[hs_to_i("cc")], "\\subset "); + strcpy(ftech_transl[hs_to_i("cd")], "\\subseteq "); + strcpy(ftech_transl[hs_to_i("ce")], "\\in "); + strcpy(ftech_transl[hs_to_i("cf")], "\\not\\in "); + strcpy(ftech_transl[hs_to_i("d0")], "\\angle "); + strcpy(ftech_transl[hs_to_i("d1")], "\\nabla "); + strcpy(ftech_transl[hs_to_i("d2")], "\\registered "); + strcpy(ftech_transl[hs_to_i("d3")], "\\copyright "); + strcpy(ftech_transl[hs_to_i("d4")], "\\trademark "); + strcpy(ftech_transl[hs_to_i("d5")], "\\prod "); + strcpy(ftech_transl[hs_to_i("d7")], "\\cdot "); + strcpy(ftech_transl[hs_to_i("d8")], "\\neg "); + strcpy(ftech_transl[hs_to_i("d9")], "\\wedge "); + strcpy(ftech_transl[hs_to_i("da")], "\\vee "); + strcpy(ftech_transl[hs_to_i("db")], "\\Leftrightarrow "); + strcpy(ftech_transl[hs_to_i("dc")], "\\Leftarrow "); + strcpy(ftech_transl[hs_to_i("dd")], "\\Uparrow "); + strcpy(ftech_transl[hs_to_i("de")], "\\Rightarrow "); + strcpy(ftech_transl[hs_to_i("df")], "\\Downarrow "); + strcpy(ftech_transl[hs_to_i("e0")], "\\diamondsuit "); + strcpy(ftech_transl[hs_to_i("e1")], "\\langle "); + strcpy(ftech_transl[hs_to_i("e2")], "\\registered "); + strcpy(ftech_transl[hs_to_i("e3")], "\\copyright "); + strcpy(ftech_transl[hs_to_i("e4")], "\\trademark "); + strcpy(ftech_transl[hs_to_i("e5")], "\\sum "); + strcpy(ftech_transl[hs_to_i("e9")], "\\lceil "); + strcpy(ftech_transl[hs_to_i("ea")], "\\mid "); + strcpy(ftech_transl[hs_to_i("eb")], "\\lfloor "); + strcpy(ftech_transl[hs_to_i("f1")], "\\rangle "); + strcpy(ftech_transl[hs_to_i("f2")], "\\int "); + + strcpy(end_math_code, "$"); +} + + +/* ======================================================================= */ +/* this procedure returns a set of 4 chars, the size preamble of a non std font */ +Static Char *sizealpha(Result, i) +Char *Result; +short i; +{ + short h; + + h = i / 2; + if (h <= 5) + return strcpy(Result, "\\fiv"); + else if (h <= 6) + return strcpy(Result, "\\six"); + else if (h <= 7) + return strcpy(Result, "\\sev"); + else if (h <= 8) + return strcpy(Result, "\\egt"); + else if (h <= 9) + return strcpy(Result, "\\nin"); + else if (h <= 10) + return strcpy(Result, "\\ten"); + else if (h <= 11) + return strcpy(Result, "\\elv"); + else if (h <= 13) + return strcpy(Result, "\\twl"); + else if (h <= 15) + return strcpy(Result, "\\frt"); + else if (h <= 18) + return strcpy(Result, "\\svtn"); + else if (h <= 23) + return strcpy(Result, "\\twty"); + else if (h <= 28) + return strcpy(Result, "\\twfv"); + else { + return strcpy(Result, "\\thtw"); + /*END IF*/ + + } +} + + +/* ======================================================================= */ +/* write "help" information */ + +Static Void write_help() +{ + printf("Usage: RTFLATEX [options] <input-file> [options] <output-file>\n"); + printf("Options:\n"); + printf(" -b : set explicit \\baselineskip at par ends\n"); + printf(" -d<nnn> : debug level: 1=default, 0=quiet, >1=verbose\n"); + printf(" -f<templ> : file template to put figures (need a * )\n"); + printf(" -l<style> : latex style (default is \"report\")\n"); + printf(" -m : put debugging marks in output TeX\n"); + printf(" -o<option> : latex style option (cumulative)\n"); + printf(" -p<value> : std font size (10, 11, 12)\n"); + printf(" -r<file> : LOG output file (default is none)\n"); + printf(" -s : use slanted instead of italic\n"); + printf(" -t : omit LaTeX \\documentstyle etc.\n"); + printf(" -v : convert text and fonts, not spacings\n"); + printf(" -x : inhibit output simplification\n"); + printf(" -z<file> : file containing list of ignored keywords\n"); + printf(" -209 : assume ancient Latex209\n"); + _Escape(0); +} + + +/*---------------------------------------------------------------------------*/ +/* this procedure open files and set the -xxxx options */ + +Static Void open_files() +{ + string128 skipname, outputname, inputname, logname, optstr; + short testio, cat, ikar; + short kparm = 0; + short L, pospt; + Char first_char; + boolean success; + string24 inskipk; + short kkk, number_params; + Char STR1[256], STR3[256], STR4[256]; + short FORLIM1; + Char *TEMP; + Char STR5[40]; + Char STR6[68]; + + strcpy(figure_path, "rtf*.bit"); + *figure_type = '\0'; + stdsize = 12; + stdkz = 3; /* standard LaTeX size : 10, 11, 12 pt */ + *inputname = '\0'; + *outputname = '\0'; + strcpy(skipname, P_argv[0]); + num_skip_strings = 1; + for (L = 0; L <= max_skip_strings - 1; L++) + *skip_strings[L] = '\0'; + + pospt = pos_postfix(skipname); + if (pospt > 0) { + if (!strcmp(strsub(STR1, skipname, pospt, strlen(skipname)), ".EXE")) + sprintf(skipname, "%.*sSKW", pospt, strcpy(STR3, skipname)); + else if (!strcmp(strsub(STR3, skipname, pospt, strlen(skipname)), ".exe")) + sprintf(skipname, "%.*sskw", pospt, strcpy(STR4, skipname)); + } else + strcat(skipname, ".skw"); + /*END IF*/ + number_params = P_argc - 1; + + for (kkk = 1; kkk <= number_params; kkk++) { /*END WHILE*/ + kparm = kkk; + strcpy(optstr, P_argv[kparm]); + first_char = optstr[0]; + if (first_char == '-') { + printf("%cOption :>%s<\n", first_char, optstr); + if (optstr[1] == 'p') { + stdsize = 0; + FORLIM1 = strlen(optstr); + for (L = 2; L <= FORLIM1 - 1; L++) { + ikar = optstr[L]; + cat = catcode[ikar]; + if (cat != 16) { + printf("Illegal character in -p option: %s\n", optstr); + _Escape(0); + } + stdsize = stdsize * 10 + ikar - icharz; + } + printf("Standard size found: %dpt\n", stdsize); + if (stdsize < 11) + stdkz = 1; + else if (stdsize == 11) + stdkz = 2; + else + stdkz = 3; + } else if (optstr[1] == '2') { + /*END IF*/ + latex209 = true; + } else if (optstr[1] == 'v') + no_space_conv = true; + else if (optstr[1] == 's') + use_sl = true; + else if (optstr[1] == 't') + latex_header = false; + else if (optstr[1] == 'x') + simplify_ok = false; + else if (optstr[1] == 'b') + base_flag = true; + else if (optstr[1] == 'z') + strcpy(skipname, optstr + 2); + else if (optstr[1] == 'l') { + truncate24(latex_style, optstr); + if (*latex_style == '\0') + strcpy(latex_style, "report"); + } else if (optstr[1] == 'o') { + if (num_latex_options >= maxstyles) + printf("Too many style options, %s ignored !\n", optstr); + else { + num_latex_options++; + truncate24(latex_options[num_latex_options], + strsub(STR4, optstr, 3, bfslen)); + } + } else if (optstr[1] == 'f') { + /*END IF num_latex_options*/ + strcpy(figure_path, optstr + 2); + printf("-f:%s\n", figure_path); + } else if (optstr[1] == 'r') { + strcpy(logname, optstr + 2); + write_log = true; + } else if (optstr[1] == 'm') + tex_verbose = 1; /* insert marks in TeX output */ + else if (optstr[1] == 'd') { + verbose = 0; + FORLIM1 = strlen(optstr); + for (L = 2; L <= FORLIM1 - 1; L++) { + ikar = optstr[L]; + cat = catcode[ikar]; + if (cat != 16) { + printf("Illegal character in -d option: %s\n", optstr); + _Escape(0); + } + verbose = verbose * 10 + ikar - icharz; + /*END IF*/ + if (verbose > 0) + printf("Verbose=%d\n", verbose); + } + } else + printf("Unsupported option, ignored: %s\n", optstr); + } else if (*inputname == '\0') { + /*END IF*/ + strcpy(inputname, optstr); + } else if (*outputname == '\0') + strcpy(outputname, optstr); + else if (*optstr != '\0') { + printf("Too many non option args : %s\n", optstr); + printf("This one ignored !\n"); + } + } + + /*END IF*/ + pospt = strpos2(figure_path, "*", 1); + if (pospt == 0) { + printf("NO * in -f<path> option\n"); + _Escape(0); + } + strcpy(figure_type, figure_path + pospt); + sprintf(figure_path, "%.*s", pospt - 1, strcpy(STR3, figure_path)); + + if (*inputname == '\0') /* stops if help written */ + write_help(); + + if (pos_postfix(inputname) == 0) + strcat(inputname, ".rtf"); + + strcpy(inputfile_NAME, inputname); + if (inputfile != NULL) + inputfile = freopen(inputfile_NAME, "r", inputfile); + else + inputfile = fopen(inputfile_NAME, "r"); + _SETIO(inputfile != NULL, FileNotFound); + testio = P_ioresult; + success = (testio == 0); + if (!success) { + _SETIO(printf("Unable to open input file %s ; code=%d\n", + inputname, testio) >= 0, FileWriteError); + _Escape(0); + } + + if (*outputname == '\0') { + pospt = pos_postfix(inputname); + sprintf(outputname, "%.*stex", pospt, inputname); + _SETIO(printf("Output name taken from input: %s\n", outputname) >= 0, + FileWriteError); + } + + if (!strcmp(outputname, inputname)) { + _SETIO(printf("Input and output files have same names, abort!\n") >= 0, + FileWriteError); + _SETIO(printf(" Input: %s\n", inputname) >= 0, FileWriteError); + _SETIO(printf(" Output: %s\n", inputname) >= 0, FileWriteError); + if (inputfile != NULL) + fclose(inputfile); + inputfile = NULL; + _Escape(0); + } + + strcpy(outputfile_NAME, outputname); + if (outputfile != NULL) + outputfile = freopen(outputfile_NAME, "w", outputfile); + else + outputfile = fopen(outputfile_NAME, "w"); + _SETIO(outputfile != NULL, FileNotFound); + testio = P_ioresult; + success = (testio == 0); + + if (!success) { + _SETIO(printf("ioresult (output)=%d\n", testio) >= 0, FileWriteError); + _SETIO(printf("Unable to open output file %s ; code=%d\n", + outputname, testio) >= 0, FileWriteError); + if (inputfile != NULL) + fclose(inputfile); + inputfile = NULL; + _Escape(0); + } + + /* opening skip file to eliminate useless output \RTFxxx keywords */ + if (*skipname == '\0') { + pospt = pos_postfix(inputname); + sprintf(skipname, "%.*sskw", pospt, inputname); + _SETIO(printf("keyword skip file name taken from input: %s\n", skipname) >= 0, + FileWriteError); + } + + if (!strcmp(skipname, inputname)) { + _SETIO(printf("Input and skip files have same names, abort!\n") >= 0, + FileWriteError); + _SETIO(printf(" Input: %s\n", inputname) >= 0, FileWriteError); + _SETIO(printf(" skip: %s\n", inputname) >= 0, FileWriteError); + if (inputfile != NULL) + fclose(inputfile); + inputfile = NULL; + _Escape(0); + } + + strcpy(skipfile_NAME, skipname); + if (skipfile != NULL) + skipfile = freopen(skipfile_NAME, "r", skipfile); + else + skipfile = fopen(skipfile_NAME, "r"); + _SETIO(skipfile != NULL, FileNotFound); + testio = P_ioresult; + success = (testio == 0); + + if (!success) { + _SETIO(printf("ioresult (keyword skip file)=%d\n", testio) >= 0, + FileWriteError); + _SETIO(printf("Unable to open keyword skip file %s ; code=%d\n", + skipname, testio) >= 0, FileWriteError); + if (inputfile != NULL) + fclose(inputfile); + inputfile = NULL; + _Escape(0); + } + + + if (write_log) { /*END IF write_log*/ + if (*logname == '\0') { /*END IF logname*/ + pospt = pos_postfix(inputname); + sprintf(logname, "%.*slog", pospt, inputname); + _SETIO(printf("Log name taken from input : %s\n", logname) >= 0, + FileWriteError); + } + + if (!strcmp(logname, inputname) || !strcmp(logname, outputname)) + { /*END IF logname*/ + _SETIO(printf("Log and input or output files have same names, abort!\n") >= + 0, FileWriteError); + _SETIO(printf(" Log: %s\n", logname) >= 0, FileWriteError); + if (inputfile != NULL) + fclose(inputfile); + inputfile = NULL; + _Escape(0); + } + + strcpy(logfile_NAME, logname); + if (logfile != NULL) + logfile = freopen(logfile_NAME, "w", logfile); + else + logfile = fopen(logfile_NAME, "w"); + _SETIO(logfile != NULL, FileNotFound); + testio = P_ioresult; + write_log = (testio == 0); + + if (!write_log) { /*END IF not success*/ + _SETIO(printf("ioresult (Log)=%d\n", testio) >= 0, FileWriteError); + _SETIO(printf("Unable to open log file %s ; code=%d\n", logname, testio) >= + 0, FileWriteError); + if (inputfile != NULL) + fclose(inputfile); + inputfile = NULL; + _Escape(0); + } + _SETIO(printf("%s, ", logname) >= 0, FileWriteError); + } + _SETIO(printf("%s, %s and %s successfully opened.\n", + inputname, skipname, outputname) >= 0, FileWriteError); + + while (!P_eof(skipfile)) { /*END DO*/ + _SETIO(fgets(inskipk, bfslen + 1, skipfile) != NULL, EndOfFile); + TEMP = strchr(inskipk, '\n'); + if (TEMP != NULL) + *TEMP = 0; + sprintf(STR5, "Cancelling \"%s\"", inskipk); + println_msg(2, STR5); + if (*inskipk == '\0') { /*END IF*/ + /*END IF*/ + continue; + } + if (strlen(inskipk) + strlen(skip_strings[num_skip_strings-1]) < 255) + sprintf(skip_strings[num_skip_strings-1] + + strlen(skip_strings[num_skip_strings-1]), "%s ", inskipk); + else if (num_skip_strings < max_skip_strings) { + num_skip_strings++; + sprintf(skip_strings[num_skip_strings-1] + + strlen(skip_strings[num_skip_strings-1]), "%s ", inskipk); + } else { + sprintf(STR6, "Too many keywords to ignore, %s not recorded!", inskipk); + println_msg(1, STR6); + } + } +} + + +/*---------------------------------------------------------------------------*/ +/* clean the output line */ + +Static Void cleanout() +{ + for (i = 1; i <= olmx; i++) + exline[i-1] = ' '; + kout = 0; +} + + +/*---------------------------------------------------------------------------*/ +/* prints/displays the current stored output line */ + +Static Void print_line(verbose_level) +short verbose_level; +{ + short i, FORLIM; + Char STR1[256]; + + FORLIM = kout; + for (i = 0; i <= FORLIM - 1; i++) { + sprintf(STR1, "%c", exline[i]); + print_msg(verbose_level, STR1); + } + println_msg(verbose_level, "<<<"); +} + + +/*---------------------------------------------------------------------------*/ +/* makes the pos function in an array of type exline_type */ + +Static short array_pos(oldstring, testline, array_long) +Char *oldstring; +Char *testline; +short array_long; +{ + short Result = 0; + boolean string_found; + short lth1, jpos, kpos, FORLIM; + + lth1 = strlen(oldstring); + FORLIM = array_long - lth1 + 1; + for (kpos = 1; kpos <= FORLIM; kpos++) { /*END DO*/ + string_found = true; + for (jpos = 1; jpos <= lth1; jpos++) /*END DO*/ + string_found = (string_found && + oldstring[jpos-1] == testline[kpos + jpos - 2]); + if (string_found) /*END IF*/ + return kpos; + } + return Result; +} + + +/*---------------------------------------------------------------------------*/ +/* substitute a string with another in output line */ + +Static Void outsubstitute(oldstring, newstring) +Char *oldstring, *newstring; +{ + boolean string_found = true; + short lth1, lth2, jpos, kpos, oldkout; + exline_type oldline; + + lth1 = strlen(oldstring); + lth2 = strlen(newstring); + while (string_found) { /*END DO*/ + kpos = array_pos(oldstring, exline, kout); + string_found = (kpos > 0); + if (!string_found) /*END IF*/ + break; + memcpy(oldline, exline, sizeof(exline_type)); + oldkout = kout; + kout = kpos - 1; + for (jpos = 0; jpos <= lth2 - 1; jpos++) { /*END DO*/ + kout++; + exline[kout-1] = newstring[jpos]; + } + for (jpos = kpos + lth1 - 1; jpos <= oldkout - 1; jpos++) { /*END DO*/ + kout++; + exline[kout-1] = oldline[jpos]; + } + for (jpos = kout; jpos <= olmx - 1; jpos++) /*END DO*/ + exline[jpos] = ' '; + } +} + + +/*---------------------------------------------------------------------------*/ +/* converts an integer number of twips into a decimal string */ + +Static Void str_twips_pt(numval, outpts) +short numval; +Char *outpts; +{ + short k, l; + string24 wk, STR1; + Char STR2[28]; + Char STR3[256]; + Char STR5[256]; + + k = numval * 5; /* convert to hundredth of pts */ + sign_str(k, wk); + if (strlen(wk) < 2) { + sprintf(STR2, "00%s", wk); + strcpy(wk, truncate24(STR1, STR2)); + } + l = strlen(wk); + sprintf(STR5, "%.*s.%s", l - 2, wk, strsub(STR3, wk, l - 1, 2)); + truncate24(outpts, STR5); +} + + +/*---------------------------------------------------------------------------*/ +/* eliminates end replaces useless sequences in output -- pragmatic feature */ + +Static Void simplify(oldstring, newstring) +Char *oldstring, *newstring; +{ + if (simplify_ok) + outsubstitute(oldstring, newstring); +} + + +/*---------------------------------------------------------------------------*/ +/* read the future chars, excluding control chars < ord(' ') */ + +Static Void read_next_char() +{ + short next_ikar = 0; + Char next_char; + + next_char = next_ikar; + while (!P_eof(inputfile) && next_ikar < ' ' && strlen(next_rtf) < 8) + { /*END DO*/ + next_char = getc(inputfile); + _SETIO(next_char != EOF, EndOfFile); + next_ikar = next_char; + if (next_ikar == 13) { + input_line_number++; + memcpy(prev_line, inpline, (long)lmx); + prev_kinp = kinp; + kinp = 0; + } else if (next_ikar >= ' ') { + sprintf(next_rtf + strlen(next_rtf), "%c", next_char); + /*END IF*/ + } + } +} + + +/*---------------------------------------------------------------------------*/ +/* read one char except nulls */ + +Static Void read_char() +{ + if (*next_rtf != '\0') { + kar = next_rtf[0]; + strdelete((Anyptr)next_rtf, 1, 1); + read_next_char(); + } else + kar = '\032'; + /*END IF*/ + ikar = kar; + cat = catcode[ikar]; + if (*next_rtf == '\0') /*END IF*/ + strcat(next_rtf, "\032"); + + if (kinp < lmx) { /*END IF*/ + kinp++; + inpline[kinp-1] = kar; + } +} + + +/*---------------------------------------------------------------------------*/ +/* outputs the stored output line */ + +Static Void output_line() +{ + short i; + string24 simpl_pattern; + short FORLIM; + Char STR1[28]; + Char STR2[26]; + Char STR3[42]; + + numl++; + simplify("{{}", "{"); + simplify("{}}", "}"); + simplify("{}{}", "{}"); + FORLIM = num_diff_sizes; + for (i = 0; i <= FORLIM - 1; i++) { /*END DO*/ + sprintf(STR2, "\\%s", sizekey[i]); + truncate24(simpl_pattern, STR2); + sprintf(STR1, "%s{}\\", simpl_pattern); + sprintf(STR2, "%s\\", simpl_pattern); + simplify(STR1, STR2); + sprintf(STR2, "%s}", simpl_pattern); + simplify(STR2, "}"); + } + simplify("\\root{}\\of{", "\\sqrt{"); + + FORLIM = kout; + for (i = 0; i <= FORLIM - 1; i++) + _SETIO(putc(exline[i], outputfile) >= 0, FileWriteError); + _SETIO(putc('\n', outputfile) >= 0, FileWriteError); + + if (numl % 100 == 0) { /*END IF NUML*/ +/* p2c: rtflatex.cmn, line 915: + * Note: Using % for possibly-negative arguments [317] */ + if (verbose > 0) { + sign_str(numl, works); + sprintf(STR3, "Output : %s lines ", works); + print_msg(1, STR3); + FORLIM = bracelvl; + for (j = 1; j <= FORLIM; j++) + print_msg(1, "{"); + println_msg(1, ""); + } else + putchar('.'); + } + cleanout(); +} + + +/*---------------------------------------------------------------------------*/ +/* write a character into output line */ + +Static Void output_real_line() +{ + if (kout > 0) + output_line(); +} + + +/*---------------------------------------------------------------------------*/ +/* write a character into output line */ + +Static Void outchr(CHARAC) +Char CHARAC; +{ + Char oldchar; + Char newchar = CHARAC; + Char STR1[48]; + + if (kout > 0) { + oldchar = exline[kout-1]; + if (oldchar == ' ' && newchar == ' ') + return; + } else if (kout == 0 && last_percent && CHARAC == ' ') { + kout = 1; + exline[kout-1] = '\\'; + } + /*END IF*/ + last_percent = false; + + if (kout >= olmx - 2) { + /*END IF*/ + sign_str(kout, works); + sprintf(STR1, "Output overflow, KOUT:=%s", works); + println_msg(0, STR1); + /*END IF*/ + return; + } + kout++; + exline[kout-1] = newchar; + if (newchar != '}' || kout <= 80) { + /*END IF*/ + if (newchar == ' ' && kout > 64) + output_line(); + return; + } + if (exline[kout-2] == ';') { + exline[kout-1] = '\\'; + kout++; + exline[kout-1] = 'r'; + kout++; + exline[kout-1] = 'e'; + kout++; + exline[kout-1] = 'l'; + kout++; + exline[kout-1] = 'a'; + kout++; + exline[kout-1] = 'x'; + output_line(); + kout++; + exline[kout-1] = ' '; + kout++; + exline[kout-1] = newchar; + return; + } + if (kout <= 120) + return; + kout++; + exline[kout-1] = '%'; + kout++; + exline[kout-1] = '%'; + output_line(); + last_percent = true; +} + + +/* ===================================================================== */ +/* change contents of bfslcode[bracelvl] : replace first arg with 2nd */ +/* but do not declare font, since output will be standard */ + +Static Void font_subs2e(old, new_) +Char *old, *new_; +{ + Char workstg[49]; + short positn; + + positn = strpos2(bfslcode[bracelvl], old, 1); + if (positn == 0) + return; + if (lvlcode[bracelvl] == 9) /* ignore new fonts in header/footer */ + return; + if (verbose >= 2) + _SETIO(printf("font_subs2e: %s|%s|%s", old, bfslcode[bracelvl], new_) >= 0, + FileWriteError); + strcpy(workstg, bfslcode[bracelvl]); + strdelete((Anyptr)workstg, positn, strlen(old)); + if (strpos2(workstg, new_, 1) == 0) + strinsert(new_, (Anyptr)workstg, positn); + truncate24(bfslcode[bracelvl], workstg); + if (verbose >= 2) + _SETIO(printf("=>%s\n", workstg) >= 0, FileWriteError); +} + + +/*---------------------------------------------------------------------------*/ +/* inserts a new font specification like \bf \rm \sc into bfslcode[bracelvl] */ + +Static Void add_to_bfsl(kod) +Char *kod; +{ /* bfsl_old:=bfslcode[bracelvl]; */ + Char bfsl_try[65]; + Char STR1[256]; + string24 STR2; + + sprintf(bfsl_try, "%s\\", bfslcode[bracelvl]); + sprintf(STR1, "%s\\", kod); + if (strpos2(bfsl_try, STR1, 1) > 0) + return; + sprintf(STR1, "%s%s", bfslcode[bracelvl], kod); + strcpy(bfslcode[bracelvl], truncate24(STR2, STR1)); + /* writeln('add_to:',bfsl_old,'+',kod,'=',bfslcode[bracelvl]); */ +} + + +/*---------------------------------------------------------------------------*/ +/* output one character capitalized if needed */ + +Static Void outchrc(CHARAC) +Char CHARAC; +{ + Char kar; + + if (lvlcode[bracelvl] == 2) + kar = toupper(CHARAC); + else + kar = CHARAC; + outchr(kar); +} + + +/*---------------------------------------------------------------------------*/ +/* write a string into output line */ + +Static Void outstg(CHARACs) +Char *CHARACs; +{ + short k, FORLIM; + + FORLIM = strlen(CHARACs); + for (k = 0; k <= FORLIM - 1; k++) + outchr(CHARACs[k]); +} + + +/* ===================================================================== */ +/* checks the presence of a string at end of current output */ + +Static boolean last_is(CHARACs) +Char *CHARACs; +{ + boolean Result; + short k, long_; + + long_ = strlen(CHARACs); +/* p2c: rtflatex.cmn: Note: Eliminated unused assignment statement [338] */ + if (kout < long_) + return false; + for (k = 0; k <= long_ - 1; k++) { + if (exline[kout - long_ + k] != CHARACs[k]) + return false; + } + return true; +} + + +/* ===================================================================== */ +/* remove one string from output */ + +Static Void outrem(CHARACs) +Char *CHARACs; +{ + short k, long_, FORLIM; + + long_ = strlen(CHARACs); + removed_ok = last_is(CHARACs); + if (!removed_ok) + return; + FORLIM = kout; + for (k = kout - long_ + 1; k <= FORLIM; k++) + exline[kout-1] = ' '; + kout -= long_; +} + + +/* ===================================================================== */ +/* remove all empty pairs of braces at the end of output */ + +Static Void outrem_empty_braces() +{ + short num_removed = 0; + + removed_ok = true; + while (removed_ok) { /*END WHILE*/ + outrem("{}"); + if (removed_ok) + num_removed++; + } + removed_ok = (num_removed > 0); +} + + +/*---------------------------------------------------------------------------*/ +/* output a TeX keyword ( the \ not in args ) on output line EXLINE */ + +Static Void outkeyw(CHARACs) +Char *CHARACs; +{ + short k, FORLIM; + + /* eliminate useless brace pairs terminating a previous keyword*/ + outrem_empty_braces(); + outchr('\\'); + FORLIM = strlen(CHARACs); + for (k = 0; k <= FORLIM - 1; k++) + outchr(CHARACs[k]); +} + + +/*---------------------------------------------------------------------------*/ +/* outputs the new \bf \sl code if different from current at that level */ + +Static Void output_bfsl() +{ + if (!strcmp(bfslcode[bracelvl], currbfsl[bracelvl])) + return; + if (!strcmp(bfslcode[bracelvl], "\\relax")) + return; + if (math_mode[bracelvl] > 0) + return; + outrem_empty_braces(); + outrem(currbfsl[bracelvl]); + font_subs2e("\\rm\\bf", "\\bf"); + font_subs2e("\\rm\\tt", "\\tt"); + font_subs2e("\\rm\\it", "\\it"); + font_subs2e("\\rm\\sf", "\\sf"); + font_subs2e("\\rm\\sl", "\\sl"); + + if (!latex209) { + font_subs2e("\\bf\\it", "\\bfit"); + font_subs2e("\\it\\bf", "\\bfit"); + font_subs2e("\\bf\\sl", "\\bfsl"); + font_subs2e("\\sl\\bf", "\\bfsl"); + font_subs2e("\\bf\\sf", "\\sfbf"); + font_subs2e("\\sf\\bf", "\\sfbf"); + font_subs2e("\\sf\\it", "\\sfit"); + font_subs2e("\\sf\\sl", "\\sfsl"); + font_subs2e("\\tt\\bf", "\\ttbf"); + font_subs2e("\\tt\\it", "\\ttit"); + font_subs2e("\\tt\\sl", "\\ttsl"); + font_subs2e("\\bf\\tt", "\\ttbf"); + font_subs2e("\\it\\tt", "\\ttit"); + font_subs2e("\\sl\\tt", "\\ttsl"); + font_subs2e("\\sfit\\bf", "\\sfbfit"); + font_subs2e("\\sfsl\\bf", "\\sfbfsl"); + font_subs2e("\\bfit\\sf", "\\sfbfit"); + font_subs2e("\\bfsl\\sf", "\\sfbfsl"); + } + /* latex2e */ + /*END IF latex209*/ + outstg(bfslcode[bracelvl]); + outstg("{}"); + strcpy(currbfsl[bracelvl], bfslcode[bracelvl]); +} + + +/*---------------------------------------------------------------------------*/ +/* outputs the new \large code if different from current at that level */ + +Static Void output_size(codesize) +Char *codesize; +{ + if (!strcmp(codesize, currsize[bracelvl])) + return; + if (!strcmp(codesize, "relax")) + return; + if (lvlcode[bracelvl] == 8) + return; + if (lvlcode[bracelvl] == 9) + return; + if (math_mode[bracelvl] > 0) + return; + outkeyw(codesize); + if (!base_flag) { /*END IF*/ + outstg("{}"); + strcpy(currsize[bracelvl], codesize); + } + strcpy(currbfsl[bracelvl], "\\relax"); +} + + +/* ----------------------------------------------------------------------*/ +Static Void ensure_sizebfsl() +{ + if (par_to_begin) + return; + if (last_is("{")) + output_size(sizecode[bracelvl]); + output_bfsl(); +} + + +/* ----------------------------------------------------------------------*/ +Static Void output_skips() +{ + if (leftcurskip != leftskip) { + str_twips_pt(leftskip, worksa); + outkeyw("global\\leftskip "); + outstg(worksa); + outstg("pt\\relax"); + leftcurskip = leftskip; + } + + if (rightcurskip == rightskip) + return; + str_twips_pt(rightskip, worksa); + outkeyw("global\\rightskip "); + outstg(worksa); + outstg("pt\\relax"); + rightcurskip = rightskip; +} + + +/*---------------------------------------------------------------------------*/ +Static Void close_files() +{ + if (outputfile != NULL) + fclose(outputfile); + outputfile = NULL; + if (inputfile != NULL) + fclose(inputfile); + inputfile = NULL; + if (!write_log) + return; + if (logfile != NULL) + fclose(logfile); + logfile = NULL; +} + + +/* ===================================================================== */ +/* remove one keyword from output */ + +Static Void outkrem(CHARACs) +Char *CHARACs; +{ + Char STR1[256]; + + sprintf(STR1, "\\%s", CHARACs); + outrem(STR1); +} + + +/* --------------------------------------------------------------------------*/ +/* open brace and increment bracelvl */ + +Static Void open_brace() +{ + Char STR1[56]; + Char STR2[34]; + + if (bracelvl < maxlevel) { + bracelvl++; + strcpy(bfslcode[bracelvl], bfslcode[bracelvl-1]); + tab_nb_cellx[bracelvl] = tab_nb_cellx[bracelvl-1]; + tab_cellx[bracelvl] = 0; + strcpy(sizecode[bracelvl], sizecode[bracelvl-1]); + strcpy(currsize[bracelvl], currsize[bracelvl-1]); + strcpy(currbfsl[bracelvl], currbfsl[bracelvl-1]); + strcpy(spacingcode[bracelvl], spacingcode[bracelvl-1]); + lvlcode[bracelvl] = lvlcode[bracelvl-1]; + if (bracelvl < maxlevel) + lvlcode[bracelvl+1] = 0; + strcpy(active_RTFf[bracelvl], active_RTFf[bracelvl-1]); + /* propagate math_mode, but say 2 if previous was 1 to avoid extra closins by $ */ + math_mode[bracelvl] = math_mode[bracelvl-1]; + if (math_mode[bracelvl] == 1) + math_mode[bracelvl] = 2; + + flushright_flag[bracelvl] = flushright_flag[bracelvl-1]; + if (flushright_flag[bracelvl] == 2) + flushright_flag[bracelvl] = 3; + + center_flag[bracelvl] = center_flag[bracelvl-1]; + if (center_flag[bracelvl] == 2) + center_flag[bracelvl] = 3; + + underl_flag[bracelvl] = false; + auto_close[bracelvl] = false; + *form_code[bracelvl] = '\0'; + strcpy(close_kar[bracelvl], " "); + if (lvlcode[bracelvl] == 3) { + lvlcode[bracelvl] = 4; + return; + } + if (lvlcode[bracelvl] == 10) { /*in objects*/ + lvlcode[bracelvl] = -lvlcode[bracelvl]; + return; + } + if (lvlcode[bracelvl] == 15) + /*brace opened after \RTFintbl => set normal*/ + lvlcode[bracelvl] = 0; + else if (lvlcode[bracelvl] >= 16) /*in formulas*/ + lvlcode[bracelvl] = -lvlcode[bracelvl]; + return; + } else { + /*END IF*/ + sign_str(maxlevel, works); + sprintf(STR1, "Too many brace levels, max is %s", works); + print_msg(0, STR1); + sign_str(numl + 1, works); + sprintf(STR2, " at line%s", works); + println_msg(0, STR2); + print_line(0); + if (write_log) + close_files(); + _Escape(0); + /*END IF bracelvl<maxlevel*/ + } +} + + +/*---------------------------------------------------------------------------*/ +/* output \begin(<arg>) */ + +Static Void begin_env(environ) +short environ; +{ + if (kout > 0) + output_line(); + outkeyw("begin{"); + outstg(environ_type[environ]); + outstg("}\\strut"); + open_brace(); + output_line(); +} + + +/* ----------------------------------------------------------------------*/ +/* execute \begin{center}/{flushright} is center_flag set to 1 */ +Static Void make_center() +{ + if (center_flag[bracelvl] == 1) { + begin_env(1); + center_flag[bracelvl] = 2; + } + if (flushright_flag[bracelvl] == 1) { + begin_env(2); + flushright_flag[bracelvl] = 2; + } +} + + +/* ----------------------------------------------------------------------*/ +Static Void begin_par() +{ + short k, FORLIM; + + if (!par_to_begin) + return; + if (lvlcode[bracelvl] == 6) + return; + if (lvlcode[bracelvl] == 8) + return; + if (lvlcode[bracelvl] == 9) + return; + if (center_flag[bracelvl] + flushright_flag[bracelvl] == 0) + output_skips(); + space_after = save_skip; + save_skip = 0; + if (num_indent == 0 && lvlcode[bracelvl] != 15 && + center_flag[bracelvl] == 0 && flushright_flag[bracelvl] == 0) + outkeyw("noindent "); + FORLIM = num_indent; + for (k = 2; k <= FORLIM; k++) + outkeyw("indent "); + num_indent = 0; + make_center(); + output_size(sizecode[bracelvl]); + output_bfsl(); + outkeyw("beginparagraph{}"); + par_to_begin = false; +} + + +/*---------------------------------------------------------------------------*/ +/* write a string into math mode onto output line, and leave in math mode */ + +Static Void out_math_leave(CHARACs) +Char *CHARACs; +{ + if (math_mode[bracelvl] > 0) + outchr(' '); + else { + outrem_empty_braces(); + outrem("$"); + if (removed_ok) + math_mode[bracelvl] = 1; + } + /*END IF math_mode*/ + if (math_mode[bracelvl] == 0) { /*END IF math_mode=0*/ + begin_par(); + outchr('$'); + math_mode[bracelvl] = 1; + } + outstg(CHARACs); +} + + +/*---------------------------------------------------------------------------*/ +/* close math_mode if possible, i.e. =1 */ + +Static Void close_math() +{ + if (math_mode[bracelvl] == 1) { /*END IF math_mode*/ + outstg(end_math_code); + math_mode[bracelvl] = 0; + } +} + + +/*---------------------------------------------------------------------------*/ +/* write a string into math mode onto output and close math mode if possible*/ + +Static Void out_math(CHARACs) +Char *CHARACs; +{ + out_math_leave(CHARACs); + close_math(); +} + + +/* ===================================================================== */ +/* output one string and capitalize it if required */ + +Static Void outstgc(CHARACs) +Char *CHARACs; +{ + short k, FORLIM; + + FORLIM = strlen(CHARACs); + for (k = 0; k <= FORLIM - 1; k++) + outchrc(CHARACs[k]); +} + + +/* ===================================================================== */ +/* output a number */ + +Static Void output_num(numb) +short numb; +{ + string24 wkk; + + sign_str(numb, wkk); + outstg(wkk); +} + + +/* ===================================================================== */ +/* output one keyword and capitalize it */ + +Static Void outkeywc(CHARACs) +Char *CHARACs; +{ + short k, FORLIM; + + outrem_empty_braces(); + outchr('\\'); + FORLIM = strlen(CHARACs); + for (k = 0; k <= FORLIM - 1; k++) + outchrc(CHARACs[k]); +} + + +/* ===================================================================== */ +/* close brace pair and remove all sub/superscripted empty pairs at end of output */ + +Static Void close_subs() +{ + if (math_mode[bracelvl] > 0) + outrem(" "); + outchr('}'); + outrem("^{}"); + outrem("_{}"); + outrem("^{ }"); + outrem("_{ }"); +} + + +/* ===================================================================== */ +/* declares a new font as \global, and record it */ + +Static Void declare_font(font_id, fontname, magnification) +Char *font_id, *fontname; +short magnification; +{ + short i, FORLIM; + Char STR2[256]; + + FORLIM = numfonts; + for (i = 0; i <= FORLIM - 1; i++) { + if (!strcmp(newfonts[i], font_id)) + return; + } + if (numfonts >= maxfonts) { /*END IF*/ + sprintf(STR2, "Font %s cannot be declared... too many fonts !", font_id); + println_msg(0, STR2); + return; + } + + numfonts++; + truncate24(newfonts[numfonts-1], font_id); + + if (kout > 1) /* to have font decl at left of a line */ + output_line(); + outstg("\\ifx"); + outstg(font_id); + outstg("\\undefined \\global\\font"); + outstg(font_id); + outstg("=\\FontHdg\\FontHdge "); + outstg(fontname); + sign_str(magnification, works); + outstg(" scaled "); + outstg(works); + outstg("\\fi"); + output_line(); + +} + + +/* ===================================================================== */ +/* change contents of bfslcode[bracelvl] : replace first arg with 2nd */ + +Static Void font_subs(old, new_, fontname, magnification) +Char *old, *new_, *fontname; +short magnification; +{ + Char workstg[49]; + short positn; + + positn = strpos2(bfslcode[bracelvl], old, 1); + if (positn == 0) + return; + if (lvlcode[bracelvl] == 9) /* ignore new fonts in header/footer */ + return; + strcpy(workstg, bfslcode[bracelvl]); + strdelete((Anyptr)workstg, positn, strlen(old)); + if (strpos2(bfslcode[bracelvl], new_, 1) == 0) + strinsert(new_, (Anyptr)workstg, positn); + truncate24(bfslcode[bracelvl], workstg); + declare_font(new_, fontname, magnification); +} + + +/*---------------------------------------------------------------------------*/ +/* builds the correct LaTeX font size according to NUMVAL (unit=1/2 pt) */ +/* stores it in sizecode[bracelvl] ; uses the global variable "stdsize" */ + +Static Void outfsize(numval, magnif) +short numval, *magnif; +{ + short ll; + short selectsize = 0; + short latex_size; + short best_diff = 30000; + Char STR1[68]; + + /* I select the nearest sizemags */ + latex_size = numval * 50; + /* convert from half points to hundredths of points */ + /* big integer */ + strcpy(sizecode[bracelvl], "tiny"); + for (ll = 0; ll <= numsizes - 1; ll++) { /*END DO*/ + if (abs(sizemags[stdkz-1][ll] - latex_size) < best_diff) { /*END IF*/ + strcpy(sizecode[bracelvl], sizekey[ll]); + selectsize = sizemags[stdkz-1][ll]; + *magnif = sizemags[stdkz-1][ll]; + best_diff = abs(selectsize - latex_size); + } + } + + sign_str(selectsize, works); + sprintf(STR1, " selectsize=%s xkey=%s", works, sizecode[bracelvl]); + println_msg(2, STR1); + +} + + +/*---------------------------------------------------------------------------*/ +Static Void font_clean(sizeheader, magnification) +Char *sizeheader; +short magnification; +{ + Char STR1[256]; + + if (latex209) { + sprintf(STR1, "%sbfit", sizeheader); + font_subs("\\rm\\bf\\it", STR1, "bxti10", magnification); + sprintf(STR1, "%sbfit", sizeheader); + font_subs("\\rm\\it\\bf", STR1, "bxti10", magnification); + sprintf(STR1, "%sbfsl", sizeheader); + font_subs("\\rm\\bf\\sl", STR1, "bxsl10", magnification); + sprintf(STR1, "%sbfsl", sizeheader); + font_subs("\\rm\\sl\\bf", STR1, "bxsl10", magnification); + sprintf(STR1, "%ssfbf", sizeheader); + font_subs("\\rm\\bf\\sf", STR1, "ssbx10", magnification); + sprintf(STR1, "%ssfbf", sizeheader); + font_subs("\\rm\\sf\\bf", STR1, "ssbx10", magnification); + sprintf(STR1, "%sbfit", sizeheader); + font_subs("\\bf\\it", STR1, "bxti10", magnification); + sprintf(STR1, "%sbfit", sizeheader); + font_subs("\\it\\bf", STR1, "bxti10", magnification); + sprintf(STR1, "%sbfsl", sizeheader); + font_subs("\\bf\\sl", STR1, "bxsl10", magnification); + sprintf(STR1, "%sbfsl", sizeheader); + font_subs("\\sl\\bf", STR1, "bxsl10", magnification); + sprintf(STR1, "%ssfbf", sizeheader); + font_subs("\\bf\\sf", STR1, "ssbx10", magnification); + sprintf(STR1, "%ssfbf", sizeheader); + font_subs("\\sf\\bf", STR1, "ssbx10", magnification); + if (magnification > 2000) { /*definir explicitement les grosses polices*/ + sprintf(STR1, "%sobf", sizeheader); + font_subs("\\rm\\oul", STR1, "obx10", magnification); + sprintf(STR1, "%ssf", sizeheader); + font_subs("\\rm\\sf", STR1, "ss10", magnification); + sprintf(STR1, "%sit", sizeheader); + font_subs("\\rm\\it", STR1, "ti10", magnification); + sprintf(STR1, "%ssl", sizeheader); + font_subs("\\rm\\sl", STR1, "sl10", magnification); + sprintf(STR1, "%ssc", sizeheader); + font_subs("\\rm\\sc", STR1, "csc10", magnification); + sprintf(STR1, "%stt", sizeheader); + font_subs("\\rm\\tt", STR1, "tt10", magnification); + sprintf(STR1, "%ssf", sizeheader); + font_subs("\\sf", STR1, "ss10", magnification); + sprintf(STR1, "%sit", sizeheader); + font_subs("\\it", STR1, "ti10", magnification); + sprintf(STR1, "%ssl", sizeheader); + font_subs("\\sl", STR1, "sl10", magnification); + sprintf(STR1, "%ssc", sizeheader); + font_subs("\\sc", STR1, "csc10", magnification); + sprintf(STR1, "%stt", sizeheader); + font_subs("\\tt", STR1, "tt10", magnification); + } + } else { + font_subs2e("\\rm\\bf\\it", "\\bfit"); + font_subs2e("\\rm\\it\\bf", "\\bfit"); + font_subs2e("\\rm\\bf\\sl", "\\bfsl"); + font_subs2e("\\rm\\sl\\bf", "\\bfsl"); + font_subs2e("\\rm\\bf\\sf", "\\sfbf"); + font_subs2e("\\rm\\sf\\bf", "\\sfbf"); + font_subs2e("\\rm\\sf\\it", "\\sfit"); + font_subs2e("\\rm\\sf\\sl", "\\sfsl"); + font_subs2e("\\bf\\it", "\\bfit"); + font_subs2e("\\it\\bf", "\\bfit"); + font_subs2e("\\bf\\sl", "\\bfsl"); + font_subs2e("\\sl\\bf", "\\bfsl"); + font_subs2e("\\bf\\sf", "\\sfbf"); + font_subs2e("\\sf\\bf", "\\sfbf"); + font_subs2e("\\sf\\it", "\\sfit"); + font_subs2e("\\sf\\sl", "\\sfsl"); + if (magnification > 2000) { /*definir explicitement les grosses polices*/ + sprintf(STR1, "%sobf", sizeheader); + font_subs("\\rm\\oul", STR1, "obx10", magnification); + sprintf(STR1, "%ssf", sizeheader); + font_subs("\\rm\\sf", STR1, "ss10", magnification); + sprintf(STR1, "%sit", sizeheader); + font_subs("\\rm\\it", STR1, "ti10", magnification); + sprintf(STR1, "%ssl", sizeheader); + font_subs("\\rm\\sl", STR1, "sl10", magnification); + sprintf(STR1, "%ssc", sizeheader); + font_subs("\\rm\\sc", STR1, "csc10", magnification); + sprintf(STR1, "%stt", sizeheader); + font_subs("\\rm\\tt", STR1, "tt10", magnification); + sprintf(STR1, "%ssf", sizeheader); + font_subs("\\sf", STR1, "ss10", magnification); + sprintf(STR1, "%sit", sizeheader); + font_subs("\\it", STR1, "ti10", magnification); + sprintf(STR1, "%ssl", sizeheader); + font_subs("\\sl", STR1, "sl10", magnification); + sprintf(STR1, "%ssc", sizeheader); + font_subs("\\sc", STR1, "csc10", magnification); + sprintf(STR1, "%stt", sizeheader); + font_subs("\\tt", STR1, "tt10", magnification); + } + } + sprintf(STR1, "%sobf", sizeheader); + /* latex2e */ + /*END IF latex209*/ + font_subs("\\rm\\oul", STR1, "obx10", magnification); + +} + + +/*---------------------------------------------------------------------------*/ +/* output the correct LaTeX spacing size according to NUMVAL (unit=1/20 pt) */ +/* stores it in spacingcode[bracelvl] ; uses the global variable "stdsize" */ + +Static Void outpsize(numval) +short numval; +{ + short ll; + short selectsize = 0, best_diff = 30000; + Char STR1[108]; + Char STR3[40]; + + if (base_flag) { + str_twips_pt(numval, worksa); + sprintf(STR3, "baselineskip%spt", worksa); + truncate24(spacingcode[bracelvl], STR3); + return; + } + /* I select the nearest sizeval -- spacings in twips */ + /* big integer */ + strcpy(spacingcode[bracelvl], "tiny"); + for (ll = 0; ll <= numsizes - 1; ll++) { /*END DO*/ + if (abs(sizeval[stdkz-1][ll] - numval) < best_diff) { /*END IF*/ + strcpy(spacingcode[bracelvl], sizekey[ll]); + selectsize = sizeval[stdkz-1][ll]; + best_diff = abs(sizeval[stdkz-1][ll] - numval); + } + } + + sign_str(numval, works); + sign_str(selectsize, worksa); + sprintf(STR1, "--> (\\par)numval=%s selectsize=%s pkey=%s", + works, worksa, spacingcode[bracelvl]); + print_msg(2, STR1); + /*END IF*/ +} + + +/*---------------------------------------------------------------------------*/ +/* remove $^ before, and remove math_mode if possible */ + +Static Void remove_mathat() +{ + if (math_mode[bracelvl] > 0) { /*END IF math_mode*/ + if (auto_close[bracelvl]) { + outrem("{"); + if (removed_ok) + bracelvl--; + } + outrem("^"); + outrem("\\relax"); + if (math_mode[bracelvl] == 1) { + outrem("$"); + if (removed_ok) + math_mode[bracelvl] = 0; + } + } + outrem("{}"); +} + + +/* --------------------------------------------------------------------------*/ +/* close brace and decrement bracelvl */ + +Static Void close_brace() +{ + Char STR1[44]; + Char STR3[68]; + + if (bracelvl <= 0) { + sign_str(numl + 1, works); + sprintf(STR1, "Too many } at line %s", works); + println_msg(0, STR1); + print_line(0); + outstg("}%%%%% *****"); + } else { + if (lvlcode[bracelvl] != 6) { + if (tex_verbose > 1) { + sign_str(bracelvl, worksa); + sign_str(lvlcode[bracelvl], works); + sprintf(STR3, "\\closebr{%s[%s]}\\relax", worksa, works); + outstg(STR3); + output_line(); + } + } + } + bracelvl--; + /* reset footnote cleaning */ + if (lvlcode[bracelvl] == 3) /*END IF bracelvl*/ + lvlcode[bracelvl] = 0; +} + + +/*---------------------------------------------------------------------------*/ +/* output \end(<arg>) */ + +Static Void end_env(environ) +short environ; +{ + output_line(); + outkeyw("end{"); + outstg(environ_type[environ]); + outchr('}'); + close_brace(); + output_line(); +} + + +/*---------------------------------------------------------------------------*/ +/* stores a new couple of word font chars and number taken in +decl_font_num which is a global variable */ + +Static Void store_word_font(font_type) +Char *font_type; +{ + short k; + Char new_fnt_name[256]; + short loc_brace_count = 0; + short FORLIM; + Char STR2[256], STR3[256]; + + sign_str(decl_font_num, works); + FORLIM = num_word_fonts; + for (k = 0; k <= FORLIM - 1; k++) { /*END/IF + END FOR*/ + if (word_font_num[k] == decl_font_num) { + sprintf(STR2, "RTF font No. %s/%s already declared; this one ignored.", + works, font_type); + println_msg(0, STR2); + return; + } + } + if (num_word_fonts >= maxfonts) { /*END IF*/ + sprintf(STR3, "Too many RTF fonts: %s/%s; this one ignored.", + works, font_type); + println_msg(0, STR3); + return; + } + *new_fnt_name = '\0'; + while (kar != ';' && kar != '}' || loc_brace_count > 0) { + /* while (kar<>';') do */ + if (kar == '{') + loc_brace_count++; + if (kar == '}') + loc_brace_count--; + read_char(); + if (kar != ' ') + sprintf(new_fnt_name + strlen(new_fnt_name), "%c", kar); + } + outrem_empty_braces(); + num_word_fonts++; + word_font_num[num_word_fonts-1] = decl_font_num; + truncate24(word_fonts[num_word_fonts-1], font_type); + sign_str(num_word_fonts, worksa); + if (strpos2(new_fnt_name, "Courier", 1) > 0) + strcpy(equiv_fonts[num_word_fonts-1], "\\tt"); + else if (strpos2(new_fnt_name, "TTY", 1) > 0) + strcpy(equiv_fonts[num_word_fonts-1], "\\tt"); + else if (strpos2(new_fnt_name, "Helvetica", 1) > 0) + strcpy(equiv_fonts[num_word_fonts-1], "\\sf"); + else if (strpos2(new_fnt_name, "SansSerif", 1) > 0) + strcpy(equiv_fonts[num_word_fonts-1], "\\sf"); + else + *equiv_fonts[num_word_fonts-1] = '\0'; + sprintf(STR3, "%s Font %s stored: \"%s\" = %s", + worksa, works, font_type, new_fnt_name); + /*END IF*/ + println_msg(2, STR3); +} + + + +/*---------------------------------------------------------------------------*/ +/* sets active_RTFf of current bracelvl at the alpha value recorded with kkk +as \F<number> in \fonttbl declaration */ + +Static Void set_active_RTFf(kkk) +short kkk; +{ + short k, FORLIM; + Char STR1[40]; + Char STR2[100]; + Char STR3[38]; + Char STR4[62]; + Char STR5[82]; + + FORLIM = num_word_fonts; + for (k = 0; k <= FORLIM - 1; k++) { /*END/IF + END FOR*/ + if (word_font_num[k] == kkk) { + sign_str(kkk, works); + sprintf(STR2, "RTF font No. %s of type %s \"%s\"", + works, word_fonts[k], equiv_fonts[k]); + println_msg(2, STR2); + add_to_bfsl(equiv_fonts[k]); + ensure_sizebfsl(); + strcpy(active_RTFf[bracelvl], word_fonts[k]); + return; + } + } + if (lvlcode[bracelvl] != 6) { /*END IF lvlcode*/ + print_line(2); + sign_str(num_word_fonts, works); + sprintf(STR1, "num_word_fonts=%s", works); + println_msg(2, STR1); + FORLIM = num_word_fonts; + for (k = 0; k <= FORLIM - 1; k++) { + sign_str(word_font_num[k], works); + sprintf(STR4, " %s --> \"%s\"", works, word_fonts[k]); + println_msg(2, STR4); + } + sign_str(kkk, works); + sprintf(STR3, "RTF font No. %s", works); + print_msg(2, STR3); + sign_str(lvlcode[bracelvl], works); + sign_str(bracelvl, worksa); + sprintf(STR5, " font of type unknown, lvlcode[%s]=%s", worksa, works); + println_msg(2, STR5); + sign_str(lvlcode[bracelvl-1], works); + sign_str(bracelvl - 1, worksa); + sprintf(STR5, " font of type unknown, lvlcode[%s]=%s", worksa, works); + println_msg(2, STR5); + } + *active_RTFf[bracelvl] = '\0'; +} + + +/* ------------------------------------------------------------------------- */ +/* closing a \sum(...) ... possibly at a ) found !!!!!*/ + +Static Void close_sum() +{ + close_brace(); + close_math(); +} + + +/* ------------------------------------------------------------------------- */ +/* closing a \sum(...) ... possibly at a closing brace if no ) found !!!!!*/ + +Static Void close_sum_emergency(kode) +Char *kode; +{ + short k; + Char STR1[256]; + Char STR3[42]; + short FORLIM; + + sign_str(input_line_number, works); + sprintf(STR1, "Emergency close of \\|su or \\|i due to }%s at inp.line %s", + kode, works); + println_msg(1, STR1); + sign_str(next_rtf[0], works); + sprintf(STR3, "pattern : \"%c%c\" %s", kar, next_rtf[0], works); + print_msg(1, STR3); + print_line(1); + _SETIO(printf("kinp=%d prev_kinp=%d\n", kinp, prev_kinp) >= 0, + FileWriteError); + FORLIM = prev_kinp; + for (k = 0; k <= FORLIM - 1; k++) { + sprintf(STR1, "%c", prev_line[k]); + print_msg(1, STR1); + } + println_msg(1, " "); + FORLIM = kinp; + for (k = 0; k <= FORLIM - 1; k++) { + sprintf(STR1, "%c", inpline[k]); + print_msg(1, STR1); + } + println_msg(1, " "); + outstg("\\emergcA "); + close_sum(); +} + + +/* --------------------------------------------------------------------------*/ +Static Void perform_RTFcell() +{ + if (verbose > 0) + _SETIO(printf("(found)%s[%d,%d,%d]\n", + inkeyw, lvlcode[bracelvl], tab_nb_ands[bracelvl], + bracelvl) >= 0, FileWriteError); + if (lvlcode[bracelvl] == 15) { + output_real_line(); + /* count the number of ampersands in the tabular line */ + tab_nb_ands[bracelvl]++; + if (tab_nb_ands[bracelvl] < tab_nb_cellx[bracelvl]) { + outstg(" & "); + if (verbose > 1) + _SETIO(printf("(after &)%s[%d,%d]\n", + inkeyw, lvlcode[bracelvl], + bracelvl) >= 0, FileWriteError); + return; + } + outstg("\\\\"); + if (clbrdrb) + outkeyw("hline "); + if (verbose > 1) + _SETIO(printf("(after &->\\\\)%s[%d,%d]\n", + inkeyw, lvlcode[bracelvl], + bracelvl) >= 0, FileWriteError); + return; + } + if (verbose > 2) + _SETIO(printf("%s[%d,%d]\n", inkeyw, lvlcode[bracelvl], bracelvl) >= 0, + FileWriteError); + outkeyw("relax"); + output_line(); /* next line to ensure possible removal */ + outkeyw("RTFcell "); + /*END IF lvlcode*/ + +} + + +/* --------------------------------------------------------------------------*/ +/* procedure to close center and flushright environments */ + +Static Void close_envir() +{ + boolean RTF_cell_removed; + + envir_closed_ok = false; + if (center_flag[bracelvl] == 2) { + if (!no_space_conv) + output_size(spacingcode[bracelvl]); + outkrem("RTFcell "); + RTF_cell_removed = removed_ok; + center_flag[bracelvl] = 0; + end_env(1); + if (RTF_cell_removed) + perform_RTFcell(); + output_line(); + envir_closed_ok = true; /* output_line; */ + return; + } + if (flushright_flag[bracelvl] != 2) + return; + if (!no_space_conv) + output_size(spacingcode[bracelvl]); + outkrem("RTFcell "); + RTF_cell_removed = removed_ok; + flushright_flag[bracelvl] = 0; + end_env(2); + if (RTF_cell_removed) + perform_RTFcell(); + output_line(); + envir_closed_ok = true; /* output_line; */ + /*END IF center_flag*/ +} + + +/* --------------------------------------------------------------------------*/ +/* procedure to perform RTFsb/RTFsa */ + +Static Void make_RTFsab(numval) +short numval; +{ + Char STR1[48]; + + if (numval > 300) { + outkeyw("bigskip{}"); + return; + } + if (numval > 200) { + outkeyw("medskip{}"); + return; + } + if (numval > 100) { + outkeyw("smallskip{}"); + return; + } + if (numval > 0) { + outkeyw("vspace 0.5\\smallskipamount{}"); + return; + } + if (numval < 0) { + sign_str(numval, works); + sprintf(STR1, "neg. spacing, NUMVAL:=%s", works); + println_msg(1, STR1); + /*END IF*/ + } +} + + +/* --------------------------------------------------------------------------*/ +/* procedure to perform RTFpar (separate since it may be delayed after a } */ + +Static Void make_RTFpar(texcode) +Char *texcode; +{ + short k; + short num_forced = 0; + boolean was_underl; + Char STR1[72]; + Char STR2[36]; + Char STR3[44]; + + while (math_mode[bracelvl] > 1) { + if (lvlcode[bracelvl] == 16) + outstg("\\relax %%% ???"); + else + outstg("}\\relax %%% !!!"); + output_line(); + close_brace(); + num_forced++; + } + close_math(); + if (num_forced > 0) { /*END IF*/ + close_envir(); + output_size(spacingcode[bracelvl]); + output_line(); + output_line(); + par_to_begin = true; + num_indent = 0; + if (space_after != 0) + make_RTFsab(space_after); + space_after = 0; + sign_str(input_line_number, worksa); + sign_str(bracelvl, works); + sprintf(STR1, "input line %s, bracelvl=%s", worksa, works); + println_msg(0, STR1); + sign_str(num_forced, works); + sprintf(STR2, "num_forced=%s", works); + println_msg(0, STR2); + } + + was_underl = underl_flag[bracelvl]; + outkrem(bfslcode[bracelvl]); + if (was_underl) + outchr('}'); + output_line(); + if (!no_space_conv) + output_size(spacingcode[bracelvl]); + close_envir(); + if (!(envir_closed_ok || no_space_conv)) + outkeyw("null "); + outstg(texcode); + if (space_after != 0) + make_RTFsab(space_after); + space_after = 0; + par_to_begin = true; + num_indent = 0; + + if (was_underl) + outkeyw("underbar{"); + + for (k = 1; k <= num_forced; k++) { /*END DO*/ + outchr('{'); + bracelvl++; + math_mode[bracelvl] = 0; /*do not open ??? */ + } + + sign_str(bracelvl, works); + if (num_forced > 0) { + sprintf(STR3, "restored bracelvl=%s", works); + println_msg(0, STR3); + } +} + + +/* --------------------------------------------------------------------------*/ +/* replace recent space with a ~ (before : ; ? ! in general */ +Static Void insert_tilde(CHARAC) +Char CHARAC; +{ + if (math_mode[bracelvl] == 0) { /*END IF*/ + outrem(" "); + if (removed_ok) + outchr('~'); + } + begin_par(); + outchr(CHARAC); + keyw = 0; +} + + +/* --------------------------------------------------------------------------*/ +/* initiates "tabular" but does not reset parms to zero */ +Static Void perform_RTFtrow() +{ + if (verbose > 0) + _SETIO(printf("(init row)%s[%d,%d]\n", + inkeyw, lvlcode[bracelvl], bracelvl) >= 0, FileWriteError); + open_brace(); + lvlcode[bracelvl] = 13; + if (verbose > 1) + _SETIO(printf("%s(after)[%d,%d]\n", inkeyw, lvlcode[bracelvl], bracelvl) >= 0, + FileWriteError); + tab_nb_ands[bracelvl] = 0; +} + + +/* --------------------------------------------------------------------------*/ +Static Void perform_RTFrow() +{ + if (lvlcode[bracelvl] == 15) { + if (verbose > 0) + _SETIO(printf("\\RTFrow[%d,%d,%d]\n", + lvlcode[bracelvl], tab_nb_cellx[bracelvl], + bracelvl) >= 0, FileWriteError); + close_brace(); + outkeyw("end{tabular}\\par "); + tab_nb_cellx[bracelvl] = tab_nb_cellx[bracelvl+1]; + return; + } + if (verbose > 1) + _SETIO(printf("\\RTFrow[%d,%d]\n", lvlcode[bracelvl], bracelvl) >= 0, + FileWriteError); + output_real_line(); + outkeyw("RTFrow "); + /*END IF lvlcode*/ + +} + + +/* --------------------------------------------------------------------------*/ +Static Void make_closing_brace() +{ + Char pict_byte; + boolean already_closed = false; + Char STR1[142]; + Char STR2[148]; + Char STR3[34]; + + while (auto_close[bracelvl]) { /*END WHILE auto_close*/ + if (math_mode[bracelvl] == 1) + outchr('$'); + outchr('}'); + close_brace(); + } + /* check "*/ + /*" within \|I(...) and similar : then ignore pair */ + if (lvlcode[bracelvl] >= 16 && next_rtf[0] == '{') { + next_rtf[0] = '\0'; + return; + } + if (*form_code[bracelvl] != '\0' && next_rtf[0] == '{') { + next_rtf[0] = '\0'; + return; + } + /* special case of \|su(...) closing */ + if (lvlcode[bracelvl] == 25) + close_sum(); + else if (lvlcode[bracelvl] >= 16) + close_sum_emergency("lvlc"); + /*END IF*/ + close_math(); + + if (lvlcode[bracelvl] != 4) { + if (lvlcode[bracelvl] == 5) { + /* this is \RTFpict closing brace */ + if (pict_left_hexa) { /*END IF pict_left_hexa*/ + /* look whether there is already one hexa digit stored*/ + pict_last_hexa *= 16; + pict_byte = pict_last_hexa; + _SETIO(putc(pict_byte, figurefile) >= 0, FileWriteError); + pict_byte_number++; + pict_last_hexa = 0; + pict_left_hexa = false; + } + + if (figurefile != NULL) + fclose(figurefile); + figurefile = NULL; + sprintf(STR1, "closed file %s", figure_name); + print_msg(1, STR1); + sign_str((int)pict_byte_number, works); + sprintf(STR3, "(%s bytes)", works); + println_msg(1, STR3); + outchr(kar); + } else if (lvlcode[bracelvl] == 10) { + sprintf(STR2, "closed dummy file %s", figure_name); + /* this is \RTFobject closing brace */ + println_msg(1, STR2); + outchr(kar); + } + /* if there was a \cell just before, put it outside the closing brace */ + else if (last_is("\\RTFcell ")) { + if (verbose > 1) + _SETIO(printf("closing}[%d,%d]\n", lvlcode[bracelvl], bracelvl) >= 0, + FileWriteError); + outkrem("RTFcell "); + if (!removed_ok) + _SETIO(printf("*** \\RTFcell not removed before } ***\n") >= 0, + FileWriteError); + outchr(kar); + close_brace(); + already_closed = true; + if (verbose > 0) + _SETIO(printf("moved \\RTFcell [%d,%d]\n", + lvlcode[bracelvl], bracelvl) >= 0, FileWriteError); + perform_RTFcell(); + } + /* if there was a \row just before, put it outside the closing brace */ + else if (last_is("\\RTFrow ")) { + if (verbose > 1) + _SETIO(printf("closing}[%d,%d]\n", lvlcode[bracelvl], bracelvl) >= 0, + FileWriteError); + outkrem("RTFrow "); + outchr(kar); + close_brace(); + already_closed = true; + if (verbose > 0) + _SETIO(printf("moved \\RTFrow [%d,%d]\n", lvlcode[bracelvl], bracelvl) >= + 0, FileWriteError); + perform_RTFrow(); + } else { + /* if there was a \par just before, put it outside the closing brace */ + if (last_is("\\null \\par ")) { + outkrem("null \\par "); + outchr(kar); + if (no_space_conv) + outkeyw("par "); + else + outkeyw("null \\par "); + } else if (last_is("\\par ")) { + outkrem("par "); + outchr(kar); + outkeyw("par "); + } else + outchr(kar); + /*ENF IF*/ + + if (*form_code[bracelvl] != '\0') { /*END IF*/ + if (*form_code[bracelvl-1] == '\0') + strcpy(form_code[bracelvl-1], form_code[bracelvl]); + else { + close_sum_emergency("form"); + /* this is an ordinary closing brace */ + } + } + /*END IF*/ + } + } + /* this is footnote first and dummy RTF argument closing brace */ + + /*END IF*/ + if (!already_closed) { + close_brace(); + /*END IF*/ + } +} + + +/* --------------------------------------------------------------------------*/ +/* special output of single characters due to \TeX special codings */ + +Static Void special_TeX_chars() +{ + Char STR1[256]; + + begin_par(); + if (kar == '$') { + outstg("\\$"); + /*END IF*/ + return; + } + if (kar == '_') { + outstg("\\_"); + return; + } + if (kar == '#') { + outstg("\\#"); + return; + } + if ((kar == '>' || kar == '<') && math_mode[bracelvl] == 0) { + sprintf(STR1, "%c", kar); + out_math(STR1); + return; + } + if (kar == '&') { + outstg("\\&"); + return; + } + if (kar == '%') { + outstg("\\%"); + return; + } + if (kar == '^') { + outstg("\\^{ }"); + return; + } + if (kar == '~') + out_math("\\sim{}"); + else + outchr(kar); +} + + +/* --------------------------------------------------------------------------*/ +/* **************** Beginning of RTF decoding procedures ******************* */ +/*---------------------------------------------------------------------------*/ +/* treats a character when KEYW is 0 */ +/* no keyword decoding presently active */ + +Static Void keyw_is_0() +{ + short hexa_digit; + Char pict_byte; + string24 open_kar, RTFform, acc_converted, STR1; + Char STR2[28]; + Char STR3[26]; + Char STR4[256]; + Char STR5[32]; + Char STR6[36]; + Char STR8[12]; + + if (cat == 0) { /* this is a backslash */ + if (lvlcode[bracelvl] == 3) + return; + /* ignore after \footnote until opening brace */ + if (lvlcode[bracelvl] == 4) + return; + /* ignore after \footnote { (first brace pair after) */ + if (lvlcode[bracelvl] == 9) { + /*END IF active_RTF*/ + return; + } + + keyw = 1; + numval = 0; + numsign = 1; + strcpy(inkeyw, "\\RTF"); + return; + } + /*END IF*/ + if (cat == 1) { /* this is an opening brace */ + if (no_RTFrtf) /* ignore first opening brace before \rtf1 */ + return; + if (lvlcode[bracelvl] == 3) { + open_brace(); + return; + } + if (lvlcode[bracelvl] == 4) { + open_brace(); + return; + } + if (lvlcode[bracelvl] == 6) { + outchr(kar); + open_brace(); + return; + } + if (par_to_begin) + output_size(sizecode[bracelvl]); + make_center(); + outchr(kar); + open_brace(); + return; + } + /*END IF*/ + if (cat == 2) { /* this is a closing brace */ + close_envir(); + if (bracelvl > 0) + make_closing_brace(); + return; + } + if (cat == 3) { /* this is an opening parenthesis '(' */ + if (*form_code[bracelvl] != '\0') { + if (!strcmp(form_code[bracelvl], "\\RTFformulaB")) { + sprintf(STR2, "%sBC(", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR1, STR2)); + } + if (!strcmp(form_code[bracelvl], "\\RTFformulaBLC")) { + sprintf(STR3, "%s(", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR1, STR3)); + } + if (!strcmp(form_code[bracelvl], "\\RTFformulaBRC")) { + sprintf(STR3, "%s(", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR1, STR3)); + } + if (!strcmp(form_code[bracelvl], "\\RTFformulaBBC")) { + sprintf(STR3, "%s(", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR1, STR3)); + } + if (strpos2(form_code[bracelvl], "\\RTFformulaBBC", 1) > 0) { + strcpy(RTFform, form_code[bracelvl]); + sprintf(open_kar, "%c", RTFform[strlen(RTFform) - 1]); + if (!strcmp(open_kar, "{")) + strcpy(open_kar, "\\{"); + out_math_leave("\\left"); + outstg(open_kar); + outchr(' '); + *form_code[bracelvl] = '\0'; + open_brace(); + lvlcode[bracelvl] = 16; /* special code to close with ) */ + if (!strcmp(open_kar, "(")) + strcpy(close_kar[bracelvl], ")"); + else if (!strcmp(open_kar, "[")) + strcpy(close_kar[bracelvl], "]"); + else if (!strcmp(open_kar, "\\{")) + strcpy(close_kar[bracelvl], "\\}"); + else + strcpy(close_kar[bracelvl], open_kar); + /*END IF open_kar*/ + kar = ' '; /* to prevent do_it_again */ + return; + } + if (strpos2(form_code[bracelvl], "\\RTFformulaBLC", 1) > 0) { + strcpy(RTFform, form_code[bracelvl]); + sprintf(open_kar, "%c", RTFform[strlen(RTFform) - 1]); + if (!strcmp(open_kar, "{")) + strcpy(open_kar, "\\{"); + out_math_leave("\\left"); + outstg(open_kar); + outchr(' '); + *form_code[bracelvl] = '\0'; + open_brace(); + lvlcode[bracelvl] = 16; /* special code to close with ) */ + strcpy(close_kar[bracelvl], "."); + kar = ' '; /* to prevent do_it_again */ + return; + } + if (strpos2(form_code[bracelvl], "\\RTFformulaBRC", 1) > 0) { + strcpy(RTFform, form_code[bracelvl]); + sprintf(open_kar, "%c", RTFform[strlen(RTFform) - 1]); + if (!strcmp(open_kar, "{")) + strcpy(open_kar, "\\{"); + out_math_leave("\\left. "); + *form_code[bracelvl] = '\0'; + open_brace(); + lvlcode[bracelvl] = 16; /* special code to close with ) */ + if (!strcmp(open_kar, "(")) + strcpy(close_kar[bracelvl], ")"); + else if (!strcmp(open_kar, "[")) + strcpy(close_kar[bracelvl], "]"); + else if (!strcmp(open_kar, "\\{")) + strcpy(close_kar[bracelvl], "\\}"); + else + strcpy(close_kar[bracelvl], open_kar); + /*END IF open_kar*/ + kar = ' '; /* to prevent do_it_again */ + return; + } + /* case of \|F( ... ; ... ) */ + if (!strcmp("\\RTFformulaF", form_code[bracelvl])) { + *form_code[bracelvl] = '\0'; + out_math_leave("{\\displaystyle "); + open_brace(); + lvlcode[bracelvl] = 17; + kar = ' '; /* to prevent do_it_again */ + return; + } + /* case of \|D\|BA() or \|D\|FO() */ + if (!strcmp("\\RTFformulaDFO", form_code[bracelvl])) { + sign_str(displ_skip, worksa); + *form_code[bracelvl] = '\0'; + sprintf(STR5, "kern %spt", worksa); + outkeyw(STR5); + open_brace(); + lvlcode[bracelvl] = 28; + kar = ' '; /* to prevent do_it_again */ + return; + } + /* case of \|D\|LI() */ + if (!strcmp("\\RTFformulaDLI", form_code[bracelvl])) { + sign_str(displ_skip, worksa); + *form_code[bracelvl] = '\0'; + sprintf(STR6, "RTFhrule %spt", worksa); + outkeyw(STR6); + open_brace(); + lvlcode[bracelvl] = 28; + kar = ' '; /* to prevent do_it_again */ + return; + } + /* case of \|O( ... ; ... ) */ + if (!strcmp("\\RTFformulaO", form_code[bracelvl])) { + *form_code[bracelvl] = '\0'; + begin_par(); + outkeyw("hbox{\\ooalign{\\hfil{}"); + open_brace(); + lvlcode[bracelvl] = 26; + math_mode[bracelvl] = 0; + kar = ' '; /* to prevent do_it_again */ + return; + } + /* case of \|L( ... ; ... ) */ + if (!strcmp("\\RTFformulaL", form_code[bracelvl])) { + *form_code[bracelvl] = '\0'; + begin_par(); + outchr('{'); + open_brace(); + lvlcode[bracelvl] = 27; + kar = ' '; /* to prevent do_it_again */ + return; + } + /* case of \|R( ... ; ... ) */ + if (!strcmp("\\RTFformulaR", form_code[bracelvl])) { + *form_code[bracelvl] = '\0'; + out_math_leave("\\sqrt{"); + open_brace(); + lvlcode[bracelvl] = 23; + kar = ' '; /* to prevent do_it_again */ + return; + } + /* case of \|X( ... ; ... ) */ + if (strpos2(form_code[bracelvl], "\\RTFformulaX", 1) > 0) { + *form_code[bracelvl] = '\0'; + begin_par(); + sprintf(STR8, "\\boxed%s{", strsub(STR4, form_code[bracelvl], 11, 3)); + outstg(STR8); + open_brace(); + lvlcode[bracelvl] = 7; + kar = ' '; /* to prevent do_it_again */ + return; + } + /* case of \|S( ... ; ... ) */ + if (!strcmp("\\RTFformulaS", form_code[bracelvl]) || + !strcmp("\\RTFformulaSUP", form_code[bracelvl])) { + *form_code[bracelvl] = '\0'; + out_math_leave("^{"); + open_brace(); + lvlcode[bracelvl] = 18; + kar = ' '; /* to prevent do_it_again */ + return; + } + /* case of \|SDO( ... ; ... ) */ + if (!strcmp("\\RTFformulaSDO", form_code[bracelvl])) { + *form_code[bracelvl] = '\0'; + out_math_leave("_{"); + open_brace(); + lvlcode[bracelvl] = 19; + kar = ' '; /* to prevent do_it_again */ + return; + } + /* case of \|I( ... ; ... ) */ + if (!strcmp("\\RTFformulaI", form_code[bracelvl])) { + *form_code[bracelvl] = '\0'; + out_math_leave("\\int_{"); + open_brace(); + lvlcode[bracelvl] = 20; + kar = ' '; /* to prevent do_it_again */ + return; + } + /* case of \|ISU( ... ; ... ) */ + if (!strcmp("\\RTFformulaISU", form_code[bracelvl])) { + *form_code[bracelvl] = '\0'; + out_math_leave("\\displaystyle\\sum_{"); + open_brace(); + lvlcode[bracelvl] = 20; + kar = ' '; /* to prevent do_it_again */ + return; + } + /* case of \|IPR( ... ; ... ) */ + if (strcmp("\\RTFformulaIPR", form_code[bracelvl])) + return; + *form_code[bracelvl] = '\0'; + out_math_leave("\\displaystyle\\prod_{"); + open_brace(); + lvlcode[bracelvl] = 20; + kar = ' '; /* to prevent do_it_again */ + return; + } + /* if an opening parenthese is found inside a deep formula, set lvlcode at 25 */ + /*END IF*/ + if (abs(lvlcode[bracelvl]) < 17) { + begin_par(); + outchr(kar); + return; + } + outchr(kar); + open_brace(); + lvlcode[bracelvl] = 25; + return; + } + /*END IF form_code */ + if (cat == 4) { /* this is a closing parenthesis ')' */ + /* test 23 sept */ + while (lvlcode[bracelvl] < 0 && auto_close[bracelvl]) + { /*END WHILE auto_close*/ + if (math_mode[bracelvl] == 1) + outchr('$'); + outchr('}'); + close_brace(); + } + /* fin test 23 sept */ + /* special case of \|B..(...) closing */ + if (lvlcode[bracelvl] == 16) { + outstg("\\right"); + outstg(close_kar[bracelvl]); + close_sum(); + return; + } + /* special case of \|X..(...) closing */ + if (lvlcode[bracelvl] == 7) { + outchr('}'); + close_sum(); + return; + } + /* closing parenthese found inside a formula, was opened with another ( 25 */ + if (lvlcode[bracelvl] == 25) { + outchr(kar); + close_brace(); + return; + } + /* closing parenthese found inside a formula \|O */ + if (lvlcode[bracelvl] == 26) { + close_math(); + outstg("\\hfil}}"); + close_brace(); + return; + } + /* closing parenthese found inside a formula \|L */ + if (lvlcode[bracelvl] == 27) { + outchr('}'); + close_brace(); + return; + } + /* closing parenthese found inside a formula \|D */ + if (lvlcode[bracelvl] == 28) { + outstg("{}"); + close_brace(); + return; + } + /* special case of \|F(...) closing */ + /* special case of \|S(...) closing */ + /* special case of \|SDO(...) closing */ + /* special case of \|I(...) closing */ + /* special case of \|I(..;..) closing */ + /* special case of \|I(..;..;..) closing */ + /* special case of \|R(...) closing */ + if (lvlcode[bracelvl] >= 17) { + close_subs(); + close_sum(); + return; + } + /* closing parenthese found inside a deep formula, make it 1 level lower */ + if (-lvlcode[bracelvl] >= 17) + sprintf(next_rtf, "}){%s", strcpy(STR4, next_rtf)); + else { + begin_par(); + outchr(kar); + } + return; + } + /* Ignore chars to be ignored */ + /*END IF lvlcode*/ + if (lvlcode[bracelvl] == 1) + return; + + if (lvlcode[bracelvl] == 3) + return; + + if (lvlcode[bracelvl] == 4) + return; + + if (lvlcode[bracelvl] == 5) { /* we are in the hexa part of a \RTFpict */ + /* ignore possible blanks and control characters within hexadecimal field */ + if (kar <= 32) /*END IF*/ + return; + hexa_digit = hx_to_i(kar); + pict_char_number++; + if (pict_left_hexa) { + /* there is already one hexa digit stored*/ + pict_last_hexa = pict_last_hexa * 16 + hexa_digit; + pict_byte = pict_last_hexa; + _SETIO(putc(pict_byte, figurefile) >= 0, FileWriteError); + pict_byte_number++; + pict_last_hexa = 0; + pict_left_hexa = false; + return; + } + /* there is no hexa digit stored*/ + pict_last_hexa = hexa_digit; + last_kar = kar; + pict_left_hexa = true; + return; + } + /*END IF pict-left_hexa*/ + if (abs(lvlcode[bracelvl]) == 10) /* we are in \RTFobject */ + return; + + if (abs(lvlcode[bracelvl]) == 9) /* ignore other than braces */ + return; + + if (cat == 11) { /* this is a letter */ + begin_par(); + if (lvlcode[bracelvl] == 2) { /* letters to be capitalized ? */ + kar = toupper(kar); + ikar = kar; + } + /*END IF lvlcode=2*/ + if (!strcmp(active_RTFf[bracelvl], "ftech")) { + strcpy(acc_converted, ftech_transl[ikar]); + if (*acc_converted != '\0') + out_math(acc_converted); + else + outchr(kar); + return; + } + /*END IF acc_converted*/ + outrem("\\beginparagraph{}"); + if (removed_ok && kout > 0) + outstg("{}"); + outchr(kar); + return; + } + /*END IF active_RTF*/ + if (!strcmp(active_RTFf[bracelvl], "ftech")) { + begin_par(); + strcpy(acc_converted, ftech_transl[ikar]); + if (*acc_converted != '\0') + out_math(acc_converted); + else + special_TeX_chars(); + return; + } + /*END IF acc_converted*/ + if (kar == '-') { + if (last_is("\\beginparagraph{}")) { + outrem("\\beginparagraph{}"); + outkeyw("plainitem{--}"); + } else + outchr(kar); + return; + } + /*END IF*/ + if (kar == '"') { + begin_par(); /* test march 94 */ + if (math_mode[bracelvl] == 0 && (kout == 0 || last_is(" "))) + outstg("``"); + else + outstg("''"); + return; + } + /*END IF*/ + if (kar != ';') { + /*END IF*/ + special_TeX_chars(); + return; + } + /* ignore ; in colortbl section */ + if (lvlcode[bracelvl] == 9) + return; + /* special case of \|F(. ; .) intermediate semi-colon */ + if (lvlcode[bracelvl] == 17) { + /* special case of \|S(. ; .) intermediate semi-colon */ + outstg(" \\over\\displaystyle "); + return; + } + if (lvlcode[bracelvl] == 18) { + close_subs(); + out_math_leave(" _{"); + return; + } + /* special case of \|SDO(. ; .) intermediate semi-colon */ + if (lvlcode[bracelvl] == 19) { + close_subs(); + out_math_leave(" ^{"); + return; + } + /* special case of \|I(. ; .) intermediate semi-colon */ + if (lvlcode[bracelvl] == 20) { + close_subs(); + outstg(" ^{"); + lvlcode[bracelvl] = 21; + return; + } + /* special case of \|su(. ; .) second intermediate semi-colon */ + if (lvlcode[bracelvl] == 21) { + close_subs(); + outchr('{'); + lvlcode[bracelvl] = 22; + return; + } + /* special case of \|R(. ; .) intermediate semi-colon */ + if (lvlcode[bracelvl] == 23) { + outsubstitute("\\sqrt{", "\\root{"); + outstg("}\\of{"); + lvlcode[bracelvl] = 24; + output_line(); /* safety */ + return; + } + /* special case of \|O(. ; .) intermediate semi-colon */ + if (lvlcode[bracelvl] == 26) { + /* special case of \|L(. ; .) intermediate semi-colon */ + outstg("\\hfil\\crcr\\hfil{}"); + return; + } + if (lvlcode[bracelvl] == 27) + outchr(','); + else + outchr(kar); +} + + +/*---------------------------------------------------------------------------*/ +/* treats a character when KEYW is 1 */ +/* Keyword being decoded, we are just after the BACKSLASH */ + +Static Void keyw_is_1() +{ + Char STR1[256]; + + if (cat == 11) { /* letter : store and say KEYW:=2 */ + sprintf(inkeyw + strlen(inkeyw), "%c", kar); + keyw = 2; + return; + } + if (cat == 16) { /* case of a digit : store \RTF */ + outrem_empty_braces(); + outstg(inkeyw); + outchr(kar); + keyw = 0; + return; + } + /* turn \{ into \RTFaccol and... try to continue ! */ + if (kar == '{') { + out_math("\\{"); + keyw = 0; + /* inkeyw:=inkeyw+'accol '; keyw:=2 ; */ + return; + } + /* turn \} into \RTFlocca and... try to continue ! */ + if (kar == '}') { + out_math("\\}"); + keyw = 0; + /* inkeyw:=inkeyw+'locca '; keyw:=2 ; */ + return; + } + if (kar == '(') { + begin_par(); + outkeyw("RTFparen "); + keyw = 0; + return; + } + if (kar == '-') { + /* case of a word cutting hyphen \- */ + begin_par(); + sprintf(STR1, "%c", kar); + outkeyw(STR1); + keyw = 0; + return; + } + if (kar == '*') { + if (abs(lvlcode[bracelvl]) < 10 || abs(lvlcode[bracelvl]) > 12) { + begin_par(); + outchr(kar); + } + keyw = 0; /*END IF*/ + return; + } + if (kar == '_') { + /* case of a word non cutting hyphen \_ */ + begin_par(); + outchr('-'); + keyw = 0; + return; + } + if (kar == '~') { + /* case of a non breaking space */ + begin_par(); + outchr(kar); + keyw = 0; + return; + } + if (kar == '\'') { + keyw = 4; + num_hexa = 0; + return; + } + if (kar == ':') { + insert_tilde(kar); + return; + } + if (kar == ';') { + insert_tilde(kar); + return; + } + if (kar == ')') { + begin_par(); + outchr(kar); + return; + } + if (kar == '(') { + begin_par(); + outchr(kar); + return; + } + if (kar == '\\') { + if (next_rtf[0] == 'f' && lvlcode[bracelvl] == 12) { + lvlcode[bracelvl] = 9; + /*END IF*/ + return; + } + begin_par(); + outstg("{\\char92}"); + keyw = 0; + return; + } + if (kar == '|') { + if (next_rtf[0] != '}') { + /* case of \| (in formulae) store as "formula" and expect letters */ + strcat(inkeyw, "formula"); + keyw = 2; + return; + } + /* if \|} cancel \| and post it for later */ + *inkeyw = '\0'; + keyw = 0; + strdelete((Anyptr)next_rtf, 1, 1); + sprintf(next_rtf, "}\\|%s", strcpy(STR1, next_rtf)); + return; + } + /* store \RTF and try again */ + outkeyw("RTF{}"); + keyw = 0; + do_it_again = true; +} + + +/*---------------------------------------------------------------------------*/ +/* treats a character when KEYW is 2 */ +/* We are in a letter keyword */ + +Static Void keyw_is_2() +{ + short poskeyw, k, posbsl, testio; + string24 inkeywb; + Char STR1[256], STR2[256]; + Char STR3[232]; + Char STR4[150]; + string24 STR5; + Char STR6[188]; + Char STR7[28]; + Char STR8[26]; + short FORLIM; + + if (cat == 11) { + /* letter : store and capitalize for formulas */ + if (strpos2(inkeyw, "\\RTFformula", 1) > 0) + sprintf(inkeyw + strlen(inkeyw), "%c", toupper(kar)); + else + sprintf(inkeyw + strlen(inkeyw), "%c", kar); + return; + } + /*END IF*/ + if (cat == 16) { + /* case of a digit : store with opening brace and say KEYW:=3 */ + sprintf(inkeyw + strlen(inkeyw), "{%c", kar); + numval = kar - icharz; + numsign = 1; + keyw = 3; + return; + } + if (kar == '-') { + /* case of a - introduction : store opening brace and say KEYW:=3 */ + strcat(inkeyw, "{-"); + numval = 0; + numsign = -1; + keyw = 3; + return; + } + /* delay \begin(center) to further opening \par */ + if (!strcmp(inkeyw, "\\RTFqc")) { + if (lvlcode[bracelvl] != 9) + center_flag[bracelvl] = 1; + } + /* delay \begin(flushright) to further opening \par */ + else if (!strcmp(inkeyw, "\\RTFqr")) { + if (lvlcode[bracelvl] != 9) + flushright_flag[bracelvl] = 1; + } + /* interpret some other keywords */ + else if (!strcmp(inkeyw, "\\RTFtab")) { + if (par_to_begin) + num_indent++; + else + outkeyw("indent "); + } else if (!strcmp(inkeyw, "\\RTFchpgn")) { + begin_par(); + outkeyw("the\\count0{}"); + } else if (!strcmp(inkeyw, "\\RTFb")) { + add_to_bfsl("\\bf"); + ensure_sizebfsl(); + } else if (!strcmp(inkeyw, "\\RTFscaps")) { + add_to_bfsl("\\sc"); + ensure_sizebfsl(); + } else if (!strcmp(inkeyw, "\\RTFoutl")) { + add_to_bfsl("\\oul"); + ensure_sizebfsl(); + } else if (!strcmp(inkeyw, "\\RTFul")) { + outrem("{"); + if (removed_ok) { + if (math_mode[bracelvl] == 0) { + begin_par(); + outkeyw("underbar{"); + } else { + begin_par(); + outkeyw("underline{"); + } + } else + outkeyw("RTFul{}"); + /*END IF removed_OK*/ + underl_flag[bracelvl] = true; + } else if (!strcmp(inkeyw, "\\RTFuldb")) { + outrem("{"); + if (removed_ok) { + if (math_mode[bracelvl] == 0) { + begin_par(); + outkeyw("underbar{\\bf{}"); + } else { + begin_par(); + outkeyw("underline{"); + } + } else + outkeyw("RTFuldb{}"); + /*END IF removed_OK*/ + underl_flag[bracelvl] = true; + } else if (!strcmp(inkeyw, "\\RTFv")) { + outrem("{"); + if (removed_ok) { + begin_par(); + outkeyw("index{"); + } else + outkeyw("RTFul{}"); + /*END IF removed_OK*/ + underl_flag[bracelvl] = true; + } else if (strpos2(inkeyw, "\\RTFheader", 1) + strpos2(inkeyw, + "\\RTFfooter", 1) > 0) { + outrem("{"); + if (removed_ok) { + sprintf(STR1, "%s{", inkeyw + 1); + outkeyw(STR1); + } else { + sprintf(STR2, "%s{\\relax}", inkeyw + 1); + outkeyw(STR2); + } + /*END IF removed_OK*/ + lvlcode[bracelvl] = 9; + } else if (!strcmp(inkeyw, "\\RTFi")) { + if (use_sl) + add_to_bfsl("\\sl"); + else + add_to_bfsl("\\it"); + /*END IF*/ + ensure_sizebfsl(); + } else if (!strcmp(inkeyw, "\\RTFpard")) + { /* old center_flag[bracelvl]:=0; flushright_flag[bracelvl]:=0; */ + close_math(); + close_envir(); + center_flag[bracelvl] = 0; + flushright_flag[bracelvl] = 0; + strcpy(bfslcode[bracelvl], "\\rm"); + + if (abs(lvlcode[bracelvl]) != 8 && abs(lvlcode[bracelvl]) != 9 && + lvlcode[bracelvl] != 13 && lvlcode[bracelvl] != 15) + { /*END IF*/ + leftskip = 0; + rightskip = 0; + num_indent = 0; + par_to_begin = true; + if (!last_is("\\end{tabular}\\par ")) { + if (kout > 0) + output_line(); + outstg(" %\\check "); + output_line(); /* for testing */ + } + } + /* never cut line+\check after \end{tabular} */ + if (lvlcode[bracelvl] == 2) + lvlcode[bracelvl] = 0; + } else if (!strcmp(inkeyw, "\\RTFpar")) { + if (next_rtf[0] == '}') { + *inkeyw = '\0'; + strdelete((Anyptr)next_rtf, 1, 1); + sprintf(next_rtf, "}\\par %s", strcpy(STR2, next_rtf)); + } else + make_RTFpar("\\par "); + } else if (!strcmp(inkeyw, "\\RTFpagebb")) { + /*END IF next_rtf[1]*/ + if (next_rtf[0] == '}') { + *inkeyw = '\0'; + strdelete((Anyptr)next_rtf, 1, 1); + sprintf(next_rtf, "}\\pagebb %s", strcpy(STR2, next_rtf)); + } else + make_RTFpar("\\clearpage "); + } else if (!strcmp(inkeyw, "\\RTFpage")) { + /*END IF next_rtf[1]*/ + if (next_rtf[0] == '}') { + *inkeyw = '\0'; + strdelete((Anyptr)next_rtf, 1, 1); + sprintf(next_rtf, "}\\page %s", strcpy(STR2, next_rtf)); + } else { + output_size(spacingcode[bracelvl]); + outkeyw("break\\eject\\noindent "); + output_size(sizecode[bracelvl]); + output_bfsl(); + } + } else if (!strcmp(inkeyw, "\\RTFsect")) { + /*END IF next_rtf[1]*/ + if (next_rtf[0] == '}') { + *inkeyw = '\0'; + strdelete((Anyptr)next_rtf, 1, 1); + sprintf(next_rtf, "}\\par %s", strcpy(STR2, next_rtf)); + } else + make_RTFpar("\\par \\relax "); + } else if (!strcmp(inkeyw, "\\RTFrquote")) { + /*END IF next_rtf[1]*/ + outchr('\''); + } else if (!strcmp(inkeyw, "\\RTFlquote")) + outchr('`'); + else if (!strcmp(inkeyw, "\\RTFmac")) + mac_init(); + else if (!strcmp(inkeyw, "\\RTFansi")) + ansi_init(); + else if (!strcmp(inkeyw, "\\RTFline")) { + /* flag to say future capitalized */ + outkeyw("break "); + } else if (!strcmp(inkeyw, "\\RTFcaps")) { + lvlcode[bracelvl] = 2; + /* flag to say we are in \fonttbl block */ + } else if (!strcmp(inkeyw, "\\RTFfonttbl")) { + lvlcode[bracelvl] = 6; + outrem_empty_braces(); + outkrem(sizecode[bracelvl]); + outrem("{"); + if (removed_ok) + outkeyw("RTFfonttbl{"); + else + outkeyw("RTFfonttbl{}{}{}\\relax "); + } else if (!strcmp(inkeyw, "\\RTFcolortbl")) { + /*END IF*/ + outrem_empty_braces(); + lvlcode[bracelvl] = 9; + outkrem(sizecode[bracelvl]); + outrem("{"); + if (removed_ok) + outkeyw("RTFcolortbl{"); + else + outkeyw("RTFcolortbl{}{}{}\\relax "); + } else if (!strcmp(inkeyw, "\\RTFinfo")) { + /*END IF*/ + outrem_empty_braces(); + outkrem(sizecode[bracelvl]); + outrem("{"); + if (removed_ok) + outkeyw("RTFinfo{"); + else + outkeyw("RTFinfo{}{}{}\\relax "); + } else if (!strcmp(inkeyw, "\\RTFstylesheet")) { + /*END IF*/ + outrem_empty_braces(); + outkrem(sizecode[bracelvl]); + outrem("{"); + if (removed_ok) { + outkrem("RTFcolortbl{}"); + outkeyw("RTFstylesheet{"); + } else + outkeyw("RTFstylesheet{}{}{}\\relax "); + /*END IF*/ + lvlcode[bracelvl] = 8; + } else if (!strcmp(inkeyw, "\\RTFfield")) + lvlcode[bracelvl] = 11; + else if (strcmp(inkeyw, "\\RTFflddirty")) { + + if (strpos2(inkeyw, "\\RTFfldinst", 1) > 0 && lvlcode[bracelvl-1] == 11) { + lvlcode[bracelvl] = 12; + return; /* to avoid resetting keyw:=0 */ + } + if (!strcmp(inkeyw, "\\RTFtrowd")) { + perform_RTFtrow(); + outkeyw("begin{tabular}{"); + clbrdrr = false; + clbrdrl = false; + clbrdrt = false; + clbrdrb = false; + tab_nb_cellx[bracelvl] = 0; + tab_cellx[bracelvl] = 0; + } else if (strcmp(inkeyw, "\\RTFbrdrs") || lvlcode[bracelvl] != 13) { + /* ignore */ + if (!strcmp(inkeyw, "\\RTFclbrdrl") && lvlcode[bracelvl] == 13) { + outchr('|'); + if (verbose > 1) + _SETIO(printf("%s[%d,%d]\n", inkeyw, lvlcode[bracelvl], bracelvl) >= + 0, FileWriteError); + clbrdrl = false; + } else if (!strcmp(inkeyw, "\\RTFclbrdrr") && lvlcode[bracelvl] == 13) { + if (verbose > 1) + _SETIO(printf("%s[%d,%d]\n", inkeyw, lvlcode[bracelvl], bracelvl) >= + 0, FileWriteError); + clbrdrr = true; + } else if (!strcmp(inkeyw, "\\RTFclbrdrt") && lvlcode[bracelvl] == 13) { + if (verbose > 1) + _SETIO(printf("%s[%d,%d]\n", inkeyw, lvlcode[bracelvl], bracelvl) >= + 0, FileWriteError); + clbrdrt = true; + } else if (!strcmp(inkeyw, "\\RTFclbrdrb") && lvlcode[bracelvl] == 13) { + if (verbose > 1) + _SETIO(printf("%s[%d,%d]\n", inkeyw, lvlcode[bracelvl], bracelvl) >= + 0, FileWriteError); + clbrdrb = true; + } else if (!strcmp(inkeyw, "\\RTFintbl")) { + if (verbose > 0) + _SETIO(printf("(found)%s[%d,%d]\n", + inkeyw, lvlcode[bracelvl], + bracelvl) >= 0, FileWriteError); + if (lvlcode[bracelvl] == 13) { + if (clbrdrr) + outchr('|'); + clbrdrr = false; + outchr('}'); + lvlcode[bracelvl] = 15; /* second part of \RTFtrowd */ + if (clbrdrt) { + outkeyw("hline"); + output_line(); + } + tab_nb_ands[bracelvl] = 0; + if (verbose > 1) + _SETIO(printf("(after)%s[%d,%d]\n", + inkeyw, lvlcode[bracelvl], + bracelvl) >= 0, FileWriteError); + } else if (lvlcode[bracelvl] == 15) { + if (verbose > 1) + _SETIO(printf("(ignored)%s[%d,%d]\n", + inkeyw, lvlcode[bracelvl], + bracelvl) >= 0, FileWriteError); + } else { + if (verbose > 0) + _SETIO(printf("forcing\\RTFtrowd%s[%d,%d]\n", + inkeyw, lvlcode[bracelvl], + bracelvl) >= 0, FileWriteError); + if (last_is("\\\\\\end{tabular}\\par ")) + outkrem("end{tabular}\\par "); + else if (last_is("\\\\\\hline \\end{tabular}\\par ")) + outkrem("end{tabular}\\par "); + else if (last_is("\\end{tabular}\\par ")) { + outkrem("end{tabular}\\par "); + outstg("\\\\"); + if (clbrdrb) + outkeyw("hline "); + } else + outkeyw("begin{tabular}{ppppppppppppppp}"); + /*END IF last_is(...)*/ + perform_RTFtrow(); + lvlcode[bracelvl] = 15; /* second part of \RTFtrowd */ + if (verbose > 1) { + _SETIO(printf("(<after)%s[%d,%d,%d]\n", + inkeyw, lvlcode[bracelvl], tab_nb_cellx[bracelvl], + bracelvl) >= 0, FileWriteError); + /* force \RTFtrowd if missing */ + /*END IF verbose*/ + } + } + } else if (!strcmp(inkeyw, "\\RTFrow")) + perform_RTFrow(); + else if (!strcmp(inkeyw, "\\RTFcell")) + perform_RTFcell(); + else if (!strcmp(inkeyw, "\\RTFobject")) { + rtfpicw = 0; + rtfpich = 0; /* reset picture width and height to 0 */ + pict_char_number = 0; + pict_byte_number = 0; + pict_last_hexa = 0; /* reset last hexa byte of the picture */ + pict_left_hexa = false; + pict_number++; /* count picture number */ + sign_str(pict_number, pict_name); + sprintf(figure_name, "%s%s%s", figure_path, pict_name, figure_type); + while (strpos2(figure_name, "\\", 1) > 0) { /*END DO*/ + posbsl = strpos2(figure_name, "\\", 1); + figure_name[posbsl-1] = '/'; + } + begin_par(); + sprintf(STR3, "%s{%s}", strsub(STR1, inkeyw, 2, 99), figure_name); + outkeyw(STR3); + sprintf(figure_name, "%s%s%s", figure_path, pict_name, figure_type); + output_line(); + sprintf(STR4, "Skipped object file %s", figure_name); + println_msg(1, STR4); + lvlcode[bracelvl] = 10; + } else if (!strcmp(inkeyw, "\\RTFpict")) { + rtfpicw = 0; + rtfpich = 0; /* reset picture width and height to 0 */ + pict_char_number = 0; + pict_byte_number = 0; + pict_last_hexa = 0; /* reset last hexa byte of the picture */ + pict_left_hexa = false; + pict_number++; /* count picture number */ + sign_str(pict_number, pict_name); + sprintf(figure_name, "%s%s%s", figure_path, pict_name, figure_type); + while (strpos2(figure_name, "\\", 1) > 0) { /*END DO*/ + posbsl = strpos2(figure_name, "\\", 1); + figure_name[posbsl-1] = '/'; + } + begin_par(); + sprintf(STR3, "%s{%s}", strsub(STR1, inkeyw, 2, 99), figure_name); + outkeyw(STR3); + sprintf(figure_name, "%s%s%s", figure_path, pict_name, figure_type); + output_line(); + strcpy(figurefile_NAME, figure_name); + if (figurefile != NULL) + figurefile = freopen(figurefile_NAME, "w", figurefile); + else + figurefile = fopen(figurefile_NAME, "w"); + _SETIO(figurefile != NULL, FileNotFound); + testio = P_ioresult; + if (testio != 0) { /*ENF IF testio*/ + sign_str(testio, works); + sprintf(STR6, "Unable to open figure file %s ; code=%s", + figure_name, works); + println_msg(0, STR6); + close_files(); + _Escape(0); + } + sprintf(STR4, "Opened picture file %s", figure_name); + println_msg(1, STR4); + lvlcode[bracelvl] = 5; + } else if (!strcmp(inkeyw, "\\RTFfootnote")) { + if (math_mode[bracelvl] == 0) { + lvlcode[bracelvl] = 3; + outrem("{"); + if (removed_ok) + outkeyw("footnote{"); + else + outkeyw("footnote "); + } else if (math_mode[bracelvl] == 1) { + /*END IF removed*/ + close_math(); + sprintf(next_rtf, "\\footnote %s", strcpy(STR1, next_rtf)); + } else if (math_mode[bracelvl-1] == 1) + sprintf(next_rtf, "}{\\footnote %s", strcpy(STR1, next_rtf)); + else if (bracelvl >= 2 && math_mode[bracelvl-2] == 1) + sprintf(next_rtf, "}}{{\\footnote %s", strcpy(STR1, next_rtf)); + else if (bracelvl >= 3 && math_mode[bracelvl-3] == 1) + sprintf(next_rtf, "}}}{{{\\footnote %s", strcpy(STR1, next_rtf)); + else + outkeyw("footnote "); + } else if (!strcmp(inkeyw, "\\RTFplain")) { + /*END IF math_mode*/ + outpsize(stdsize * 20); + strcpy(bfslcode[bracelvl], "\\rm"); + strcpy(sizecode[bracelvl], "normalsize"); + } else if (!strcmp(inkeyw, "\\RTFchftn")) + remove_mathat(); + else if (!strcmp(inkeyw, "\\RTFendash")) { + if (math_mode[bracelvl] > 0) + outchr('-'); + else + outstg("--"); + } else if (!strcmp(inkeyw, "\\RTFemdash")) { + if (math_mode[bracelvl] > 0) + outchr('-'); + else + outstg("---"); + } else if (!strcmp(inkeyw, "\\RTFfnil")) + /* decl_font_num is a global variable */ + store_word_font("fnil"); + else if (!strcmp(inkeyw, "\\RTFfroman")) + store_word_font("froman"); + else if (!strcmp(inkeyw, "\\RTFfmodern")) + store_word_font("fmodern"); + else if (!strcmp(inkeyw, "\\RTFfdecor")) + store_word_font("fdecor"); + else if (!strcmp(inkeyw, "\\RTFfswiss")) + store_word_font("fswiss"); + else if (!strcmp(inkeyw, "\\RTFfscript")) + store_word_font("fscript"); + else if (!strcmp(inkeyw, "\\RTFftech")) + store_word_font("ftech"); + else if (!strcmp(inkeyw, "\\RTFformulaB")) + truncate24(form_code[bracelvl], inkeyw); + else if (!strcmp(inkeyw, "\\RTFformulaO")) + truncate24(form_code[bracelvl], inkeyw); + else if (!strcmp(inkeyw, "\\RTFformulaLC")) { + sprintf(STR7, "%sLC", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR5, STR7)); + } else if (!strcmp(inkeyw, "\\RTFformulaRC")) { + sprintf(STR7, "%sRC", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR5, STR7)); + } else if (!strcmp(inkeyw, "\\RTFformulaBC")) { + sprintf(STR7, "%sBC", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR5, STR7)); + } else if (!strcmp(inkeyw, "\\RTFformulaF")) + truncate24(form_code[bracelvl], inkeyw); + else if (!strcmp(inkeyw, "\\RTFformulaR")) + truncate24(form_code[bracelvl], inkeyw); + else if (!strcmp(inkeyw, "\\RTFformulaS")) + truncate24(form_code[bracelvl], inkeyw); + else if (!strcmp(inkeyw, "\\RTFformulaD")) + truncate24(form_code[bracelvl], inkeyw); + else if (!strcmp(inkeyw, "\\RTFformulaX")) + truncate24(form_code[bracelvl], inkeyw); + else if (!strcmp(inkeyw, "\\RTFformulaI")) + truncate24(form_code[bracelvl], inkeyw); + else if (!strcmp(inkeyw, "\\RTFformulaSU")) { + sprintf(STR7, "%sSU", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR5, STR7)); + } else if (!strcmp(inkeyw, "\\RTFformulaPR")) { + sprintf(STR7, "%sPR", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR5, STR7)); + } else if (!strcmp(inkeyw, "\\RTFformulaIN")) { + sprintf(STR7, "%sIN", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR5, STR7)); + } else if (!strcmp(inkeyw, "\\RTFformulaRI")) { + sprintf(STR7, "%sRI", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR5, STR7)); + } else if (!strcmp(inkeyw, "\\RTFformulaBO")) { + sprintf(STR7, "%sBO", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR5, STR7)); + } else if (!strcmp(inkeyw, "\\RTFformulaLE")) { + sprintf(STR7, "%sLE", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR5, STR7)); + } else if (!strcmp(inkeyw, "\\RTFformulaTO")) { + sprintf(STR7, "%sTO", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR5, STR7)); + /* case of \|<non-alpha> */ + } else if (!strcmp(inkeyw, "\\RTFformula")) { + if (cat == 0 && next_rtf[0] == '{') { + sprintf(STR8, "%s{", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR5, STR8)); + kar = ' '; + next_rtf[0] = '\0'; /* to prevent do_it_again */ + } else if (cat == 0 && next_rtf[0] == '}') { + sprintf(STR8, "%s}", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR5, STR8)); + kar = ' '; + next_rtf[0] = '\0'; /* to prevent do_it_again */ + } else { + sprintf(STR8, "%s%c", form_code[bracelvl], kar); + strcpy(form_code[bracelvl], truncate24(STR5, STR8)); + kar = ' '; /* to prevent do_it_again */ + } + } + /* case of \{ */ + else if (!strcmp(inkeyw, "\\RTFaccol ")) { + /*END IF*/ + /* case of \} */ + out_math("\\{"); + } else if (!strcmp(inkeyw, "\\RTFlocca ")) + out_math("\\}"); + else { + poskeyw = 0; + sprintf(STR1, "%s ", inkeyw); + truncate24(inkeywb, STR1); + FORLIM = num_skip_strings; + /* check whether this keyword should be skipped in output */ + for (k = 0; k <= FORLIM - 1; k++) /*END DO*/ + poskeyw += strpos2(skip_strings[k], inkeyw, 1); + /* output other keywords with an additional space */ + if (poskeyw == 0) { /*END IF poskeyw*/ + outrem_empty_braces(); + outstg(inkeyw); + /* do not put a space if following is a (, for TeX macros syntax */ + if (kar != '(') + outchr(' '); + } + } + } + } + /*END IF*/ + /* reset KEYW and try again */ + keyw = 0; + if (kar != ' ') { + do_it_again = true; + /*END IF cat=11*/ + } +} + + +/*---------------------------------------------------------------------------*/ +/* treats a character when KEYW is 3 */ +/* Numeric arg of Keyword being decoded */ + +Static Void keyw_is_3() +{ + string24 sizeheader; /* will be 'large', 'Large', 'footnotesize'... */ + short magnification; /* will be 1000, 1095, 900... */ + short diff_cellx, style_ref, poskeyw, k; + string24 acc_converted, inkeywb; + string_RTFstyle test_RTFstyle; + Char STR1[64]; + Char STR2[186]; + Char STR3[58]; + Char STR4[256]; + short FORLIM; + string24 STR5; + Char STR6[26]; + Char STR7[28]; + + if (cat == 16) { + /* case of a digit */ + sprintf(inkeyw + strlen(inkeyw), "%c", kar); + numval = numval * 10 + numsign * (kar - icharz); + return; + } + /* case of a non digit: terminate but ignore some keywords with brace pairs */ + if (strpos2(inkeyw, "RTFsl{", 1) > 0) { + outpsize(numval); + sign_str(numval, works); + sprintf(STR1, "\\RTFsl{%s} --> \\%s", works, spacingcode[bracelvl]); + println_msg(2, STR1); + } else if (strpos2(inkeyw, "RTFli{", 1) > 0 && center_flag[bracelvl] < 2) { + if (lvlcode[bracelvl] != 8) /*END IF*/ + leftskip = numval; + } else if (strpos2(inkeyw, "RTFri{", 1) > 0 && center_flag[bracelvl] < 2) { + if (lvlcode[bracelvl] != 8) /*END IF*/ + rightskip = numval; + } else if (strpos2(inkeyw, "RTFf{", 1) > 0) { + decl_font_num = numval; /* store numval for further use */ + set_active_RTFf(numval); + outstg("{}"); + } + /* use _ and ^ for sub/superscripts and put in math mode if needed */ + else if (strpos2(inkeyw, "RTFup{", 1) > 0) { + out_math_leave("\\relax^{"); + open_brace(); + auto_close[bracelvl] = true; + } else if (strpos2(inkeyw, "RTFdn{", 1) > 0) { + out_math_leave("\\relax_{"); + open_brace(); + auto_close[bracelvl] = true; + } + /* ignore \RTFfi if option '-v' */ + else if (strpos2(inkeyw, "RTFfi{", 1) > 0) { + num_indent = 1; + if (!(no_space_conv && numval > 0)) { + outkeyw("parindent="); + output_num(numval); + outkeyw("RTFtwips"); + output_line(); + } + } + /* style description */ + else if (strpos2(inkeyw, "RTFs{", 1) > 0) { + sign_str(numval, works); + if (abs(lvlcode[bracelvl]) == 8) { + if (num_styles >= maxRTFstyles) { + sprintf(STR3, "Too many styles, style %s ignored.", works); + println_msg(0, STR3); + } else if (numval > 255) { + sprintf(STR1, "Illegal style number, style %s ignored.", works); + println_msg(0, STR1); + } else { + num_styles++; + ref_styles[numval] = num_styles; + sprintf(test_RTFstyle, "%c", kar); + while (kar != ';' && kar != '}') { /*END while*/ + read_char(); + sprintf(test_RTFstyle + strlen(test_RTFstyle), "%c", kar); + } + /* clean style to the first blank after \snext */ + if (kar == ';') + kar = ' '; + k = strpos2(test_RTFstyle, "\\snext", 1); + m = strlen(test_RTFstyle); + FORLIM = strlen(test_RTFstyle); + for (l = k; l <= FORLIM; l++) { + if (test_RTFstyle[l-1] == ' ' && l < m) + m = l; + } + sign_str(num_styles, worksa); + /* start at the first space in style text */ + n = strpos2(test_RTFstyle, " ", 1) + 1; + strsub(RTFstyles[num_styles-1], test_RTFstyle, n, m - n + 1); + sprintf(STR2, "%s --> %s \"%s\"", + works, worksa, RTFstyles[num_styles-1]); + println_msg(2, STR2); + } + } else { + /*END IF*/ + style_ref = ref_styles[numval]; + if (style_ref <= 0 || style_ref > 255) { + sprintf(STR1, "Illegal style number, style %s ignored.", works); + println_msg(0, STR1); + } else { + if (kar != ' ') + sprintf(next_rtf, "%c%s", kar, strcpy(STR4, next_rtf)); + kar = ' '; + sprintf(next_rtf, "%s%s", + RTFstyles[style_ref-1], strcpy(STR4, next_rtf)); + /*END IF*/ + } + } + } + /* font size description */ + else if (strpos2(inkeyw, "RTFfs{", 1) + strpos2(inkeyw, "RTFfldinstfs{", 1) > 0 && + lvlcode[bracelvl] != 8) { + /*END IF*/ + /* before putting \LARGE, \Huge etc., remove previous \bf, \rm, etc. */ + outrem_empty_braces(); + outrem(bfslcode[bracelvl]); + + /* output \large, \normalsize, \footnotesize according to NUMVAL */ + outfsize(numval, &magnification); + + sprintf(STR6, "\\%s", sizecode[bracelvl]); + truncate24(sizeheader, STR6); + if (!strcmp(sizeheader, "\\footnotesize")) + strcpy(sizeheader, "\\footnsize"); + + /* correct font names in bfslcode[bracelvl] according to latex209 or latex2e */ + font_clean(sizeheader, magnification); + + if (!par_to_begin) { /*END IF*/ + output_size(sizecode[bracelvl]); + output_bfsl(); + if (!last_is("}")) { + if (!last_is("{")) + outstg("{}"); + } + } + } else if (strpos2(inkeyw, "RTFsb{", 1) > 0) { + /*END IF*/ + outkrem("par"); + outkrem("par "); + if (lvlcode[bracelvl] != 8 && lvlcode[bracelvl] != 9) + outkeyw("par "); + make_RTFsab(numval); + } else if (strpos2(inkeyw, "RTFsa{", 1) > 0) + save_skip = numval; + else if (strpos2(inkeyw, "RTFtrleft{", 1) <= 0) { /* en attente */ + if (strpos2(inkeyw, "\\RTFcellx{", 1) > 0 && lvlcode[bracelvl] == 13) { + /* \RTCcellx gives absolutes abscissae, but tabular's p{} needs differences */ + diff_cellx = numval - tab_cellx[bracelvl]; + outstg("p{"); + output_num(diff_cellx); + outstg("\\RTFtwips}"); + if (clbrdrl) + outchr('|'); + clbrdrl = false; + tab_nb_cellx[bracelvl]++; + tab_cellx[bracelvl] = numval; + } else if (strpos2(inkeyw, "RTFpicw{", 1) > 0) { + strcat(inkeyw, "}"); + outrem_empty_braces(); + outstg(inkeyw); + rtfpicw = numval; + } else if (strpos2(inkeyw, "RTFpich{", 1) > 0) { + strcat(inkeyw, "}"); + outrem_empty_braces(); + outstg(inkeyw); + rtfpich = numval; + } else if (strpos2(inkeyw, "RTFobjw{", 1) > 0) { + strcat(inkeyw, "}"); + outrem_empty_braces(); + outstg(inkeyw); + rtfpicw = numval; + } else if (strpos2(inkeyw, "RTFobjh{", 1) > 0) { + strcat(inkeyw, "}"); + outrem_empty_braces(); + outstg(inkeyw); + rtfpich = numval; + } + /* case of \|DO( ... ) */ + else if (strpos2(inkeyw, "\\RTFformulaDO{", 1) > 0) { + if (*form_code[bracelvl] == '\0') + strcpy(form_code[bracelvl], "\\RTFformulaSDO"); + else { + sprintf(STR7, "%sDO", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR5, STR7)); + /* case of \|UP( ... ) */ + } + } else if (strpos2(inkeyw, "\\RTFformulaUP{", 1) > 0) { + if (*form_code[bracelvl] == '\0') + strcpy(form_code[bracelvl], "\\RTFformulaSUP"); + else { + sprintf(STR7, "%sUP", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR5, STR7)); + /* case of \|FO( ... ) */ + } + } else if (strpos2(inkeyw, "\\RTFformulaFO{", 1) > 0) { + if (*form_code[bracelvl] == '\0') + strcpy(form_code[bracelvl], "\\RTFformulaDFO"); + else { + sprintf(STR7, "%sFO", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR5, STR7)); + } + displ_skip = numval; + } + /* case of \|UP( ... ) */ + else if (strpos2(inkeyw, "\\RTFformulaBA{", 1) > 0) { + if (*form_code[bracelvl] == '\0') + strcpy(form_code[bracelvl], "\\RTFformulaDFO"); + else { + sprintf(STR7, "%sFO", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR5, STR7)); + } + displ_skip = -numval; + } + /* case of \|UP( ... ) */ + else if (strpos2(inkeyw, "\\RTFformulaLI{", 1) > 0) { + if (*form_code[bracelvl] == '\0') + strcpy(form_code[bracelvl], "\\RTFformulaDLI"); + else { + sprintf(STR7, "%sLI", form_code[bracelvl]); + strcpy(form_code[bracelvl], truncate24(STR5, STR7)); + } + displ_skip = numval; + } + /* case of \|AI( ... ) */ + else if (strpos2(inkeyw, "\\RTFformulaAI{", 1) <= 0) { + /* case of \|DI( ... ) */ + if (strpos2(inkeyw, "\\RTFformulaDI{", 1) <= 0) { + if (strpos2(inkeyw, "RTFrtf{", 1) > 0) { + no_RTFrtf = false; + strcat(inkeyw, "}"); + outrem_empty_braces(); + outstg(inkeyw); + } + /* explicit references to symbol characters */ + else if (strpos2(inkeyw, "RTFfldinstsymbol", 1) + strpos2(inkeyw, + "RTFfldinstbsymbol", + 1) + strpos2(inkeyw, "RTFfldinstbisymbol", 1) > 0) { + if (numval > 255) + numval = 0; + strcpy(acc_converted, ftech_transl[numval]); + if (*acc_converted != '\0') + out_math(acc_converted); + else + outchr('?'); + } else { + /*END IF acc_converted*/ + poskeyw = 0; + k = strpos2(inkeyw, "{", 1); + if (k > 0) { + sprintf(inkeywb, "%.*s", k, inkeyw); +/* p2c: rtflatex.pas, line 1513: + * Note: Possible faulty string assignment [145] */ +/* p2c: rtflatex.pas, line 1513: + * Note: string[24] := string[255] => unpredictable crashes */ + } else { + sprintf(STR4, "%s}", inkeyw); + truncate24(inkeywb, STR4); + } + FORLIM = num_skip_strings; + /* check whether this keyword should be skipped in output */ + for (k = 0; k <= FORLIM - 1; k++) /*END DO*/ + poskeyw += strpos2(skip_strings[k], inkeywb, 1); + if (poskeyw == 0) { /*END IF poskeyw*/ + strcat(inkeyw, "}"); + outrem_empty_braces(); + outstg(inkeyw); + } + } + } + /* this test is eliminate first brace opened */ + } + } + /*END IF*/ + keyw = 0; + if (kar != ' ') { + do_it_again = true; + /*END IF*/ + } +} + + +/*---------------------------------------------------------------------------*/ +/* treats a character when KEYW is 4 */ +/* Hexadecimal arg of RTFac */ + +Static Void keyw_is_4() +{ + string2 acchexa; + string24 acc_converted; + short posbrace; + Char STR1[256]; + Char STR2[12]; + Char STR3[40]; + + if (cat == 10) + return; + + if (num_hexa == 0) { + num_hexa = 1; + hexaone = kar; + return; + } + if (num_hexa != 1) { + sign_str(num_hexa, works); + sprintf(STR3, "Wrong num_hexa:%s", works); + println_msg(0, STR3); + /*END IF*/ + + return; + } + hexatwo = kar; + sprintf(acchexa, "%c%c", hexaone, hexatwo); +/* p2c: rtflatex.pas, line 1546: + * Note: Possible faulty string assignment [145] */ +/* p2c: rtflatex.pas, line 1546: + * Note: string[2] := string[3] => unpredictable crashes */ + begin_par(); + if (!strcmp(active_RTFf[bracelvl], "ftech")) { + strcpy(acc_converted, ftech_transl[hs_to_i(acchexa)]); + if (*acc_converted != '\0') + out_math(acc_converted); + else { + sprintf(STR2, "RTFac{%s}", acchexa); + outkeyw(STR2); + } + } else { + /*END IF acc_converted*/ + strcpy(acc_converted, acc_transl[hs_to_i(acchexa)]); + if (*acc_converted != '\0') { + if (acc_converted[0] == '\\') + outrem_empty_braces(); + posbrace = strpos2(acc_converted, "{", 1); + if (acc_converted[0] == '$') { + outrem_empty_braces(); + out_math(strcpy(STR1, acc_converted + 1)); + } else if (posbrace <= 1) + outstgc(acc_converted); + else if (strpos2(acc_converted, "\\c{", 1) + strpos2(acc_converted, + "\\dag{", + 1) + strpos2(acc_converted, "\\pound{", 1) + strpos2( + acc_converted, "\\copyright{", + 1) + strpos2(acc_converted, "\\degree{", 1) > 0) { + sprintf(STR1, "%.*s", posbrace - 1, acc_converted); + outstg(STR1); + outstgc(strcpy(STR1, acc_converted + posbrace - 1)); + } else + outstgc(acc_converted); + } else { + /*END IF*/ + outkeyw("RTFac{"); + outstg(acchexa); + outchr('}'); + /*END IF acc_converted*/ + } + } + /*END IF active_RTF*/ + num_hexa = 0; + keyw = 0; +} + + +/*---------------------------------------------------------------------------*/ +Static Void make_latex_header() +{ + short i; + string24 strpts; + Char STR1[28]; + Char STR2[26]; + short FORLIM; + Char STR3[30]; + + if (latex209) + outkeyw("documentstyle["); + else + outkeyw("documentclass["); + /*END IF*/ + if (stdsize != 10) { /*END IF*/ + sign_str(stdsize, strpts); + sprintf(STR1, "%spt,", strpts); + outstg(STR1); + } + outstg("twoside"); + + if (latex209) { + FORLIM = num_latex_options; + for (i = 0; i <= FORLIM; i++) { + sprintf(STR2, ",%s", latex_options[i]); + outstg(STR2); + } + sprintf(STR3, "]{%s}", latex_style); + outstg(STR3); + output_line(); + } else { + sprintf(STR3, "]{%s}", latex_style); + outstg(STR3); + output_line(); + outkeyw("usepackage{"); + outstg(latex_options[0]); + FORLIM = num_latex_options; + for (i = 1; i <= FORLIM; i++) { + sprintf(STR2, ",%s", latex_options[i]); + outstg(STR2); + } + outstg("}"); + output_line(); + } + + + + outkeyw("begin{document}\\RTFsetfontheading"); + output_line(); +} + + +/*---------------------------------------------------------------------------*/ +/* MAIN */ +/*---------------------------------------------------------------------------*/ +main(argc, argv) +int argc; +Char *argv[]; +{ + short FORLIM; + Char STR1[48]; + Char STR2[56]; + Char STR3[50]; + Char STR4[30]; + Char STR5[64]; + + PASCAL_MAIN(argc, argv); + skipfile = NULL; + logfile = NULL; + figurefile = NULL; + outputfile = NULL; + inputfile = NULL; + clean_all(); /* for safety... */ + + latex209 = false; + write_log = false; + use_sl = false; + latex_header = true; + simplify_ok = true; + no_RTFrtf = true; + base_flag = false; + no_space_conv = false; + last_percent = false; + num_latex_options = 0; + strcpy(latex_style, "report"); + strcpy(latex_options[0], "rtflatex"); + kar = '\0'; + save_skip = 0; + space_after = 0; + math_mode[0] = 0; + auto_close[0] = false; + bracelvl = 0; + input_line_number = 1; + /* envir_closed_ok:=FALSE; (test) */ + envir_closed_ok = true; + num_styles = 0; + displ_skip = 0; + for (k = 0; k <= 255; k++) + ref_styles[k] = 0; + + verbose = 1; /* default moderate verbosity */ + tex_verbose = 0; /* no insertion of flags within TeX output */ + + title(); + charinit(); + sizeinit(); + open_files(); + + /* "lvlcode" : say what to do of the contents of that block. 1=ignore +until end of current block, 2=caps, 3=ignore footnote headings, 4= +ignore contents of first arg of \footnote, 5= \RTFpict text, 6= \fonttbl +declaration, 7= \RTFformulaX[xx], 8= within \stylesheet, 9= within +\header/\footer, 9= within \RTFcolortbl, 10= \RTFobject text, 11= +\RTFfield text, 12= inside \RTFfldinst, 13= inside \RTFtrowd/\RTFrow, +15= inside \RTFtrowd/RTFrow after \RTFintbl, 16= +within \RTFformulaB(...), 17= within \RTFformulaF(...), 18= +\RTFformulaSUP(...), 19= \RTFformulaSDO(...), 20= \RTFformulaI, 21= idem +after ";", 22= idem after second ";", 23= \RTFformulaR, 24= \RTFformulaR +after ";", 25= ordinary brace within a formula, 26=\RTFformulaO, +27=\RTFformulaL, 28=\RTFformulaD */ + lvlcode[0] = 0; + + /* bfslcode stores the recorded \bf, \sl, \it, \sf commands + to repeat them AFTER \large, \Large */ + *bfslcode[0] = '\0'; + strcpy(sizecode[0], "normalsize"); + *active_RTFf[0] = '\0'; + strcpy(close_kar[0], " "); + *form_code[0] = '\0'; + strcpy(spacingcode[0], "relax"); + *currsize[0] = '\0'; + *currbfsl[0] = '\0'; + leftskip = 0; + rightskip = 0; + leftcurskip = 0; + rightcurskip = 0; + tab_nb_cellx[0] = 0; + /* the number of cells in a tabular line = #\RTFcellx */ + tab_nb_ands[0] = 0; /* the number of &, must be < #\RTFcellx */ + tab_cellx[0] = 0; /* current \RTFcellx value */ + clbrdrr = false; + clbrdrl = false; + clbrdrt = false; + clbrdrb = false; + + *inkeyw = '\0'; + numl = 0; + numval = 0; + numsign = 1; + num_hexa = 0; + ikar = 0; + kinp = 0; + prev_kinp = 0; + *next_rtf = '\0'; + num_indent = 0; + num_word_fonts = 0; /* number of RTF/Word defined fonts */ + numfonts = 0; /* number of specially defined fonts */ + keyw = 0; /* a flag to say whether we are decoding a keyword */ + pict_number = 0; /* counts the pictures */ + + center_flag[0] = 0; + flushright_flag[0] = 0; + do_it_again = false; + underl_flag[0] = false; + par_to_begin = true; + + cleanout(); /* clean EXFILE for safety */ + + if (latex_header) + make_latex_header(); + + /* main loop to read input RTF file */ + + read_next_char(); + while (ikar != 26) { + /* read one character unless said to be retried */ + if (do_it_again) + do_it_again = false; + else + read_char(); + /*END IF*/ + if (ikar < ' ') /*END IF ikar*/ + continue; + + switch (keyw) { + + case 0: + keyw_is_0(); + break; + + case 1: + keyw_is_1(); + break; + + case 2: + keyw_is_2(); + break; + + case 3: + keyw_is_3(); + break; + + case 4: + keyw_is_4(); + break; + }/* case KEYW */ + } + if (center_flag[bracelvl] > 0) + outkeyw("end{center}"); + if (latex_header) + outkeyw("end{document}"); + else + outkeyw("bye"); + /*END IF latex_header*/ + output_line(); + + println_msg(0, "RTFLaTeX terminated"); + sign_str(bracelvl, works); + sprintf(STR1, "brace level finally is:%s", works); + println_msg(0, STR1); + sign_str(numl, works); + if (numl > 0) { + sprintf(STR2, "%s lines of code were generated.", works); + println_msg(0, STR2); + } + sign_str(numfonts, works); + if (numfonts > 0) { + sprintf(STR3, "%s new fonts were declared:", works); + println_msg(0, STR3); + } + FORLIM = numfonts; + for (k = 1; k <= FORLIM; k++) { + sprintf(STR4, " %s", newfonts[k-1]); + println_msg(0, STR4); + } + sign_str(pict_number, works); + if (pict_number > 0) { + sprintf(STR5, "%s pictures were stored in binary files.", works); + println_msg(0, STR5); + } + close_files(); + if (inputfile != NULL) + fclose(inputfile); + if (outputfile != NULL) + fclose(outputfile); + if (figurefile != NULL) + fclose(figurefile); + if (logfile != NULL) + fclose(logfile); + if (skipfile != NULL) + fclose(skipfile); + exit(EXIT_SUCCESS); +} + + + + + +/* End. */ +/* end of file */ diff --git a/support/rtflatex/rtflatex.cmn b/support/rtflatex/rtflatex.cmn new file mode 100644 index 0000000000..045420a5e6 --- /dev/null +++ b/support/rtflatex/rtflatex.cmn @@ -0,0 +1,1652 @@ + (* version 2.15 *) + +{---------------------------------------------------------------------------} +{ finds the '.' initiating the postfix of the given file name } + +function pos_postfix(xx : string) : integer; +var + i : integer; +begin + pos_postfix:=0; + for i:=1 to length(xx) do + begin + if (xx[i]='.') then pos_postfix:=i + else if (xx[i]=']') then pos_postfix:=0 + else if (xx[i]='/') then pos_postfix:=0 + else if (xx[i]='\') then pos_postfix:=0 + else if (xx[i]=':') then pos_postfix:=0 + ; {END IF} + end + ; {END DO} +end; + +{---------------------------------------------------------------------------} +{ the signed variant of str(n,stg) } + +procedure sign_str(num : integer; var out_sign_str : string24); +var + sign_work : string255; +begin + str(num, sign_work); +(* if (num<0) then out_sign_str:='-'+sign_work *) + if (num<0) then out_sign_str:=truncate24('-'+sign_work) + else out_sign_str:=truncate24(sign_work) + ; {END IF} +end; + +{---------------------------------------------------------------------------} +{ prints/displays a message } + +procedure print_msg (verbose_level : integer; msg : string); +begin + if (verbose >= verbose_level) then write(msg); + if write_log then write(logfile, msg); +end; + +{---------------------------------------------------------------------------} +{ prints/displays a message with RETURN } + +procedure println_msg (verbose_level : integer; msg : string); +begin + if (verbose >= verbose_level) then writeln(msg); + if write_log then writeln(logfile, msg); +end; + +{ ======================================================================= } +{ used at initialization to store one size name (Latex) and its magnitudes } + +procedure sizeone(i : integer; s : string; j,k,l : integer; +mag10, mag11, mag12 : integer); +begin + sizekey[i]:=truncate24(s); + sizeval[1,i]:=j; sizemags[1,i]:=mag10; + sizeval[2,i]:=k; sizemags[2,i]:=mag11; + sizeval[3,i]:=l; sizemags[3,i]:=mag12; +end; + +{ ======================================================================= } +{ initialization of LaTeX font heights <==> size keywords } + +procedure sizeinit; +var + k : integer; +begin + sizeone(1, 'HUGE', 720, 720, 840, 2986, 2986, 3583); + sizeone(2, 'Huge', 600, 600, 720, 2488, 2488, 2986); + sizeone(3, 'huge', 500, 500, 600, 2074, 2074, 2488); + sizeone(4, 'LARGE', 440, 440, 500, 1728, 1728, 2074); + sizeone(5, 'Large', 360, 360, 440, 1440, 1440, 1728); + sizeone(6, 'large', 280, 280, 360, 1200, 1200, 1440); + sizeone(7, 'normalsize', 240, 272, 290, 1000, 1095, 1200); + sizeone(8, 'small', 220, 240, 272, 900, 1000, 1095); + sizeone(9,'footnotesize',190, 220, 240, 800, 900, 1000); + sizeone(10,'scriptsize', 160, 190, 190, 700, 800, 800); + sizeone(11,'tiny' , 120, 140, 140, 500, 600, 600); + for k:=12 to 16 do sizeone(k,'tiny',0,0,0,500,600,600); + num_diff_sizes:=11; + + for k:=0 to 10 do environ_type[k]:='\RTFerror'; + + environ_type[0]:='document'; environ_type[1]:='center'; + environ_type[2]:='flushright'; + +end; + +{ ======================================================================= } + +procedure mac_init; +var + k : integer; +begin + +{ install the conversions of RTF accents (coded \'xx in hexa) } +{ build a list of conversion of accented letters } + + for k:=0 to 255 do acc_transl[k]:=''; + + acc_transl[hs_to_i('80')]:='"A'; + acc_transl[hs_to_i('81')]:='\AA{}'; + acc_transl[hs_to_i('82')]:='\c{C}'; + acc_transl[hs_to_i('83')]:='\''E'; + acc_transl[hs_to_i('84')]:='\~N'; + acc_transl[hs_to_i('85')]:='\"O'; + acc_transl[hs_to_i('86')]:='\"U'; + acc_transl[hs_to_i('87')]:='\''a'; + acc_transl[hs_to_i('88')]:='\`a'; + acc_transl[hs_to_i('89')]:='\^a'; + acc_transl[hs_to_i('8a')]:='\"a'; + acc_transl[hs_to_i('8b')]:='\~a'; + acc_transl[hs_to_i('8c')]:='\aa{}'; + acc_transl[hs_to_i('8d')]:='\c{c}'; + acc_transl[hs_to_i('8e')]:='\''e'; + acc_transl[hs_to_i('8f')]:='\`e'; + acc_transl[hs_to_i('90')]:='\^e'; + acc_transl[hs_to_i('91')]:='\"e'; + acc_transl[hs_to_i('93')]:='\''{\i}'; + acc_transl[hs_to_i('93')]:='\`{\i}'; + acc_transl[hs_to_i('94')]:='\^{\i}'; + acc_transl[hs_to_i('95')]:='\"{\i}'; + acc_transl[hs_to_i('96')]:='\~n'; + acc_transl[hs_to_i('97')]:='\''o'; + acc_transl[hs_to_i('98')]:='\`o'; + acc_transl[hs_to_i('99')]:='\^o'; + acc_transl[hs_to_i('9a')]:='\"o'; + acc_transl[hs_to_i('9b')]:='\~o'; + acc_transl[hs_to_i('9c')]:='\''u'; + acc_transl[hs_to_i('9d')]:='\`u'; + acc_transl[hs_to_i('9e')]:='\^u'; + acc_transl[hs_to_i('9f')]:='\"u'; + acc_transl[hs_to_i('a0')]:='\dag{}'; + acc_transl[hs_to_i('a1')]:='\degree{}'; + acc_transl[hs_to_i('a3')]:='\pound{}'; + acc_transl[hs_to_i('a4')]:='\S{}'; + acc_transl[hs_to_i('a7')]:='\ss{}'; + acc_transl[hs_to_i('ae')]:='\AE{}'; + acc_transl[hs_to_i('af')]:='\O{}'; + acc_transl[hs_to_i('b0')]:='$\infty '; + acc_transl[hs_to_i('b1')]:='$\pm '; + acc_transl[hs_to_i('b2')]:='$\leq '; + acc_transl[hs_to_i('b3')]:='$\geq '; + acc_transl[hs_to_i('b5')]:='$\mu '; + acc_transl[hs_to_i('b6')]:='$\partial '; + acc_transl[hs_to_i('b7')]:='$\Sigma '; + acc_transl[hs_to_i('b8')]:='$\Pi '; + acc_transl[hs_to_i('b9')]:='$\pi '; + acc_transl[hs_to_i('bd')]:='${1\over2}'; + acc_transl[hs_to_i('bf')]:='\o{}'; + acc_transl[hs_to_i('c6')]:='$\Delta '; + acc_transl[hs_to_i('c9')]:='...'; + acc_transl[hs_to_i('cb')]:='\`A'; + acc_transl[hs_to_i('cc')]:='\~A'; + acc_transl[hs_to_i('cd')]:='\~O'; + acc_transl[hs_to_i('ce')]:='\OE{}'; + acc_transl[hs_to_i('cf')]:='\oe{}'; + acc_transl[hs_to_i('d0')]:='--{}'; + acc_transl[hs_to_i('d1')]:='---{}'; + acc_transl[hs_to_i('d2')]:='``'; + acc_transl[hs_to_i('d3')]:=''''''; + acc_transl[hs_to_i('d4')]:='`{}'; + acc_transl[hs_to_i('d5')]:='''{}'; + acc_transl[hs_to_i('d6')]:='$\div '; + acc_transl[hs_to_i('d8')]:='\"y'; + acc_transl[hs_to_i('e1')]:='$\cdot '; + acc_transl[hs_to_i('e4')]:='\"a'; + acc_transl[hs_to_i('e5')]:='\^A'; + acc_transl[hs_to_i('e6')]:='\^E'; + acc_transl[hs_to_i('e7')]:='\''A'; + acc_transl[hs_to_i('e8')]:='\"E'; + acc_transl[hs_to_i('e9')]:='\`E'; + acc_transl[hs_to_i('ea')]:='\''I'; + acc_transl[hs_to_i('eb')]:='\^I'; + acc_transl[hs_to_i('ec')]:='\"I'; + acc_transl[hs_to_i('ed')]:='\`I'; + acc_transl[hs_to_i('ee')]:='\''O'; + acc_transl[hs_to_i('ef')]:='\^O'; + acc_transl[hs_to_i('f1')]:='\`O'; + acc_transl[hs_to_i('f2')]:='\''U'; + acc_transl[hs_to_i('f3')]:='\^U'; + acc_transl[hs_to_i('f4')]:='\`U'; + acc_transl[hs_to_i('f6')]:='\"o'; + acc_transl[hs_to_i('fb')]:='\degree{}'; + acc_transl[hs_to_i('fc')]:='\"u'; + +end; + + +{ ======================================================================= } + +procedure ansi_init; +var + k : integer; +begin + +{ install the conversions of RTF accents (coded \'xx in hexa) } +{ build a list of conversion of accented letters } + + for k:=0 to 255 do acc_transl[k]:=''; + + acc_transl[hs_to_i('a1')]:='!`'; + acc_transl[hs_to_i('a3')]:='\pound{}'; + acc_transl[hs_to_i('a7')]:='\S{}'; + acc_transl[hs_to_i('a8')]:='\"{ }'; + acc_transl[hs_to_i('a9')]:='\copyright{}'; + acc_transl[hs_to_i('ab')]:='<<'; + acc_transl[hs_to_i('b0')]:='\degree{}'; + acc_transl[hs_to_i('b1')]:='$\pm '; + acc_transl[hs_to_i('b4')]:='\''{ }'; + acc_transl[hs_to_i('b5')]:='$\mu '; + acc_transl[hs_to_i('b7')]:='$\cdot '; + acc_transl[hs_to_i('b8')]:='\c{ }'; + acc_transl[hs_to_i('bb')]:='>>'; + acc_transl[hs_to_i('bc')]:='${1\over4}'; + acc_transl[hs_to_i('bd')]:='${1\over2}'; + acc_transl[hs_to_i('be')]:='${3\over4}'; + acc_transl[hs_to_i('bf')]:='?`'; + + acc_transl[hs_to_i('c0')]:='\`A'; + acc_transl[hs_to_i('c1')]:='\''A'; + acc_transl[hs_to_i('c2')]:='\^A'; + acc_transl[hs_to_i('c3')]:='\~A'; + acc_transl[hs_to_i('c4')]:='\"A'; + acc_transl[hs_to_i('c5')]:='\AA{}'; + acc_transl[hs_to_i('c6')]:='\AE{}'; + acc_transl[hs_to_i('c7')]:='\c{C}'; + acc_transl[hs_to_i('c8')]:='\`E'; + acc_transl[hs_to_i('c9')]:='\''E'; + acc_transl[hs_to_i('ca')]:='\^E'; + acc_transl[hs_to_i('cb')]:='\"E'; + acc_transl[hs_to_i('cc')]:='\`I'; + acc_transl[hs_to_i('cd')]:='\''I'; + acc_transl[hs_to_i('ce')]:='\^I'; + acc_transl[hs_to_i('cf')]:='\"I'; + + acc_transl[hs_to_i('d1')]:='\~N'; + acc_transl[hs_to_i('d2')]:='\`O'; + acc_transl[hs_to_i('d3')]:='\''O'; + acc_transl[hs_to_i('d4')]:='\^O'; + acc_transl[hs_to_i('d5')]:='\~O'; + acc_transl[hs_to_i('d6')]:='\"O'; + acc_transl[hs_to_i('d8')]:='\O'; + acc_transl[hs_to_i('d9')]:='\`U'; + acc_transl[hs_to_i('da')]:='\''U'; + acc_transl[hs_to_i('db')]:='\^U'; + acc_transl[hs_to_i('dc')]:='\"U'; + acc_transl[hs_to_i('dd')]:='\''Y'; + acc_transl[hs_to_i('df')]:='\ss{}'; + + + acc_transl[hs_to_i('e0')]:='\`a'; + acc_transl[hs_to_i('e1')]:='\''a'; + acc_transl[hs_to_i('e2')]:='\^a'; + acc_transl[hs_to_i('e3')]:='\~a'; + acc_transl[hs_to_i('e4')]:='\"a'; + acc_transl[hs_to_i('e5')]:='\aa{}'; + acc_transl[hs_to_i('e6')]:='\ae{}'; + acc_transl[hs_to_i('e7')]:='\c{c}'; + acc_transl[hs_to_i('e8')]:='\`e'; + acc_transl[hs_to_i('e9')]:='\''e'; + acc_transl[hs_to_i('ea')]:='\^e'; + acc_transl[hs_to_i('eb')]:='\"e'; + acc_transl[hs_to_i('ec')]:='\`i'; + acc_transl[hs_to_i('ed')]:='\''i'; + acc_transl[hs_to_i('ee')]:='\^i'; + acc_transl[hs_to_i('ef')]:='\"i'; + + acc_transl[hs_to_i('f1')]:='\~n'; + acc_transl[hs_to_i('f2')]:='\`o'; + acc_transl[hs_to_i('f3')]:='\''o'; + acc_transl[hs_to_i('f4')]:='\^o'; + acc_transl[hs_to_i('f5')]:='\~o'; + acc_transl[hs_to_i('f6')]:='\"o'; + acc_transl[hs_to_i('f8')]:='\o'; + acc_transl[hs_to_i('f9')]:='\`u'; + acc_transl[hs_to_i('fa')]:='\''u'; + acc_transl[hs_to_i('fb')]:='\^u'; + acc_transl[hs_to_i('fc')]:='\"u'; + acc_transl[hs_to_i('fd')]:='\''y'; + acc_transl[hs_to_i('ff')]:='\"y'; + + + +end; + +{ ======================================================================= } + +procedure charinit; +var + K : integer; +begin + for K:=0 to 255 do catcode[K]:=12; + for K:=ord('A') to ord('Z') do catcode[K]:=11; + for K:=ord('a') to ord('z') do catcode[K]:=11; + for K:=ord('0') to ord('9') do catcode[K]:=16; + K:=ord(' '); catcode[K]:=10; + K:=ord('{'); catcode[K]:=1; + K:=ord('}'); catcode[K]:=2; + K:=ord('('); catcode[K]:=3; + K:=ord(')'); catcode[K]:=4; + K:=ord('\'); catcode[K]:=0; + + icharz:=ord('0'); + +{ build an empty list of conversion of accented letters } + + for K:=0 to 255 do acc_transl[K]:=''; + +{ Now install the conversions of "ftech" characters into math codes +... or letters} + + for K:=0 to 255 do ftech_transl[K]:=''; + ftech_transl[ord('a')]:='\alpha '; + ftech_transl[ord('A')]:='\Alpha '; + ftech_transl[ord('b')]:='\beta '; + ftech_transl[ord('B')]:='\Beta '; + ftech_transl[ord('c')]:='\chi '; + ftech_transl[ord('C')]:='\Chi '; + ftech_transl[ord('d')]:='\delta '; + ftech_transl[ord('D')]:='\Delta '; + ftech_transl[ord('e')]:='\varepsilon '; + ftech_transl[ord('E')]:='\Epsilon '; + ftech_transl[ord('f')]:='\phi '; + ftech_transl[ord('F')]:='\Phi '; + ftech_transl[ord('g')]:='\gamma '; + ftech_transl[ord('G')]:='\Gamma '; + ftech_transl[ord('h')]:='\eta '; + ftech_transl[ord('H')]:='\Eta '; + ftech_transl[ord('i')]:='\iota '; + ftech_transl[ord('I')]:='\Iota '; + ftech_transl[ord('j')]:='\varphi '; + ftech_transl[ord('J')]:='\vartheta '; + ftech_transl[ord('k')]:='\kappa '; + ftech_transl[ord('K')]:='\Kappa '; + ftech_transl[ord('l')]:='\lambda '; + ftech_transl[ord('L')]:='\Lambda '; + ftech_transl[ord('m')]:='\mu '; + ftech_transl[ord('M')]:='\Mu '; + ftech_transl[ord('n')]:='\nu '; + ftech_transl[ord('N')]:='\Nu'; + ftech_transl[ord('o')]:='o'; + ftech_transl[ord('O')]:='\Omicron '; + ftech_transl[ord('p')]:='\pi '; + ftech_transl[ord('P')]:='\Pi '; + ftech_transl[ord('q')]:='\theta '; + ftech_transl[ord('Q')]:='\Theta '; + ftech_transl[ord('r')]:='\rho '; + ftech_transl[ord('R')]:='\Rho '; + ftech_transl[ord('s')]:='\sigma '; + ftech_transl[ord('S')]:='\Sigma '; + ftech_transl[ord('t')]:='\tau '; + ftech_transl[ord('T')]:='\Tau '; + ftech_transl[ord('u')]:='\upsilon '; + ftech_transl[ord('U')]:='\varUpsilon '; + ftech_transl[ord('v')]:='\varpi '; + ftech_transl[ord('V')]:='\varsigma '; + ftech_transl[ord('w')]:='\omega '; + ftech_transl[ord('W')]:='\Omega '; + ftech_transl[ord('x')]:='\xi '; + ftech_transl[ord('X')]:='\Xi '; + ftech_transl[ord('y')]:='\psi '; + ftech_transl[ord('Y')]:='\Psi '; + ftech_transl[ord('z')]:='\zeta '; + ftech_transl[ord('Z')]:='\Zeta '; + + ftech_transl[ord('@')]:='\cong '; + ftech_transl[ord('~')]:='\sim '; + ftech_transl[ord('"')]:='\forall '; + ftech_transl[ord('$')]:='\exists '; + + ftech_transl[hs_to_i('27')]:='\ni '; + ftech_transl[hs_to_i('5e')]:='\bot '; + ftech_transl[hs_to_i('a0')]:='\dag '; + ftech_transl[hs_to_i('a1')]:='\Upsilon '; + ftech_transl[hs_to_i('a2')]:=''''; + ftech_transl[hs_to_i('a3')]:='\leq '; + ftech_transl[hs_to_i('a4')]:='/'; + ftech_transl[hs_to_i('a5')]:='\infty '; + ftech_transl[hs_to_i('a6')]:='\cap '; + ftech_transl[hs_to_i('a7')]:='\clubsuit '; + ftech_transl[hs_to_i('a9')]:='\heartsuit '; + ftech_transl[hs_to_i('aa')]:='\spadesuit '; + ftech_transl[hs_to_i('ab')]:='\leftrightarrow '; + ftech_transl[hs_to_i('ac')]:='\leftarrow '; + ftech_transl[hs_to_i('ad')]:='\uparrow '; + ftech_transl[hs_to_i('ae')]:='\rightarrow '; + ftech_transl[hs_to_i('af')]:='\downarrow '; + ftech_transl[hs_to_i('b0')]:='^{\circ}'; + ftech_transl[hs_to_i('b1')]:='\pm '; + ftech_transl[hs_to_i('b2')]:=''''''; + ftech_transl[hs_to_i('b3')]:='\geq '; + ftech_transl[hs_to_i('b4')]:='\times '; + ftech_transl[hs_to_i('b5')]:='\propto '; + ftech_transl[hs_to_i('b6')]:='\partial '; + ftech_transl[hs_to_i('b7')]:='\bullet '; + ftech_transl[hs_to_i('b8')]:='\div '; + ftech_transl[hs_to_i('b9')]:='\neq '; + ftech_transl[hs_to_i('ba')]:='\equiv '; + ftech_transl[hs_to_i('bb')]:='\approx '; + ftech_transl[hs_to_i('bc')]:='\ldots '; + ftech_transl[hs_to_i('bd')]:='\mid '; + ftech_transl[hs_to_i('c0')]:='\aleph '; + ftech_transl[hs_to_i('c1')]:='\Im '; + ftech_transl[hs_to_i('c2')]:='\Re '; + ftech_transl[hs_to_i('c3')]:='\wp '; + ftech_transl[hs_to_i('c4')]:='\otimes '; + ftech_transl[hs_to_i('c5')]:='\oplus '; + ftech_transl[hs_to_i('c6')]:='\oslash '; + ftech_transl[hs_to_i('c7')]:='\cap '; + ftech_transl[hs_to_i('c8')]:='\cup '; + ftech_transl[hs_to_i('c9')]:='\supset '; + ftech_transl[hs_to_i('ca')]:='\supseteq '; + ftech_transl[hs_to_i('cb')]:='\not\subset '; + ftech_transl[hs_to_i('cc')]:='\subset '; + ftech_transl[hs_to_i('cd')]:='\subseteq '; + ftech_transl[hs_to_i('ce')]:='\in '; + ftech_transl[hs_to_i('cf')]:='\not\in '; + ftech_transl[hs_to_i('d0')]:='\angle '; + ftech_transl[hs_to_i('d1')]:='\nabla '; + ftech_transl[hs_to_i('d2')]:='\registered '; + ftech_transl[hs_to_i('d3')]:='\copyright '; + ftech_transl[hs_to_i('d4')]:='\trademark '; + ftech_transl[hs_to_i('d5')]:='\prod '; + ftech_transl[hs_to_i('d7')]:='\cdot '; + ftech_transl[hs_to_i('d8')]:='\neg '; + ftech_transl[hs_to_i('d9')]:='\wedge '; + ftech_transl[hs_to_i('da')]:='\vee '; + ftech_transl[hs_to_i('db')]:='\Leftrightarrow '; + ftech_transl[hs_to_i('dc')]:='\Leftarrow '; + ftech_transl[hs_to_i('dd')]:='\Uparrow '; + ftech_transl[hs_to_i('de')]:='\Rightarrow '; + ftech_transl[hs_to_i('df')]:='\Downarrow '; + ftech_transl[hs_to_i('e0')]:='\diamondsuit '; + ftech_transl[hs_to_i('e1')]:='\langle '; + ftech_transl[hs_to_i('e2')]:='\registered '; + ftech_transl[hs_to_i('e3')]:='\copyright '; + ftech_transl[hs_to_i('e4')]:='\trademark '; + ftech_transl[hs_to_i('e5')]:='\sum '; + ftech_transl[hs_to_i('e9')]:='\lceil '; + ftech_transl[hs_to_i('ea')]:='\mid '; + ftech_transl[hs_to_i('eb')]:='\lfloor '; + ftech_transl[hs_to_i('f1')]:='\rangle '; + ftech_transl[hs_to_i('f2')]:='\int '; + + end_math_code:='$'; +end; + +{ ======================================================================= } +{ this procedure returns a set of 4 chars, the size preamble of a non std font } +function sizealpha(i : integer) : string5; +var + h : integer; +begin + h:=i div 2; + if h<= 5 then sizealpha:='\fiv' + else if h<= 6 then sizealpha:='\six' + else if h<= 7 then sizealpha:='\sev' + else if h<= 8 then sizealpha:='\egt' + else if h<= 9 then sizealpha:='\nin' + else if h<= 10 then sizealpha:='\ten' + else if h<= 11 then sizealpha:='\elv' + else if h<= 13 then sizealpha:='\twl' + else if h<= 15 then sizealpha:='\frt' + else if h<= 18 then sizealpha:='\svtn' + else if h<= 23 then sizealpha:='\twty' + else if h<= 28 then sizealpha:='\twfv' + else sizealpha:='\thtw' + ; {END IF} + +end; + +{ ======================================================================= } +{ write "help" information } + +procedure write_help; +begin + writeln('Usage: RTFLATEX [options] <input-file> [options] <output-file>'); + writeln('Options:'); + writeln(' -b : set explicit \baselineskip at par ends'); + writeln(' -d<nnn> : debug level: 1=default, 0=quiet, >1=verbose'); + writeln(' -f<templ> : file template to put figures (need a * )'); + writeln(' -l<style> : latex style (default is "report")'); + writeln(' -m : put debugging marks in output TeX'); + writeln(' -o<option> : latex style option (cumulative)'); + writeln(' -p<value> : std font size (10, 11, 12)'); + writeln(' -r<file> : LOG output file (default is none)'); + writeln(' -s : use slanted instead of italic'); + writeln(' -t : omit LaTeX \documentstyle etc.'); + writeln(' -v : convert text and fonts, not spacings'); + writeln(' -x : inhibit output simplification'); + writeln(' -z<file> : file containing list of ignored keywords'); + writeln(' -209 : assume ancient Latex209'); + halt; +end; + +{---------------------------------------------------------------------------} +{ this procedure open files and set the -xxxx options } + +procedure open_files; +var + skipname, outputname, inputname, logname, optstr : string128; + testio, cat, ikar, kparm, L, pospt : integer; + first_char, kar : char; + success : boolean; + inskipk : string24; + kkk, number_params : integer; + +begin + figure_path:='rtf*.bit'; figure_type:=''; + stdsize:=12; stdkz:=3; { standard LaTeX size : 10, 11, 12 pt } + inputname:=''; outputname:=''; skipname:=paramstr(0); kparm:=0; + num_skip_strings:=1; + for L:=1 to max_skip_strings do skip_strings[L]:=''; + + pospt:=pos_postfix(skipname); + if pospt>0 then + begin + if (copy(skipname,pospt,length(skipname))='.EXE') then + skipname:=copy(skipname,1,pospt)+'SKW' + else if (copy(skipname,pospt,length(skipname))='.exe') then + skipname:=copy(skipname,1,pospt)+'skw' + ; + end + else skipname:=skipname+'.skw' + ; {END IF} + number_params:=paramcount; + + for kkk:=1 to number_params do + begin + kparm:=kkk; optstr:=paramstr(kparm); first_char:=optstr[1]; + if first_char='-' then + begin + writeln(first_char,'Option :>',optstr,'<'); + if optstr[2]='p' then + begin + stdsize:=0; + for L:=3 to length(optstr) do + begin + ikar:=ord(optstr[L]); cat:=catcode[ikar]; + if(cat=16) then + stdsize:=10*stdsize+ikar-icharz + else + begin + writeln ('Illegal character in -p option: ',optstr); halt; + end + ; + end + ; + writeln('Standard size found: ',stdsize,'pt'); + if(stdsize < 11) then stdkz:=1 + else if(stdsize=11) then stdkz:=2 + else stdkz:=3 + ; {END IF} + end + else if (optstr[2]='2') then latex209:=TRUE + else if (optstr[2]='v') then no_space_conv:=TRUE + else if (optstr[2]='s') then use_sl:=TRUE + else if (optstr[2]='t') then latex_header:=FALSE + else if (optstr[2]='x') then simplify_ok:=FALSE + else if (optstr[2]='b') then base_flag:=TRUE + else if (optstr[2]='z') then skipname:=copy(optstr,3,999) + else if (optstr[2]='l') then + begin latex_style:=truncate24(optstr); + if latex_style='' then latex_style:='report'; + end + else if (optstr[2]='o') then + begin + if (num_latex_options >= maxstyles) then + writeln('Too many style options, ',optstr,' ignored !') + else + begin + num_latex_options:=num_latex_options+1; + latex_options[num_latex_options]:= + truncate24(copy(optstr,3,bfslen)); + end + ; {END IF num_latex_options} + end + else if (optstr[2]='f') then + begin figure_path:=copy(optstr,3,999); writeln('-f:',figure_path); + end + else if (optstr[2]='r') then + begin logname:=copy(optstr,3,999); write_log:=TRUE; + end + else if (optstr[2]='m') then + tex_verbose:=1 { insert marks in TeX output } + else if (optstr[2]='d') then + begin + verbose:=0; + for L:=3 to length(optstr) do + begin ikar:=ord(optstr[L]); cat:=catcode[ikar]; + if(cat=16) then + verbose:=10*verbose+ikar-icharz + else + begin + writeln ('Illegal character in -d option: ',optstr); halt; + end + ; {END IF} + if verbose>0 then writeln('Verbose=',verbose); + end + end + else writeln('Unsupported option, ignored: ',optstr) + ; {END IF} + end + else if (inputname='') then inputname:=optstr + else if (outputname='') then outputname:=optstr + else if (optstr <> '') then + begin writeln ('Too many non option args : ',optstr); + writeln ('This one ignored !'); + end + ; {END IF} + end + ; {END WHILE} + + pospt:=pos('*',figure_path); + if(pospt=0) then + begin + writeln('NO * in -f<path> option'); halt; + end; + figure_type:=copy(figure_path,pospt+1,999); + figure_path:=copy(figure_path,1,pospt-1); + + if inputname='' then write_help; (* stops if help written *) + + if (pos_postfix(inputname)=0) then inputname:=inputname+'.rtf'; + + {$I-} + assign(inputfile,inputname); reset(inputfile); + testio:=ioresult; success:=(testio=0); + if (not success) then + begin + writeln('Unable to open input file ',inputname,' ; code=',testio); halt; + end; + + if outputname='' then + begin + pospt:=pos_postfix(inputname); outputname:=copy(inputname,1,pospt)+'tex'; + writeln('Output name taken from input: ',outputname); + end; + + if(outputname=inputname) then + begin + writeln('Input and output files have same names, abort!'); + writeln(' Input: ',inputname); writeln(' Output: ',inputname); + close(inputfile); halt; + end; + + assign(outputfile,outputname); rewrite(outputfile); + testio:=ioresult; success:=(testio=0); + + if not success then + begin + writeln('ioresult (output)=',testio); + writeln('Unable to open output file ',outputname,' ; code=',testio); + close(inputfile); halt; + end + ; + + (* opening skip file to eliminate useless output \RTFxxx keywords *) + if skipname='' then + begin + pospt:=pos_postfix(inputname); skipname:=copy(inputname,1,pospt)+'skw'; + writeln('keyword skip file name taken from input: ',skipname); + end; + + if(skipname=inputname) then + begin + writeln('Input and skip files have same names, abort!'); + writeln(' Input: ',inputname); writeln(' skip: ',inputname); + close(inputfile); halt; + end; + + assign(skipfile,skipname); reset(skipfile); + testio:=ioresult; success:=(testio=0); + + if not success then + begin + writeln('ioresult (keyword skip file)=',testio); + writeln('Unable to open keyword skip file ',skipname,' ; code=',testio); + close(inputfile); halt; + end + ; + + {$I-} + + if write_log then + begin + if (logname='') then + begin + pospt:=pos_postfix(inputname); logname:=copy(inputname,1,pospt)+'log'; + writeln('Log name taken from input : ',logname); + end + ; {END IF logname} + + if(logname=inputname) or (logname=outputname) then + begin + writeln('Log and input or output files have same names, abort!'); + writeln(' Log: ',logname); close(inputfile); halt; + end + ; {END IF logname} + + assign(logfile,logname); rewrite(logfile); testio:=ioresult; + write_log:=(testio=0); + + if not write_log then + begin + writeln('ioresult (Log)=',testio); + writeln('Unable to open log file ',logname,' ; code=',testio); + close(inputfile); halt; + end + ; {END IF not success} + {$I-} + write(logname,', '); + end + ; {END IF write_log} + writeln(inputname,', ',skipname,' and ',outputname,' successfully opened.'); + + while (not eof(skipfile)) do + begin + readln(skipfile,inskipk); println_msg(2,'Cancelling "'+inskipk+'"'); + if inskipk<> '' then + begin + if length(inskipk)+length(skip_strings[num_skip_strings])<255 then + skip_strings[num_skip_strings]:= + skip_strings[num_skip_strings]+inskipk+' ' + else if num_skip_strings<max_skip_strings then + begin num_skip_strings:=num_skip_strings+1; + skip_strings[num_skip_strings]:= + skip_strings[num_skip_strings]+inskipk+' ' + end + else + println_msg(1,'Too many keywords to ignore, '+inskipk+' not recorded!') + ; {END IF} + end + ; {END IF} + end + ; {END DO} +end; + +{---------------------------------------------------------------------------} +{ clean the output line } + +procedure cleanout; +begin + for i:=1 to olmx do exline[i]:=' '; kout:=0; +end; + + +{---------------------------------------------------------------------------} +{ prints/displays the current stored output line } + +procedure print_line (verbose_level : integer); +var + i : integer; +begin + for i:=1 to kout do print_msg(verbose_level,exline[i]); + println_msg(verbose_level,'<<<'); +end; + +{---------------------------------------------------------------------------} +{ makes the pos function in an array of type exline_type } + +function array_pos (oldstring : string; testline : exline_type; + array_long : integer) : integer; +var + string_found : boolean; + lth1, jpos, kpos : integer; +begin + array_pos:=0; lth1:=length(oldstring); + for kpos:=1 to array_long-lth1+1 do + begin + string_found:=TRUE; + for jpos:=1 to lth1 do + string_found:=string_found and (oldstring[jpos]=testline[kpos+jpos-1]) + ; {END DO} + if string_found then + begin + array_pos:=kpos; exit; + end + ; {END IF} + end + ; {END DO} +end; + + +{---------------------------------------------------------------------------} +{ substitute a string with another in output line } + +procedure outsubstitute (oldstring, newstring : string); +var + string_found : boolean; + lth1, lth2, jpos, kpos, oldkout : integer; + oldline : exline_type; +begin + string_found:=TRUE; lth1:=length(oldstring); lth2:=length(newstring); + while string_found do + begin + kpos:=array_pos(oldstring,exline,kout); + string_found:=(kpos>0); + if string_found then + begin + oldline:=exline; oldkout:=kout; kout:=kpos-1; + for jpos:=1 to lth2 do + begin + kout:=kout+1; exline[kout]:=newstring[jpos]; + end + ; {END DO} + for jpos:=kpos+lth1 to oldkout do + begin + kout:=kout+1; exline[kout]:=oldline[jpos]; + end + ; {END DO} + for jpos:=kout+1 to olmx do exline[jpos]:=' ' + ; {END DO} + end + ; {END IF} + end + ; {END DO} +end; + +{---------------------------------------------------------------------------} +{ converts an integer number of twips into a decimal string } + +procedure str_twips_pt(numval: integer; var outpts: string24); +var + k, l: integer; + wk: string24; +begin + k:=5*numval; { convert to hundredth of pts } + sign_str(k,wk); if(length(wk)<2) then wk:=truncate24('00'+wk); + l:=length(wk); outpts:=truncate24(copy(wk,1,l-2)+'.'+copy(wk,l-1,2)); +end; + +{---------------------------------------------------------------------------} +{ eliminates end replaces useless sequences in output -- pragmatic feature } + +procedure simplify (oldstring, newstring : string); +begin if simplify_ok then outsubstitute(oldstring, newstring); +end; + + +{---------------------------------------------------------------------------} +{ read the future chars, excluding control chars < ord(' ') } + +procedure read_next_char; +var + next_ikar : integer; + next_char : char; +begin + next_ikar:=0; next_char:=chr(next_ikar); + while ((not eof(inputfile)) and (next_ikar < ord(' ')) and + (length(next_rtf)<8)) do + begin + read(inputfile,next_char); next_ikar:=ord(next_char); + if next_ikar=13 then + begin input_line_number:=input_line_number+1; + prev_line:=inpline; prev_kinp:=kinp; kinp:=0; + end + else if (next_ikar >= ord(' ')) then + next_rtf:=next_rtf+next_char + ; {END IF} + end + ; {END DO} +end; + +{---------------------------------------------------------------------------} +{ read one char except nulls } + +procedure read_char; +begin + if (length(next_rtf)>0) then + begin kar:=next_rtf[1]; delete(next_rtf,1,1); read_next_char; + end + else + kar:=chr(26) + ; {END IF} + ikar:=ord(kar); cat:=catcode[ikar]; + if (length(next_rtf)=0) then next_rtf:=next_rtf+chr(26) + ; {END IF} + + if kinp<lmx then + begin kinp:=kinp+1; inpline[kinp]:=kar; + end + ; {END IF} +end; + + +{---------------------------------------------------------------------------} +{ outputs the stored output line } + +procedure output_line; +var + i : integer; + simpl_pattern : string24; +begin + numl:=numl+1; + simplify('{{}','{'); simplify('{}}','}'); simplify('{}{}','{}'); + for i:=1 to num_diff_sizes do + begin simpl_pattern:=truncate24('\'+sizekey[i]); + simplify(simpl_pattern+'{}\',simpl_pattern+'\'); + simplify(simpl_pattern+'}','}'); + end + ; {END DO} + simplify('\root{}\of{','\sqrt{'); + + for i:=1 to kout do write(outputfile, exline[i]); + writeln(outputfile); + + if((NUML mod 100)=0) then + begin + if (verbose>0) then + begin sign_str(NUML,works); print_msg(1,'Output : '+works+' lines '); + for j:=1 to bracelvl do print_msg(1,'{'); println_msg(1,''); + end + else write('.') + ; + end + ; {END IF NUML} + cleanout; +end; + +{---------------------------------------------------------------------------} +{ write a character into output line } + +procedure output_real_line; +begin + if (kout>0) then output_line; +end; + +{---------------------------------------------------------------------------} +{ write a character into output line } + +procedure outchr (CHARAC : char); +var + oldchar, newchar : char; +begin + newchar:=CHARAC; + if(kout > 0) then + begin oldchar:=exline[kout]; + if((oldchar=' ') and (newchar=' ')) then exit; + end + else if ((kout=0) and last_percent and (CHARAC=' ')) then + begin kout:=1; EXLINE[kout]:='\'; + end + ; {END IF} + last_percent:=FALSE; + + if(kout < olmx-2) then + begin kout:=kout+1; exline[kout]:=newchar; + if(newchar='}') and (kout > 80) then + begin + if (EXLINE[kout-1]=';') then + begin EXLINE[kout]:='\'; + kout:=kout+1; EXLINE[KOUT]:='r'; + kout:=kout+1; EXLINE[KOUT]:='e'; + kout:=kout+1; EXLINE[KOUT]:='l'; + kout:=kout+1; EXLINE[KOUT]:='a'; + kout:=kout+1; EXLINE[KOUT]:='x'; output_line; + kout:=kout+1; EXLINE[KOUT]:=' '; + kout:=kout+1; EXLINE[KOUT]:=newchar; + end + else if (kout > 120) then + begin + kout:=kout+1; EXLINE[KOUT]:='%'; + kout:=kout+1; EXLINE[KOUT]:='%'; + output_line; last_percent:=TRUE; + end + ; {END IF} + end + else if(newchar=' ') and (kout > 64) then output_line + ; {END IF} + end + else + begin sign_str(KOUT,works); println_msg(0,'Output overflow, KOUT:='+works); + end + ; {END IF} +end; + + +{ ===================================================================== } +{ change contents of bfslcode[bracelvl] : replace first arg with 2nd } +{ but do not declare font, since output will be standard } + +procedure font_subs2e(old, new: string); +var + workstg : string[48]; + positn : integer; +begin + positn:=pos(old,bfslcode[bracelvl]); if(positn=0) then exit; + if lvlcode[bracelvl]= 9 then exit; (* ignore new fonts in header/footer *) + if (verbose>=2) then + write('font_subs2e: ',old,'|',bfslcode[bracelvl],'|',new) + ; + workstg:=bfslcode[bracelvl]; delete(workstg,positn,length(old)); + if (pos(new,workstg)=0) then insert(new,workstg,positn); + bfslcode[bracelvl]:=truncate24(workstg); + if (verbose>=2) then + writeln('=>',workstg) + ; +end; + +{---------------------------------------------------------------------------} +{ inserts a new font specification like \bf \rm \sc into bfslcode[bracelvl] } + +procedure add_to_bfsl(kod : string); +var + bfsl_try : string[64]; bfsl_old : string[64]; +begin (* bfsl_old:=bfslcode[bracelvl]; *) + bfsl_try:=bfslcode[bracelvl]+'\'; + if (pos(kod+'\',bfsl_try)>0) then exit; + bfslcode[bracelvl]:=truncate24(bfslcode[bracelvl]+kod); + (* writeln('add_to:',bfsl_old,'+',kod,'=',bfslcode[bracelvl]); *) +end; + + +{---------------------------------------------------------------------------} +{ output one character capitalized if needed } + +procedure outchrc (CHARAC : char); +var + kar : char; +begin + if(lvlcode[bracelvl]=2) then kar:=upcase(CHARAC) + else kar:=CHARAC; outchr(kar); +end; + +{---------------------------------------------------------------------------} +{ write a string into output line } + +procedure outstg (CHARACs : string); +var + k : integer; +begin for k:=1 to length(CHARACs) do outchr(CHARACs[k]); +end; + +{ ===================================================================== } +{ checks the presence of a string at end of current output } + +function last_is(CHARACs : string) : boolean; +var + k, long : integer; +begin + long:=length(CHARACs); last_is:=FALSE; + if(kout < long) then exit; + for k:=1 to long do + if (exline[kout-long+k] <> CHARACs[k]) then exit; + last_is:=TRUE; +end; + +{ ===================================================================== } +{ remove one string from output } + +procedure outrem(CHARACs : string); +var + k, l, long : integer; +begin + long:=length(CHARACs); removed_OK:=last_is(CHARACs); + if(not removed_OK) then exit; + for k:=kout-long+1 to kout do exline[kout]:=' '; + kout:=kout-long; +end; + +{ ===================================================================== } +{ remove all empty pairs of braces at the end of output } + +procedure outrem_empty_braces; +var + num_removed : integer; +begin + num_removed:=0; removed_OK:=TRUE; + while removed_OK do + begin + outrem('{}'); if removed_OK then num_removed:=num_removed+1; + end + ; {END WHILE} + removed_OK:=(num_removed>0); +end; + + +{---------------------------------------------------------------------------} +{ output a TeX keyword ( the \ not in args ) on output line EXLINE } + +procedure outkeyw(CHARACs : string); +var + k : integer; +begin +{ eliminate useless brace pairs terminating a previous keyword} + outrem_empty_braces; + outchr('\'); for k:=1 to length(CHARACs) do outchr(CHARACs[k]); +end; + + +{---------------------------------------------------------------------------} +{ outputs the new \bf \sl code if different from current at that level } + +procedure output_bfsl; +begin + if bfslcode[bracelvl]=currbfsl[bracelvl] then exit + else if bfslcode[bracelvl]='\relax' then exit + else if math_mode[bracelvl]>0 then exit + else + begin outrem_empty_braces; outrem(currbfsl[bracelvl]); + font_subs2e('\rm\bf','\bf'); + font_subs2e('\rm\tt','\tt'); + font_subs2e('\rm\it','\it'); + font_subs2e('\rm\sf','\sf'); + font_subs2e('\rm\sl','\sl'); + + if(latex209) then + else (* latex2e *) + begin + font_subs2e('\bf\it','\bfit'); + font_subs2e('\it\bf','\bfit'); + font_subs2e('\bf\sl','\bfsl'); + font_subs2e('\sl\bf','\bfsl'); + font_subs2e('\bf\sf','\sfbf'); + font_subs2e('\sf\bf','\sfbf'); + font_subs2e('\sf\it','\sfit'); + font_subs2e('\sf\sl','\sfsl'); + font_subs2e('\tt\bf','\ttbf'); + font_subs2e('\tt\it','\ttit'); + font_subs2e('\tt\sl','\ttsl'); + font_subs2e('\bf\tt','\ttbf'); + font_subs2e('\it\tt','\ttit'); + font_subs2e('\sl\tt','\ttsl'); + font_subs2e('\sfit\bf','\sfbfit'); + font_subs2e('\sfsl\bf','\sfbfsl'); + font_subs2e('\bfit\sf','\sfbfit'); + font_subs2e('\bfsl\sf','\sfbfsl'); + end + ; {END IF latex209} + outstg(bfslcode[bracelvl]); outstg('{}'); + currbfsl[bracelvl]:=bfslcode[bracelvl]; + end +end; + +{---------------------------------------------------------------------------} +{ outputs the new \large code if different from current at that level } + +procedure output_size ( codesize : string24 ); +begin + if codesize=currsize[bracelvl] then exit + else if codesize='relax' then exit + else if lvlcode[bracelvl]=8 then exit + else if lvlcode[bracelvl]=9 then exit + else if math_mode[bracelvl]>0 then exit + else + begin outkeyw(codesize); + if (not base_flag) then + begin outstg('{}'); currsize[bracelvl]:=codesize; + end + ; {END IF} + currbfsl[bracelvl]:='\relax'; + end +end; + +{ ----------------------------------------------------------------------} +procedure ensure_sizebfsl; +begin + if(par_to_begin) then exit; + if last_is('{') then output_size(sizecode[bracelvl]); + output_bfsl; +end; + +{ ----------------------------------------------------------------------} +procedure output_skips; +begin + if(leftcurskip<>leftskip) then + begin str_twips_pt(leftskip,worksa); + outkeyw('global\leftskip '); outstg(worksa); outstg('pt\relax'); + leftcurskip:=leftskip; + end; + + if(rightcurskip<>rightskip) then + begin str_twips_pt(rightskip,worksa); + outkeyw('global\rightskip '); outstg(worksa); outstg('pt\relax'); + rightcurskip:=rightskip; + end; +end; + + +{---------------------------------------------------------------------------} +procedure close_files; + +begin + close(outputfile); close(inputfile); if write_log then close(logfile); +end; + + +{ ===================================================================== } +{ remove one keyword from output } + +procedure outkrem(CHARACs : string); +begin + outrem('\'+CHARACs); +end; + + +{ --------------------------------------------------------------------------} +{ open brace and increment bracelvl } + +procedure open_brace; +begin + if(bracelvl < maxlevel) then + begin bracelvl:=bracelvl+1; + bfslcode[bracelvl]:=bfslcode[bracelvl-1]; + tab_nb_cellx[bracelvl]:=tab_nb_cellx[bracelvl-1]; + tab_cellx[bracelvl]:=0; + sizecode[bracelvl]:=sizecode[bracelvl-1]; + currsize[bracelvl]:=currsize[bracelvl-1]; + currbfsl[bracelvl]:=currbfsl[bracelvl-1]; + spacingcode[bracelvl]:=spacingcode[bracelvl-1]; + lvlcode[bracelvl]:=lvlcode[bracelvl-1]; + if(bracelvl<maxlevel) then lvlcode[bracelvl+1]:=0; + active_RTFf[bracelvl]:=active_RTFf[bracelvl-1]; +{ propagate math_mode, but say 2 if previous was 1 to avoid extra closins by $ } + math_mode[bracelvl]:=math_mode[bracelvl-1]; + if(math_mode[bracelvl]=1) then math_mode[bracelvl]:=2; + + flushright_flag[bracelvl]:=flushright_flag[bracelvl-1]; + if(flushright_flag[bracelvl]=2) then flushright_flag[bracelvl]:=3; + + center_flag[bracelvl]:=center_flag[bracelvl-1]; + if(center_flag[bracelvl]=2) then center_flag[bracelvl]:=3; + + underl_flag[bracelvl]:=FALSE; + auto_close[bracelvl]:=FALSE; form_code[bracelvl]:=''; close_kar[bracelvl]:=' '; + if(lvlcode[bracelvl]=3) then lvlcode[bracelvl]:=4 + else if(lvlcode[bracelvl]=10) then {in objects} + lvlcode[bracelvl]:=-lvlcode[bracelvl] + else if(lvlcode[bracelvl]=15) then {brace opened after \RTFintbl => set normal} + lvlcode[bracelvl]:=0 + else if(lvlcode[bracelvl] >= 16) then {in formulas} + lvlcode[bracelvl]:=-lvlcode[bracelvl] + ; {END IF} + end + else + begin sign_str(maxlevel,works); + print_msg(0,'Too many brace levels, max is '+works); + sign_str(NUML+1,works); println_msg(0,' at line'+works); + print_line(0); if write_log then close_files; halt; + end + ; {END IF bracelvl<maxlevel} +end; + + +{---------------------------------------------------------------------------} +{ output \begin(<arg>) } + +procedure begin_env(environ : integer); +begin + if (kout>0) then output_line; outkeyw('begin{'); + outstg(environ_type[environ]); outstg('}\strut'); + open_brace; output_line; +end; + +{ ----------------------------------------------------------------------} +(* execute \begin{center}/{flushright} is center_flag set to 1 *) +procedure make_center; +begin + if center_flag[bracelvl]=1 then + begin begin_env(1); center_flag[bracelvl]:=2; + end + ; + if flushright_flag[bracelvl]=1 then + begin begin_env(2); flushright_flag[bracelvl]:=2; + end + ; +end; + +{ ----------------------------------------------------------------------} +procedure begin_par; +var + k : integer; +begin if (not par_to_begin) then exit; + if (lvlcode[bracelvl]=6) then exit; + if (lvlcode[bracelvl]=8) then exit; + if (lvlcode[bracelvl]=9) then exit; + if ((center_flag[bracelvl]+flushright_flag[bracelvl])=0) then + output_skips; + space_after:=save_skip; save_skip:=0; + if (num_indent=0) and (lvlcode[bracelvl]<>15) + and (center_flag[bracelvl]=0) and (flushright_flag[bracelvl]=0) then + outkeyw('noindent '); + for k:=2 to num_indent do outkeyw('indent '); num_indent:=0; make_center; + output_size(sizecode[bracelvl]); output_bfsl; + outkeyw('beginparagraph{}'); + par_to_begin:=FALSE; +end; + + +{---------------------------------------------------------------------------} +{ write a string into math mode onto output line, and leave in math mode } + +procedure out_math_leave (CHARACs : string); +begin + if math_mode[bracelvl]>0 then outchr(' ') + else + begin outrem_empty_braces; outrem('$'); + if removed_OK then math_mode[bracelvl]:=1; + end + ; {END IF math_mode} + if math_mode[bracelvl]=0 then + begin begin_par; outchr('$'); math_mode[bracelvl]:=1; + end + ; {END IF math_mode=0} + outstg(CHARACs); +end; + +{---------------------------------------------------------------------------} +{ close math_mode if possible, i.e. =1 } + +procedure close_math; +begin + if math_mode[bracelvl]=1 then + begin outstg(end_math_code); math_mode[bracelvl]:=0; + end + ; {END IF math_mode} +end; + +{---------------------------------------------------------------------------} +{ write a string into math mode onto output and close math mode if possible} + +procedure out_math (CHARACs : string); +begin + out_math_leave(CHARACs); close_math; +end; + + +{ ===================================================================== } +{ output one string and capitalize it if required } + +procedure outstgc(CHARACs : string); +var + k : integer; +begin + for k:=1 to length(CHARACS) do outchrc(CHARACs[K]); +end; +{ ===================================================================== } +{ output a number } + +procedure output_num(numb : integer); +var + wkk : string24; +begin + sign_str(numb, wkk); + outstg(wkk); +end; + + +{ ===================================================================== } +{ output one keyword and capitalize it } + +procedure outkeywc(CHARACs : string); +var + k : integer; +begin + outrem_empty_braces; outchr('\'); + for K:=1 to length(CHARACS) do outchrc(CHARACs[K]); +end; + + +{ ===================================================================== } +{ close brace pair and remove all sub/superscripted empty pairs at end of output } + +procedure close_subs; +begin + if(math_mode[bracelvl]>0) then outrem(' '); outchr('}'); + outrem('^{}'); outrem('_{}'); outrem('^{ }'); outrem('_{ }'); +end; + +{ ===================================================================== } +{ declares a new font as \global, and record it } + +procedure declare_font(font_id, fontname: string; magnification : integer); +var + i,j : integer; +begin + for i:=1 to numfonts do + if (newfonts[i]=font_id) then exit; + if (numfonts >= maxfonts) then + begin + println_msg(0,'Font '+font_id+' cannot be declared... too many fonts !'); exit; + end + ; {END IF} + + numfonts:=numfonts+1; newfonts[numfonts]:=truncate24(font_id); + + if(kout > 1) then output_line; { to have font decl at left of a line } + outstg('\ifx'); outstg(font_id); outstg('\undefined \global\font'); + outstg(font_id); outstg('=\FontHdg\FontHdge '); outstg(fontname); + sign_str(magnification,works); + outstg(' scaled '); outstg(works); outstg('\fi'); output_line; + +end; + +{ ===================================================================== } +{ change contents of bfslcode[bracelvl] : replace first arg with 2nd } + +procedure font_subs(old, new, fontname: string; magnification : integer); +var + workstg : string[48]; + positn : integer; +begin + positn:=pos(old,bfslcode[bracelvl]); if(positn=0) then exit; + if lvlcode[bracelvl]= 9 then exit; (* ignore new fonts in header/footer *) + workstg:=bfslcode[bracelvl]; delete(workstg,positn,length(old)); + if (pos(new,bfslcode[bracelvl])=0) then insert(new,workstg,positn); + bfslcode[bracelvl]:=truncate24(workstg); + declare_font(new, fontname, magnification); +end; + +{---------------------------------------------------------------------------} +{ builds the correct LaTeX font size according to NUMVAL (unit=1/2 pt) } +{ stores it in sizecode[bracelvl] ; uses the global variable "stdsize" } + +procedure outfsize (numval : integer; var magnif : integer); +var + ll, selectsize, latex_size, best_diff: integer; +begin +{ I select the nearest sizemags } + latex_size:=numval*50; (* convert from half points to hundredths of points *) + best_diff:=30000; (* big integer *) + sizecode[bracelvl]:='tiny'; selectsize:=0; + for LL:=1 to numsizes do + begin + if(abs(sizemags[stdkz,ll]-latex_size) < best_diff) then + begin sizecode[bracelvl]:=sizekey[LL]; selectsize:=sizemags[stdkz,ll]; + magnif:=sizemags[stdkz,ll]; best_diff:=abs(selectsize-latex_size); + end + ; {END IF} + end + ; {END DO} + + sign_str(selectsize,works); println_msg(2,' selectsize='+works+' xkey='+sizecode[bracelvl]); + +end; + +{---------------------------------------------------------------------------} +procedure font_clean (sizeheader : string; magnification : integer); +begin + if(latex209) then + begin + font_subs('\rm\bf\it',sizeheader+'bfit','bxti10',magnification); + font_subs('\rm\it\bf',sizeheader+'bfit','bxti10',magnification); + font_subs('\rm\bf\sl',sizeheader+'bfsl','bxsl10',magnification); + font_subs('\rm\sl\bf',sizeheader+'bfsl','bxsl10',magnification); + font_subs('\rm\bf\sf',sizeheader+'sfbf','ssbx10',magnification); + font_subs('\rm\sf\bf',sizeheader+'sfbf','ssbx10',magnification); + font_subs('\bf\it',sizeheader+'bfit','bxti10',magnification); + font_subs('\it\bf',sizeheader+'bfit','bxti10',magnification); + font_subs('\bf\sl',sizeheader+'bfsl','bxsl10',magnification); + font_subs('\sl\bf',sizeheader+'bfsl','bxsl10',magnification); + font_subs('\bf\sf',sizeheader+'sfbf','ssbx10',magnification); + font_subs('\sf\bf',sizeheader+'sfbf','ssbx10',magnification); + if magnification>2000 then + begin {definir explicitement les grosses polices} + font_subs('\rm\oul',sizeheader+'obf','obx10',magnification); + font_subs('\rm\sf',sizeheader+'sf','ss10',magnification); + font_subs('\rm\it',sizeheader+'it','ti10',magnification); + font_subs('\rm\sl',sizeheader+'sl','sl10',magnification); + font_subs('\rm\sc',sizeheader+'sc','csc10',magnification); + font_subs('\rm\tt',sizeheader+'tt','tt10',magnification); + font_subs('\sf',sizeheader+'sf','ss10',magnification); + font_subs('\it',sizeheader+'it','ti10',magnification); + font_subs('\sl',sizeheader+'sl','sl10',magnification); + font_subs('\sc',sizeheader+'sc','csc10',magnification); + font_subs('\tt',sizeheader+'tt','tt10',magnification); + end + ; + end + else (* latex2e *) + begin + font_subs2e('\rm\bf\it','\bfit'); + font_subs2e('\rm\it\bf','\bfit'); + font_subs2e('\rm\bf\sl','\bfsl'); + font_subs2e('\rm\sl\bf','\bfsl'); + font_subs2e('\rm\bf\sf','\sfbf'); + font_subs2e('\rm\sf\bf','\sfbf'); + font_subs2e('\rm\sf\it','\sfit'); + font_subs2e('\rm\sf\sl','\sfsl'); + font_subs2e('\bf\it','\bfit'); + font_subs2e('\it\bf','\bfit'); + font_subs2e('\bf\sl','\bfsl'); + font_subs2e('\sl\bf','\bfsl'); + font_subs2e('\bf\sf','\sfbf'); + font_subs2e('\sf\bf','\sfbf'); + font_subs2e('\sf\it','\sfit'); + font_subs2e('\sf\sl','\sfsl'); + if magnification>2000 then + begin {definir explicitement les grosses polices} + font_subs('\rm\oul',sizeheader+'obf','obx10',magnification); + font_subs('\rm\sf',sizeheader+'sf','ss10',magnification); + font_subs('\rm\it',sizeheader+'it','ti10',magnification); + font_subs('\rm\sl',sizeheader+'sl','sl10',magnification); + font_subs('\rm\sc',sizeheader+'sc','csc10',magnification); + font_subs('\rm\tt',sizeheader+'tt','tt10',magnification); + font_subs('\sf',sizeheader+'sf','ss10',magnification); + font_subs('\it',sizeheader+'it','ti10',magnification); + font_subs('\sl',sizeheader+'sl','sl10',magnification); + font_subs('\sc',sizeheader+'sc','csc10',magnification); + font_subs('\tt',sizeheader+'tt','tt10',magnification); + end + ; + end + ; {END IF latex209} + font_subs('\rm\oul',sizeheader+'obf','obx10',magnification); + +end; + +{---------------------------------------------------------------------------} +{ output the correct LaTeX spacing size according to NUMVAL (unit=1/20 pt) } +{ stores it in spacingcode[bracelvl] ; uses the global variable "stdsize" } + +procedure outpsize (numval : integer); +var + ll, selectsize, best_diff: integer; +begin + if base_flag then + begin str_twips_pt(numval,worksa); + spacingcode[bracelvl]:=truncate24('baselineskip'+worksa+'pt'); + end + else + begin + { I select the nearest sizeval -- spacings in twips } + best_diff:=30000; (* big integer *) + spacingcode[bracelvl]:='tiny'; selectsize:=0; + for LL:=1 to numsizes do + begin + if(abs(sizeval[stdkz,ll]-numval) < best_diff) then + begin + spacingcode[bracelvl]:=sizekey[ll]; selectsize:=sizeval[stdkz,ll]; + best_diff:=abs(sizeval[stdkz,ll]-numval); + end + ; {END IF} + end + ; {END DO} + + sign_str(numval,works); sign_str(selectsize,worksa); + print_msg(2,'--> (\par)numval='+works+' selectsize='+worksa+ + ' pkey='+spacingcode[bracelvl]); + end + ; {END IF} +end; + +{---------------------------------------------------------------------------} +{ remove $^ before, and remove math_mode if possible } + +procedure remove_mathat; +begin + if(math_mode[bracelvl]>0) then + begin + if(auto_close[bracelvl]) then + begin outrem('{'); if removed_OK then bracelvl:=bracelvl-1; + end; + outrem('^'); outrem('\relax'); + if(math_mode[bracelvl]=1) then + begin outrem('$'); if(removed_ok) then math_mode[bracelvl]:=0; + end; + end + ; {END IF math_mode} + outrem('{}'); +end; + + +{ --------------------------------------------------------------------------} +{ close brace and decrement bracelvl } + +procedure close_brace; +begin + if(bracelvl <= 0) then + begin sign_str(NUML+1,works); println_msg(0,'Too many } at line '+works); + print_line(0); outstg('}%%%%% *****'); + end + else + if lvlcode[bracelvl]<>6 then + if tex_verbose>1 then + begin sign_str(bracelvl,worksa); sign_str(lvlcode[bracelvl], works); + outstg('\closebr{'+worksa+'['+works+']}\relax'); output_line; + end + ; + bracelvl:=bracelvl-1; +{ reset footnote cleaning } + if(lvlcode[bracelvl]= 3) then lvlcode[bracelvl]:=0; + ; {END IF bracelvl} +end; + +{---------------------------------------------------------------------------} +{ output \end(<arg>) } + +procedure end_env(environ : integer); +begin + output_line; outkeyw('end{'); outstg(environ_type[environ]); outchr('}'); + close_brace; output_line; +end; + +{---------------------------------------------------------------------------} +{ stores a new couple of word font chars and number taken in +decl_font_num which is a global variable } + +procedure store_word_font(font_type : string); +var + k : integer; + new_fnt_name : string[255]; + loc_brace_count : integer; +begin + sign_str(decl_font_num,works); + for k:=1 to num_word_fonts do + if word_font_num[k]=decl_font_num then + begin println_msg(0,'RTF font No. '+works+'/'+font_type+ + ' already declared; this one ignored.'); exit; + end + ; {END/IF + END FOR} + if num_word_fonts >= maxfonts then + begin println_msg(0,'Too many RTF fonts: '+works+ + '/'+font_type+'; this one ignored.'); exit; + end + ; {END IF} + new_fnt_name:=''; loc_brace_count :=0; + while ((kar<>';') and (kar<>'}')) or (loc_brace_count>0) do +(* while (kar<>';') do *) + begin + if kar='{' then loc_brace_count:=loc_brace_count+1; + if kar='}' then loc_brace_count:=loc_brace_count-1; + read_char; if kar<>' ' then new_fnt_name:=new_fnt_name+kar; + end + ; + outrem_empty_braces; num_word_fonts:=num_word_fonts+1; + word_font_num[num_word_fonts]:=decl_font_num; + word_fonts[num_word_fonts]:=truncate24(font_type); + sign_str(num_word_fonts,worksa); + if (pos('Courier',new_fnt_name)>0) then + equiv_fonts[num_word_fonts]:='\tt' + else if (pos('TTY',new_fnt_name)>0) then + equiv_fonts[num_word_fonts]:='\tt' + else if (pos('Helvetica',new_fnt_name)>0) then + equiv_fonts[num_word_fonts]:='\sf' + else if (pos('SansSerif',new_fnt_name)>0) then + equiv_fonts[num_word_fonts]:='\sf' + else + equiv_fonts[num_word_fonts]:='' + ; {END IF} + println_msg(2,worksa+' Font '+works+' stored: "'+font_type+'" = ' + +new_fnt_name); +end; + diff --git a/support/rtflatex/rtflatex.doc b/support/rtflatex/rtflatex.doc new file mode 100644 index 0000000000..ffbbcdc633 --- /dev/null +++ b/support/rtflatex/rtflatex.doc @@ -0,0 +1,74 @@ +Subject: RTFLATEX -- July 25th, 1995 +New release of RTF-to-LaTeX converter (RTFLaTeX), +version 2.14, by Daniel TAUPIN, +Laboratoire de Physique des Solides, 91405 ORSAY, France. + +New features: + -- C source (from p2c) corrected to avoid data overrunning due to a p2c + "feature" ignoring string truncation at assignments, but overwriting + nearby and unpredictable data, + -- font handling conform either to LaTeX2e or to LaTeX209 (option) + -- tables (approximately) converted +Does not convert: + -- pictures + -- equation editor output (this is... unpredictably coded) + -- other features whose semantic is not clear in Microsoft's specifications + +Available at anonymous ftp: rsovax.lps.u-psud.fr + Directory [anonymous.rtf2tex] + + ftp: hprib.lps.u-psud.fr + Directory pub/rtflatex + +Provided as zipped (executable for MS-DOS, Turbopascal source, standard +C and data files) + +Installation +============ +To install it quickly on MS-DOS, put all the RTFLATEX.* files in the same +directory. To get help, execute RTFLATEX without arguments. + +To recompile on MS-DOS, either: + - use Borland's TurboPascal with RTFLATEX.PAS, + - compile "rtflatex.c" with a djgpp/gcc compiler + gcc rtflatex.c -ortflatex -lm -funsigned-char -v + coff2exe -s <the_complete_path>/go32.exe rtflatex + +To recompile on non MS-DOS systems, perform: + cc -funsigned-char -v rtflatex.c -ortflatex + +For final installation, copy or move the rtflatex executable into a directory +of the usual path, and copy or move rtflatex.skw IN THE SAME directory. Put +rtflatex.sty in the usual TEXINPUT directory. + +Bugs and associated features +============================ +WARNING: this is a "(tentatively) quick-and-(less)dirty" trial to +convert RTF although I do not have all specifications. If you find an +\RTFac{xy} in your code just send me a message to say: \'xy should be +converted as \"Z (for example) or as $\something{}$; in this case specify +also whether the coding is \ansi or \mac or something else (look at the +very beginning of the RTF file to find out). + +Secondly, note that Word[perfect] allows anything (bold, teletype, etc.) in +formulae but (La)TeX does not, so you have to look carefully at the way formulae +are transcribed... and correct the output. + +If you find undefined sequences of the form \RTFsomething, think of defining + \def\RTFsomething{} % case of no argument + \def\RTFsomething#1{} % case of one argument +in RTFLATEX.STY if possible... and send me your proposal. You can also +tell rtflatex to skip that sequence explicitely (even better) by inserting +a line being either + \RTFsomething +(no argument) or + \RTFsomethiing{ +(with one opening brace, case of one argument) into the file rtflatex.skw . + + +IMPORTANT: if you just want to convert the text and the equations, but +you do not need to retrieve the initial Word[perfect] layout (paragraph +sizes, line spacings) you have better convert with the "-v" option which +provides a cleaner LaTeX source, easier to correct for your own purposes. + + Daniel TAUPIN diff --git a/support/rtflatex/rtflatex.exe_dos b/support/rtflatex/rtflatex.exe_dos Binary files differnew file mode 100644 index 0000000000..32112d7cdc --- /dev/null +++ b/support/rtflatex/rtflatex.exe_dos diff --git a/support/rtflatex/rtflatex.h b/support/rtflatex/rtflatex.h new file mode 100644 index 0000000000..e44a9ab6e6 --- /dev/null +++ b/support/rtflatex/rtflatex.h @@ -0,0 +1,174 @@ +const + lmx=511; olmx=1023; maxlevel=72; maxkeyln=64; bfslen=24; + numsizes=16; maxfonts=128; maxstyles=12; max_skip_strings=8; maxRTFstyles=64; + RTFstyle_length=128; +type + string24=string[bfslen]; + string2=string[2]; string5=string[5]; string128=string[128]; + string255=string[255]; + exline_type=array[1..olmx] of char; string_RTFstyle=string[RTFstyle_length]; +var + inputfile, outputfile, figurefile, logfile, skipfile : text; + catcode, digit, majusc, letter : array[0..255] of integer; + acc_transl, ftech_transl : array[0..255] of string24; + prev_line, inpline : array[1..lmx] of char; + exline : exline_type; + tex_verbose, verbose, icharz, numl, kout, kinp, prev_kinp, bracelvl : integer; + lvlcode, tab_nb_cellx, tab_nb_ands, tab_cellx : array[0..maxlevel] of integer; + kar, hexaone, hexatwo : char; + next_rtf : string255; + removed_ok, write_log, do_it_again, no_space_conv, use_sl, latex209, + latex_header, base_flag, envir_closed_ok, last_percent, simplify_ok, + no_RTFrtf, par_to_begin : boolean; + num_styles, input_line_number, numfonts, num_word_fonts, stdsize, stdkz : integer; + close_kar, form_code, bfslcode, sizecode, currsize, currbfsl, + spacingcode, active_RTFf : array[0..maxlevel] of string24; + center_flag, flushright_flag, math_mode : array[0..maxlevel] of integer; + underl_flag, auto_close : array[0..maxlevel] of boolean; + sizekey : array[1..numsizes] of string24; + sizeval : array[1..3,1..numsizes] of integer; + sizemags : array[1..3,1..numsizes] of integer; + newfonts, word_fonts, equiv_fonts, font_names : array[1..maxfonts] of string24; + word_font_num : array[1..maxfonts] of integer; + inkeyw : string255; + num_diff_sizes, keyw, cat, ikar, numval, numsign, num_hexa, num_skip_strings : integer; + decl_font_num, num_latex_options, num_indent, i, j, k, l, m, n : integer; + works, worksa, worksb, latex_style, end_math_code : string24; + latex_options : array [0..maxstyles] of string24; + environ_type : array [0..10] of string24; + skip_strings : array [1..max_skip_strings] of string255; + leftskip, rightskip, leftcurskip, rightcurskip, save_skip, space_after, + displ_skip : integer; + RTFstyles : array [1..maxRTFstyles] of string_RTFstyle; + ref_styles : array [0..255] of integer; + + clbrdrr, clbrdrl, clbrdrt, clbrdrb : boolean; + +{ indications to build file names of figure bitmaps } + figure_name, figure_path, figure_type : string128; + pict_name : string24; + rtfpicw, rtfpich, pict_char_number, pict_byte_number : longint; + pict_last_hexa, pict_number : integer; + pict_left_hexa : boolean; + last_kar : char; + + +{---------------------------------------------------------------------------} +{ resets all integers to 0, all strings to '', for safety } + +procedure clean_all; + var + z : integer; + begin + for z:=1 to lmx do prev_line[k]:=' '; + for z:=1 to lmx do inpline[k]:=' '; + for z:=1 to olmx do exline[k]:=' '; + + tex_verbose:=0; verbose:=0; icharz:=0; numl:=0; kout:=0; kinp:=0; + prev_kinp:=0; bracelvl:=0; + + for z:=0 to maxlevel do + begin + lvlcode[z]:=0; tab_nb_cellx[z]:=0; tab_nb_ands[z]:=0; tab_cellx[z]:=0; + end + ; + kar:=' '; hexaone:=' '; hexatwo:=' '; + + next_rtf:=''; + removed_ok:=FALSE; write_log:=FALSE; do_it_again:=FALSE; + no_space_conv:=FALSE; use_sl:=FALSE; latex209:=FALSE; + latex_header:=FALSE; base_flag:=FALSE; envir_closed_ok:=FALSE; + last_percent:=FALSE; simplify_ok:=FALSE; no_RTFrtf:=FALSE; + par_to_begin:=FALSE; + + num_styles:=0; input_line_number:=0; numfonts:=0; num_word_fonts:=0; + stdsize:=0; stdkz:=0; + + for z:=0 to maxlevel do + begin close_kar[z]:=''; form_code[z]:=''; bfslcode[z]:=''; sizecode[z]:=''; + currsize[z]:=''; currbfsl[z]:=''; spacingcode[z]:=''; active_RTFf[z]:=''; + center_flag[z]:=0; flushright_flag[z]:=0; math_mode[z]:=0; + underl_flag[z]:=FALSE; auto_close[z]:=FALSE; + end + ; +(* sizekey : array[1..numsizes] of string24; *) +(* sizeval : array[1..3,1..numsizes] of integer; *) +(* sizemags : array[1..3,1..numsizes] of integer; *) + for z:=1 to maxfonts do + begin + newfonts[z]:=''; word_fonts[z]:=''; equiv_fonts[z]:=''; + font_names[z]:=''; + word_font_num[z]:=0; + end + ; + inkeyw:=''; + num_diff_sizes:=0; keyw:=0; cat:=0; ikar:=0; numval:=0; numsign:=0; + num_hexa:=0; num_skip_strings:=0; + decl_font_num:=0; num_latex_options:=0; num_indent:=0; i:=0; j:=0; + k:=0; l:=0; m:=0; n:=0; + works:=''; worksa:=''; worksb:=''; latex_style:=''; end_math_code:=''; + + for z:=0 to maxstyles do latex_options[z]:=''; + for z:=0 to 10 do environ_type[z]:=''; + for z:=1 to max_skip_strings do skip_strings[z]:=''; + leftskip:=0; rightskip:=0; leftcurskip:=0; rightcurskip:=0; + save_skip:=0; space_after:=0; displ_skip:=0; + + for z:=1 to maxRTFstyles do RTFstyles[z]:=''; + for z:=0 to 255 do ref_styles[z]:=0; + + clbrdrr:=FALSE; clbrdrl:=FALSE; clbrdrt:=FALSE; clbrdrb:=FALSE; + +{ indications to build file names of figure bitmaps } + figure_name:=''; figure_path:=''; figure_type:=''; + pict_name:=''; + rtfpicw:=0; rtfpich:=0; pict_char_number:=0; pict_byte_number:=0; + pict_last_hexa:=0; pict_number:=0; + pict_left_hexa:=FALSE; + last_kar:=' '; + end; + +{---------------------------------------------------------------------------} + +procedure title; + + begin + writeln (' MICROSOFT RTF(Word[Perfect]) to LaTeX conversion'); + writeln (' Daniel Taupin, CNRS, 20th September 1996'); + writeln (' Universite de Paris-Sud, Orsay, France'); + writeln (' Version 2.15'); + writeln (' E-mail: taupin@lps.u-psud.fr'); + end; + +{---------------------------------------------------------------------------} +{ converts a hexa character into a number from 0 to 15 } + +function hx_to_i(kar : char) : integer; +var + ikar, okar : integer; +begin + ikar:=ord(kar); + if(ikar < ord('0')) then okar:=0 + else if (ikar<=ord('9')) then okar:=ikar-ord('0') + else if (ikar<=ord('Z')) then okar:=ikar-ord('A')+10 + else if (ikar<=ord('z')) then okar:=ikar-ord('a')+10 + else okar:=0 + ; {END IF ikar } + hx_to_i:=okar; +end; + +{---------------------------------------------------------------------------} +{ converts a string of two hexa character into a number from 0 to 255 } + +function hs_to_i(input_stg : string2) : integer; +begin + hs_to_i:=16*hx_to_i(input_stg[1])+hx_to_i(input_stg[2]); +end; + +{---------------------------------------------------------------------------} +{ truncate at bfslen a string } + +function truncate24(a: string) : string24; +begin + truncate24:=copy(a,1,bfslen); +end; diff --git a/support/rtflatex/rtflatex.msg b/support/rtflatex/rtflatex.msg new file mode 100644 index 0000000000..7d019d0d24 --- /dev/null +++ b/support/rtflatex/rtflatex.msg @@ -0,0 +1,26 @@ +Subject: RTFLATEX -- July 25th, 1995 +New release of RTF-to-LaTeX converter (RTFLaTeX), +version 2.14, by Daniel TAUPIN, +Laboratoire de Physique des Solides, 91405 ORSAY, France. + +New features: + -- C source (from p2c) corrected to avoid data overrunning due to a p2c + "feature" ignoring string truncation at assignments, but overwriting + nearby and unpredictable data, + -- font handling conform either to LaTeX2e or to LaTeX209 (option) + -- tables (approximately) converted +Does not convert: + -- pictures + -- equation editor output (this is... unpredictably coded) + -- other features whose semantic is not clear in Microsoft's specifications + +Available at anonymous ftp: rsovax.lps.u-psud.fr + Directory [anonymous.rtf2tex] + + ftp: hprib.lps.u-psud.fr + Directory pub/rtflatex + +Provided as zipped (executable for MS-DOS, Turbopascal source, standard +C and data files) + + diff --git a/support/rtflatex/rtflatex.pas b/support/rtflatex/rtflatex.pas new file mode 100644 index 0000000000..4df088e334 --- /dev/null +++ b/support/rtflatex/rtflatex.pas @@ -0,0 +1,1729 @@ +program rtflatex (input, output); (* version 2.15 *) + +uses dos; + +{$I rtflatex.h} +{$I rtflatex.cmn} + + +{---------------------------------------------------------------------------} +{ sets active_RTFf of current bracelvl at the alpha value recorded with kkk +as \F<number> in \fonttbl declaration } + +procedure set_active_RTFf(kkk : integer); +var + k : integer; +begin + for k:=1 to num_word_fonts do + if word_font_num[k]=kkk then + begin sign_str(kkk,works); + println_msg(2,'RTF font No. '+works+' of type '+word_fonts[k]+ + ' "'+equiv_fonts[k]+'"'); + add_to_bfsl(equiv_fonts[k]); ensure_sizebfsl; + active_RTFf[bracelvl]:=word_fonts[k]; exit; + end + ; {END/IF + END FOR} + if (lvlcode[bracelvl] <> 6) then + begin print_line(2); sign_str(num_word_fonts,works); + println_msg(2,'num_word_fonts='+works); + for k:=1 to num_word_fonts do + begin sign_str(word_font_num[k],works); + println_msg(2,' '+works+' --> "'+word_fonts[k]+'"'); + end; + sign_str(kkk,works); print_msg(2,'RTF font No. '+works); + sign_str(lvlcode[bracelvl],works); + sign_str(bracelvl,worksa); + println_msg(2,' font of type unknown, lvlcode['+worksa+']='+works); + sign_str(lvlcode[bracelvl-1],works); + sign_str(bracelvl-1,worksa); + println_msg(2,' font of type unknown, lvlcode['+worksa+']='+works); + end + ; {END IF lvlcode} + active_RTFf[bracelvl]:=''; +end; + +{ ------------------------------------------------------------------------- } +{ closing a \sum(...) ... possibly at a ) found !!!!!} + +procedure close_sum; +begin + close_brace; close_math; +end; + +{ ------------------------------------------------------------------------- } +{ closing a \sum(...) ... possibly at a closing brace if no ) found !!!!!} + +procedure close_sum_emergency(kode : string); +var + k : integer; +begin + sign_str(input_line_number,works); + println_msg(1,'Emergency close of \|su or \|i due to }'+kode+' at inp.line ' + +works); + sign_str(ord(next_rtf[1]),works); + print_msg(1,'pattern : "'+kar+next_rtf[1]+'" '+works); + print_line(1); writeln('kinp=',kinp, ' prev_kinp=',prev_kinp); + for k:=1 to prev_kinp do print_msg(1,prev_line[k]); println_msg(1,' '); + for k:=1 to kinp do print_msg(1,inpline[k]); println_msg(1,' '); + outstg('\emergcA '); close_sum; +end; + + +{ --------------------------------------------------------------------------} +procedure perform_RTFcell; + +begin + if (verbose>0) then + writeln('(found)',inkeyw,'[',lvlcode[bracelvl],',', + tab_nb_ands[bracelvl],',',bracelvl,']'); + if (lvlcode[bracelvl]=15) then + begin + output_real_line; + (* count the number of ampersands in the tabular line *) + tab_nb_ands[bracelvl]:=tab_nb_ands[bracelvl]+1; + if (tab_nb_ands[bracelvl] < tab_nb_cellx[bracelvl]) then + begin + outstg(' & '); + if (verbose>1) then + writeln('(after &)',inkeyw,'[',lvlcode[bracelvl],',', + bracelvl,']'); + end + else + begin outstg('\\'); if clbrdrb then outkeyw('hline '); + if (verbose>1) then + writeln('(after &->\\)',inkeyw,'[',lvlcode[bracelvl],',', + bracelvl,']'); + end + ; + end + else + begin + if (verbose>2) then + writeln(inkeyw,'[',lvlcode[bracelvl],',',bracelvl,']'); + outkeyw('relax'); output_line; (* next line to ensure possible removal *) + outkeyw('RTFcell '); + end + ; {END IF lvlcode} + +end; + +{ --------------------------------------------------------------------------} +{ procedure to close center and flushright environments } + +procedure close_envir; +var + RTF_cell_removed : boolean; +begin + envir_closed_ok:=FALSE; + if center_flag[bracelvl]=2 then + begin + if no_space_conv then + else output_size(spacingcode[bracelvl]) + ; + outkrem('RTFcell '); RTF_cell_removed:=removed_OK; + center_flag[bracelvl]:=0; end_env(1); + if RTF_cell_removed then perform_RTFcell; + output_line; envir_closed_ok:=TRUE; (* output_line; *) + end + else if flushright_flag[bracelvl]=2 then + begin + if no_space_conv then + else output_size(spacingcode[bracelvl]) + ; + outkrem('RTFcell '); RTF_cell_removed:=removed_OK; + flushright_flag[bracelvl]:=0; end_env(2); + if RTF_cell_removed then perform_RTFcell; + output_line; envir_closed_ok:=TRUE; (* output_line; *) + end + ; {END IF center_flag} +end; + +{ --------------------------------------------------------------------------} +(* procedure to perform RTFsb/RTFsa *) + +procedure make_RTFsab (numval : integer); +begin + if(numval > 300) then outkeyw('bigskip{}') + else if(numval > 200) then outkeyw('medskip{}') + else if(numval > 100) then outkeyw('smallskip{}') + else if(numval > 0) then outkeyw('vspace 0.5\smallskipamount{}') + else if(numval < 0) then + begin sign_str(numval,works); println_msg(1,'neg. spacing, NUMVAL:='+works); + end + ; {END IF} +end; + +{ --------------------------------------------------------------------------} +(* procedure to perform RTFpar (separate since it may be delayed after a } *) + +procedure make_RTFpar (texcode : string); +var + k, num_forced : integer; + was_underl : boolean; +begin + num_forced:=0; + while math_mode[bracelvl]>1 do + begin + if lvlcode[bracelvl]=16 then outstg('\relax %%% ???') + else outstg('}\relax %%% !!!') + ; output_line; + close_brace; num_forced:=num_forced+1; + end + ; close_math; + if num_forced>0 then + begin close_envir; output_size(spacingcode[bracelvl]); + output_line; output_line; par_to_begin:=TRUE; + num_indent:=0; + if space_after<>0 then make_RTFsab(space_after); space_after:=0; + sign_str(input_line_number,worksa); sign_str(bracelvl,works); + println_msg(0,'input line '+worksa+', bracelvl='+works); + sign_str(num_forced,works); println_msg(0,'num_forced='+works); + end + ; {END IF} + + was_underl:=underl_flag[bracelvl]; + outkrem(bfslcode[bracelvl]); if was_underl then outchr('}'); output_line; + if no_space_conv then + else output_size(spacingcode[bracelvl]) + ; + close_envir; + if(not (envir_closed_ok or no_space_conv)) then outkeyw('null '); + outstg(texcode); + if space_after<>0 then make_RTFsab(space_after); space_after:=0; + par_to_begin:=TRUE; num_indent:=0; + + if was_underl then outkeyw('underbar{'); + + for k:=1 to num_forced do + begin outchr('{'); bracelvl:=bracelvl+1; + math_mode[bracelvl]:=0; {do not open ??? } + end + ; {END DO} + + sign_str(bracelvl,works); + if num_forced>0 then println_msg(0,'restored bracelvl='+works); +end; + +{ --------------------------------------------------------------------------} +{ replace recent space with a ~ (before : ; ? ! in general } +procedure insert_tilde ( CHARAC : char ); +begin + if math_mode[bracelvl]=0 then + begin outrem(' '); if removed_OK then outchr('~'); + end + ; {END IF} + begin_par; outchr(CHARAC); keyw:=0; +end; + +{ --------------------------------------------------------------------------} +{ initiates "tabular" but does not reset parms to zero } +procedure perform_RTFtrow; + +begin + if (verbose>0) then + writeln('(init row)',inkeyw,'[',lvlcode[bracelvl],',', + bracelvl,']'); + open_brace; lvlcode[bracelvl]:=13; + if (verbose>1) then + writeln(inkeyw,'(after)[',lvlcode[bracelvl],',',bracelvl,']'); + tab_nb_ands[bracelvl]:=0; +end; + + +{ --------------------------------------------------------------------------} +procedure perform_RTFrow; + +begin + if (lvlcode[bracelvl]=15) then + begin + if (verbose>0) then + writeln('\RTFrow[',lvlcode[bracelvl],',',tab_nb_cellx[bracelvl], + ',',bracelvl,']'); + close_brace; outkeyw('end{tabular}\par '); + tab_nb_cellx[bracelvl]:=tab_nb_cellx[bracelvl+1]; + end + else + begin + if (verbose>1) then + writeln('\RTFrow[',lvlcode[bracelvl],',',bracelvl,']'); + output_real_line; outkeyw('RTFrow '); + end + ; {END IF lvlcode} + +end; + + +{ --------------------------------------------------------------------------} +procedure make_closing_brace; +var + pict_byte : char; + already_closed : boolean; +begin + already_closed:=FALSE; + while auto_close[bracelvl] do + begin + if (math_mode[bracelvl]=1) then outchr('$'); outchr('}'); close_brace; + end + ; {END WHILE auto_close} + { check "}{" within \|I(...) and similar : then ignore pair } + if (lvlcode[bracelvl]>=16) and (next_rtf[1]='{') then next_rtf[1]:=chr(0) + else if (form_code[bracelvl]<>'') and (next_rtf[1]='{') then next_rtf[1]:=chr(0) + else + begin +{ special case of \|su(...) closing } + if (lvlcode[bracelvl]=25) then close_sum + else if (lvlcode[bracelvl]>=16) then close_sum_emergency('lvlc') + ; {END IF} + close_math; + + if(lvlcode[bracelvl]=4) then +{ this is footnote first and dummy RTF argument closing brace } + + else if(lvlcode[bracelvl]=5) then +{ this is \RTFpict closing brace } + begin + if (pict_left_hexa) then +{ look whether there is already one hexa digit stored} + begin pict_last_hexa:=16*pict_last_hexa; + pict_byte:=chr(pict_last_hexa); write(figurefile,pict_byte); + pict_byte_number:=pict_byte_number+1; + pict_last_hexa:=0; pict_left_hexa:=FALSE; + end + ; {END IF pict_left_hexa} + + close(figurefile); + print_msg(1,'closed file '+figure_name); sign_str(pict_byte_number,works); + println_msg(1,'('+works+' bytes)'); outchr(kar) + end + else if(lvlcode[bracelvl]=10) then +{ this is \RTFobject closing brace } + begin + println_msg(1,'closed dummy file '+figure_name); + outchr(kar) + end +{ if there was a \cell just before, put it outside the closing brace } + else if last_is('\RTFcell ') then + begin + if (verbose>1) then + writeln('closing}[',lvlcode[bracelvl],',',bracelvl,']'); + outkrem('RTFcell '); + if (not removed_OK) then writeln('*** \RTFcell not removed before } ***'); + outchr(kar); close_brace; already_closed:=TRUE; + if (verbose>0) then + writeln('moved \RTFcell [',lvlcode[bracelvl],',',bracelvl,']'); + perform_RTFcell; + end +{ if there was a \row just before, put it outside the closing brace } + else if last_is('\RTFrow ') then + begin + if (verbose>1) then + writeln('closing}[',lvlcode[bracelvl],',',bracelvl,']'); + outkrem('RTFrow '); + outchr(kar); close_brace; already_closed:=TRUE; + if (verbose>0) then + writeln('moved \RTFrow [',lvlcode[bracelvl],',',bracelvl,']'); + perform_RTFrow; + end + else { this is an ordinary closing brace } + begin +{ if there was a \par just before, put it outside the closing brace } + if last_is('\null \par ') then + begin + outkrem('null \par '); outchr(kar); + if no_space_conv then + outkeyw('par ') + else + outkeyw('null \par ') + ; + end + else if last_is('\par ') then + begin + outkrem('par '); outchr(kar); + outkeyw('par '); + end + else outchr(kar) + ; {ENF IF} + + if (form_code[bracelvl]<>'') then + if (form_code[bracelvl-1]='') then + form_code[bracelvl-1]:=form_code[bracelvl] + else + close_sum_emergency('form') + ; {END IF} + ; {END IF} + end + ; {END IF} + if (not already_closed) then close_brace; + end; + ; {END IF} +end; +{ --------------------------------------------------------------------------} +{ special output of single characters due to \TeX special codings } + +procedure special_TeX_chars; +begin begin_par; + if (kar='$') then outstg('\$') + else if (kar='_') then outstg('\_') + else if (kar='#') then outstg('\#') + else if ((kar='>') or (kar='<')) and (math_mode[bracelvl]=0) then + out_math(kar) + else if (kar='&') then outstg('\&') + else if (kar='%') then outstg('\%') + else if (kar='^') then outstg('\^{ }') + else if (kar='~') then out_math('\sim{}') + else outchr(kar) + ; {END IF} +end; + +{ --------------------------------------------------------------------------} +{ **************** Beginning of RTF decoding procedures ******************* } +{---------------------------------------------------------------------------} +{ treats a character when KEYW is 0 } +{ no keyword decoding presently active } + +procedure keyw_is_0; +var + i,j,k,hexa_digit : integer; + pict_byte: char; + open_kar, RTFform, acc_converted : string24; +begin + if(CAT=0) then { this is a backslash } + begin + if(lvlcode[bracelvl]=3) then +{ ignore after \footnote until opening brace } + else if(lvlcode[bracelvl]=4) then +{ ignore after \footnote { (first brace pair after) } + else if(lvlcode[bracelvl]=9) then + + else + begin keyw:=1; numval:=0; numsign:=1; inkeyw:='\RTF'; + end + ; {END IF} + end + else if(CAT=1) then { this is an opening brace } + begin + if no_RTFrtf then { ignore first opening brace before \rtf1 } + else if(lvlcode[bracelvl]=3) then open_brace + else if(lvlcode[bracelvl]=4) then open_brace + else if(lvlcode[bracelvl]=6) then + begin outchr(kar); open_brace; + end + else + begin if(par_to_begin) then output_size(sizecode[bracelvl]); + make_center; outchr(kar); open_brace; + end + ; {END IF} + end + else if(CAT=2) then { this is a closing brace } + begin close_envir; + if bracelvl>0 then make_closing_brace; + end + else if(CAT=3) then { this is an opening parenthesis '(' } + begin + if (form_code[bracelvl] <> '') then + begin + if form_code[bracelvl]='\RTFformulaB' then + form_code[bracelvl]:=truncate24(form_code[bracelvl]+'BC('); + if form_code[bracelvl]='\RTFformulaBLC' then + form_code[bracelvl]:=truncate24(form_code[bracelvl]+'('); + if form_code[bracelvl]='\RTFformulaBRC' then + form_code[bracelvl]:=truncate24(form_code[bracelvl]+'('); + if form_code[bracelvl]='\RTFformulaBBC' then + form_code[bracelvl]:=truncate24(form_code[bracelvl]+'('); + if pos('\RTFformulaBBC',form_code[bracelvl])>0 then + begin + RTFform:=form_code[bracelvl]; open_kar:=RTFform[length(RTFform)]; + if(open_kar='{') then open_kar:='\{'; + out_math_leave('\left'); outstg(open_kar); outchr(' '); + form_code[bracelvl]:=''; open_brace; + lvlcode[bracelvl]:=16; { special code to close with ) } + if(open_kar='(') then close_kar[bracelvl]:=')' + else if(open_kar='[') then close_kar[bracelvl]:=']' + else if(open_kar='\{') then close_kar[bracelvl]:='\}' + else close_kar[bracelvl]:=open_kar + ; {END IF open_kar} + kar:=' '; { to prevent do_it_again } + end + else if pos('\RTFformulaBLC',form_code[bracelvl])>0 then + begin + RTFform:=form_code[bracelvl]; open_kar:=RTFform[length(RTFform)]; + if(open_kar='{') then open_kar:='\{'; + out_math_leave('\left'); outstg(open_kar); outchr(' '); + form_code[bracelvl]:=''; open_brace; + lvlcode[bracelvl]:=16; { special code to close with ) } + close_kar[bracelvl]:='.'; + kar:=' '; { to prevent do_it_again } + end + else if pos('\RTFformulaBRC',form_code[bracelvl])>0 then + begin + RTFform:=form_code[bracelvl]; open_kar:=RTFform[length(RTFform)]; + if(open_kar='{') then open_kar:='\{'; + out_math_leave('\left. '); + form_code[bracelvl]:=''; open_brace; + lvlcode[bracelvl]:=16; { special code to close with ) } + if(open_kar='(') then close_kar[bracelvl]:=')' + else if(open_kar='[') then close_kar[bracelvl]:=']' + else if(open_kar='\{') then close_kar[bracelvl]:='\}' + else close_kar[bracelvl]:=open_kar + ; {END IF open_kar} + kar:=' '; { to prevent do_it_again } + end + { case of \|F( ... ; ... ) } + else if ('\RTFformulaF'=form_code[bracelvl]) then + begin + form_code[bracelvl]:=''; out_math_leave('{\displaystyle '); + open_brace; lvlcode[bracelvl]:=17; + kar:=' '; { to prevent do_it_again } + end + { case of \|D\|BA() or \|D\|FO() } + else if ('\RTFformulaDFO'=form_code[bracelvl]) then + begin sign_str(displ_skip,worksa); + form_code[bracelvl]:=''; outkeyw('kern '+worksa+'pt'); + open_brace; lvlcode[bracelvl]:=28; + kar:=' '; { to prevent do_it_again } + end + { case of \|D\|LI() } + else if ('\RTFformulaDLI'=form_code[bracelvl]) then + begin sign_str(displ_skip,worksa); form_code[bracelvl]:=''; + outkeyw('RTFhrule '+worksa+'pt'); + open_brace; lvlcode[bracelvl]:=28; + kar:=' '; { to prevent do_it_again } + end + { case of \|O( ... ; ... ) } + else if ('\RTFformulaO'=form_code[bracelvl]) then + begin form_code[bracelvl]:=''; begin_par; + outkeyw('hbox{\ooalign{\hfil{}'); open_brace; + lvlcode[bracelvl]:=26; math_mode[bracelvl]:=0; + kar:=' '; { to prevent do_it_again } + end + { case of \|L( ... ; ... ) } + else if ('\RTFformulaL'=form_code[bracelvl]) then + begin form_code[bracelvl]:=''; begin_par; + outchr('{'); open_brace; + lvlcode[bracelvl]:=27; + kar:=' '; { to prevent do_it_again } + end + { case of \|R( ... ; ... ) } + else if ('\RTFformulaR'=form_code[bracelvl]) then + begin form_code[bracelvl]:=''; + out_math_leave('\sqrt{'); open_brace; + lvlcode[bracelvl]:=23; + kar:=' '; { to prevent do_it_again } + end + { case of \|X( ... ; ... ) } + else if pos('\RTFformulaX',form_code[bracelvl])>0 then + begin form_code[bracelvl]:=''; begin_par; + outstg('\boxed'+copy(form_code[bracelvl],11,3)+'{'); open_brace; + lvlcode[bracelvl]:=7; + kar:=' '; { to prevent do_it_again } + end + { case of \|S( ... ; ... ) } + else if ('\RTFformulaS'=form_code[bracelvl]) or + ('\RTFformulaSUP'=form_code[bracelvl]) then + begin form_code[bracelvl]:=''; + out_math_leave('^{'); open_brace; lvlcode[bracelvl]:=18; + kar:=' '; { to prevent do_it_again } + end + { case of \|SDO( ... ; ... ) } + else if ('\RTFformulaSDO'=form_code[bracelvl]) then + begin form_code[bracelvl]:=''; + out_math_leave('_{'); open_brace; lvlcode[bracelvl]:=19; + kar:=' '; { to prevent do_it_again } + end + { case of \|I( ... ; ... ) } + else if ('\RTFformulaI'=form_code[bracelvl]) then + begin form_code[bracelvl]:=''; + out_math_leave('\int_{'); open_brace; lvlcode[bracelvl]:=20; + kar:=' '; { to prevent do_it_again } + end + { case of \|ISU( ... ; ... ) } + else if ('\RTFformulaISU'=form_code[bracelvl]) then + begin form_code[bracelvl]:=''; + out_math_leave('\displaystyle\sum_{'); open_brace; lvlcode[bracelvl]:=20; + kar:=' '; { to prevent do_it_again } + end + { case of \|IPR( ... ; ... ) } + else if ('\RTFformulaIPR'=form_code[bracelvl]) then + begin form_code[bracelvl]:=''; + out_math_leave('\displaystyle\prod_{'); open_brace; lvlcode[bracelvl]:=20; + kar:=' '; { to prevent do_it_again } + end + ; {END IF} + end + { if an opening parenthese is found inside a deep formula, set lvlcode at 25 } + else if (abs(lvlcode[bracelvl]) >=17) then + begin outchr(kar); open_brace; lvlcode[bracelvl]:=25; + end + else + begin begin_par; outchr(kar); + end + ; {END IF form_code } + end + else if(CAT=4) then { this is a closing parenthesis ')' } + begin + (* test 23 sept *) + while (lvlcode[bracelvl]<0) and (auto_close[bracelvl]) do + begin + if (math_mode[bracelvl]=1) then outchr('$'); outchr('}'); close_brace; + end + ; {END WHILE auto_close} + (* fin test 23 sept *) + { special case of \|B..(...) closing } + if (lvlcode[bracelvl]=16) then + begin outstg('\right'); outstg(close_kar[bracelvl]); close_sum; + end + { special case of \|X..(...) closing } + else if (lvlcode[bracelvl]=7) then + begin outchr('}'); close_sum; + end + { closing parenthese found inside a formula, was opened with another ( 25 } + else if (lvlcode[bracelvl]=25) then + begin outchr(kar); close_brace; + end + { closing parenthese found inside a formula \|O } + else if (lvlcode[bracelvl]=26) then + begin close_math; outstg('\hfil}}'); close_brace; + end + { closing parenthese found inside a formula \|L } + else if (lvlcode[bracelvl]=27) then + begin outchr('}'); close_brace; + end + { closing parenthese found inside a formula \|D } + else if (lvlcode[bracelvl]=28) then + begin outstg('{}'); close_brace; + end + { special case of \|F(...) closing } + { special case of \|S(...) closing } + { special case of \|SDO(...) closing } + { special case of \|I(...) closing } + { special case of \|I(..;..) closing } + { special case of \|I(..;..;..) closing } + { special case of \|R(...) closing } + else if (lvlcode[bracelvl]>=17) then + begin close_subs; close_sum; + end + { closing parenthese found inside a deep formula, make it 1 level lower } + else if (-lvlcode[bracelvl]>=17) then + begin next_rtf:='}){'+next_rtf; + end + else + begin begin_par; outchr(kar); + end + ; {END IF lvlcode} + end +{ Ignore chars to be ignored } + else if(lvlcode[bracelvl]=1) then + + else if(lvlcode[bracelvl]=3) then + + else if(lvlcode[bracelvl]=4) then + + else if(lvlcode[bracelvl]=5) then { we are in the hexa part of a \RTFpict } + begin + { ignore possible blanks and control characters within hexadecimal field } + if ord(kar)>32 then + begin hexa_digit:=hx_to_i(kar); + pict_char_number:=pict_char_number+1; + if (pict_left_hexa) then +{ there is already one hexa digit stored} + begin pict_last_hexa:=16*pict_last_hexa+hexa_digit; + pict_byte:=chr(pict_last_hexa); write(figurefile,pict_byte); + pict_byte_number:=pict_byte_number+1; + pict_last_hexa:=0; pict_left_hexa:=FALSE; + end + else +{ there is no hexa digit stored} + begin pict_last_hexa:=hexa_digit; last_kar:=kar; pict_left_hexa:=TRUE; + end + ; {END IF pict-left_hexa} + end + ; {END IF} + end + else if(abs (lvlcode[bracelvl])=10) then { we are in \RTFobject } + + else if(abs (lvlcode[bracelvl])=9) then { ignore other than braces } + + else if(cat=11) then { this is a letter } + begin begin_par; + if (lvlcode[bracelvl]=2) then { letters to be capitalized ? } + begin kar:=upcase(kar); ikar:=ord(kar); + end + ; {END IF lvlcode=2} + if (active_RTFf[bracelvl]='ftech') then + begin acc_converted:=ftech_transl[ikar]; + if acc_converted <> '' then out_math(acc_converted) + else outchr(kar) + ; {END IF acc_converted} + end + else + begin + outrem('\beginparagraph{}'); + if(removed_OK and (kout>0)) then outstg('{}'); + outchr(kar); + end + ; {END IF active_RTF} + end + else if (active_RTFf[bracelvl]='ftech') then + begin begin_par; acc_converted:=ftech_transl[ikar]; + if acc_converted <> '' then out_math(acc_converted) + else special_TeX_chars + ; {END IF acc_converted} + end + else if (kar='-') then + begin + if (last_is('\beginparagraph{}')) then + begin + outrem('\beginparagraph{}'); + outkeyw('plainitem{--}'); + end + else + outchr(kar) + ; {END IF} + end + else if(kar='"') then + begin begin_par; (* test march 94 *) + if (math_mode[bracelvl]=0) and ((kout=0) or last_is(' ')) then + outstg('``') + else outstg('''''') + ; {END IF} + end + else if(kar=';') then + begin +{ ignore ; in colortbl section } + if (lvlcode[bracelvl]=9) then +{ special case of \|F(. ; .) intermediate semi-colon } + else if (lvlcode[bracelvl]=17) then + outstg(' \over\displaystyle ') +{ special case of \|S(. ; .) intermediate semi-colon } + else if (lvlcode[bracelvl]=18) then + begin close_subs; out_math_leave(' _{'); + end +{ special case of \|SDO(. ; .) intermediate semi-colon } + else if (lvlcode[bracelvl]=19) then + begin close_subs; out_math_leave(' ^{'); + end +{ special case of \|I(. ; .) intermediate semi-colon } + else if (lvlcode[bracelvl]=20) then + begin close_subs; outstg(' ^{'); lvlcode[bracelvl]:=21; + end +{ special case of \|su(. ; .) second intermediate semi-colon } + else if (lvlcode[bracelvl]=21) then + begin close_subs; outchr('{'); lvlcode[bracelvl]:=22; + end +{ special case of \|R(. ; .) intermediate semi-colon } + else if (lvlcode[bracelvl]=23) then + begin outsubstitute('\sqrt{','\root{'); + outstg('}\of{'); lvlcode[bracelvl]:=24; output_line; (* safety *) + end +{ special case of \|O(. ; .) intermediate semi-colon } + else if (lvlcode[bracelvl]=26) then outstg('\hfil\crcr\hfil{}') +{ special case of \|L(. ; .) intermediate semi-colon } + else if (lvlcode[bracelvl]=27) then outchr(',') + else outchr(kar) + ; {END IF} + end + else + special_TeX_chars + ; {END IF active_RTF} +end; + +{---------------------------------------------------------------------------} +{ treats a character when KEYW is 1 } +{ Keyword being decoded, we are just after the BACKSLASH } + +procedure keyw_is_1; +begin + if(cat=11) then + begin { letter : store and say KEYW:=2 } + inkeyw:=inkeyw+kar; keyw:=2 ; + end + else if(cat=16) then + begin { case of a digit : store \RTF } + outrem_empty_braces; outstg(inkeyw); outchr(KAR); keyw:=0; + end +(* turn \{ into \RTFaccol and... try to continue ! *) + else if(kar='{') then + begin out_math('\{'); keyw:=0; + (* inkeyw:=inkeyw+'accol '; keyw:=2 ; *) + end +(* turn \} into \RTFlocca and... try to continue ! *) + else if(kar='}') then + begin out_math('\}'); keyw:=0; + (* inkeyw:=inkeyw+'locca '; keyw:=2 ; *) + end + else if(kar='(') then + begin begin_par; outkeyw('RTFparen '); keyw:=0; + end + else if(kar='-') then + begin +{ case of a word cutting hyphen \- } + begin_par; outkeyw(KAR); keyw:=0; + end + else if(kar='*') then + begin + if (abs(lvlcode[bracelvl])<10) or (abs(lvlcode[bracelvl])>12) then + begin begin_par; outchr(KAR); + end + ; keyw:=0; {END IF} + end + else if(kar='_') then + begin +{ case of a word non cutting hyphen \_ } + begin_par; outchr('-'); keyw:=0; + end + else if(kar='~') then + begin +{ case of a non breaking space } + begin_par; outchr(KAR); keyw:=0; + end + else if(kar='''') then + begin keyw:=4; num_hexa:=0; + end + else if(kar=':') then insert_tilde(kar) + else if(kar=';') then insert_tilde(kar) + else if(kar=')') then + begin begin_par; outchr(kar); + end + else if(kar='(') then + begin begin_par; outchr(kar); + end + else if(kar='\') then + begin + if (next_rtf[1]='f') and (lvlcode[bracelvl]=12) then + lvlcode[bracelvl]:=9 + else + begin + begin_par; outstg('{\char92}'); keyw:=0; + end + ; + end + else if(kar='|') then + if next_rtf[1]='}' then + (* if \|} cancel \| and post it for later *) + begin inkeyw:=''; keyw:=0; + delete(next_rtf,1,1); next_rtf:='}\|'+next_rtf; + end + else + begin +{ case of \| (in formulae) store as "formula" and expect letters } + inkeyw:=inkeyw+'formula'; keyw:=2; + end + else + begin +{ store \RTF and try again } + outkeyw('RTF{}'); keyw:=0; do_it_again:=TRUE; + end + ; {END IF} +end; + + +{---------------------------------------------------------------------------} +{ treats a character when KEYW is 2 } +{ We are in a letter keyword } + +procedure keyw_is_2; +var + poskeyw, k, num_forced, posbsl, font_equiv_spacing, testio : integer; + inkeywb : string24; +begin + if(cat=11) then + begin +{ letter : store and capitalize for formulas } + if (pos('\RTFformula',inkeyw)>0 ) then + inkeyw:=inkeyw+upcase(kar) + else inkeyw:=inkeyw+kar + ; {END IF} + end + else if(cat=16) then + begin +{ case of a digit : store with opening brace and say KEYW:=3 } + inkeyw:=inkeyw+'{'+kar; + numval:=ord(kar)-icharz; numsign:=1; keyw:=3; + end + else if(kar='-') then + begin +{ case of a - introduction : store opening brace and say KEYW:=3 } + inkeyw:=inkeyw+'{-'; numval:=0; numsign:=-1; keyw:=3; + end + else + begin +{ delay \begin(center) to further opening \par } + if(inkeyw='\RTFqc') then + begin if (lvlcode[bracelvl]<>9) then + begin center_flag[bracelvl]:=1; + end + end +{ delay \begin(flushright) to further opening \par } + else if(inkeyw='\RTFqr') then + begin if (lvlcode[bracelvl]<>9) then flushright_flag[bracelvl]:=1; + end +{ interpret some other keywords } + else if(inkeyw='\RTFtab') then + begin + if par_to_begin then num_indent:=num_indent+1 + else outkeyw('indent ') + ; + end + else if(inkeyw='\RTFchpgn') then + begin begin_par; outkeyw('the\count0{}') + end + else if(inkeyw='\RTFb') then + begin add_to_bfsl('\bf'); ensure_sizebfsl; + end + else if(inkeyw='\RTFscaps') then + begin add_to_bfsl('\sc'); ensure_sizebfsl; + end + else if(inkeyw='\RTFoutl') then + begin add_to_bfsl('\oul'); ensure_sizebfsl; + end + else if(inkeyw='\RTFul') then + begin outrem('{'); + if removed_OK then + if math_mode[bracelvl]=0 then + begin begin_par; outkeyw('underbar{'); + end + else + begin begin_par; outkeyw('underline{'); + end + else + outkeyw('RTFul{}') + ; {END IF removed_OK} + ; underl_flag[bracelvl]:=TRUE + end + else if(inkeyw='\RTFuldb') then + begin outrem('{'); + if removed_OK then + if math_mode[bracelvl]=0 then + begin begin_par; outkeyw('underbar{\bf{}'); + end + else + begin begin_par; outkeyw('underline{'); + end + else + outkeyw('RTFuldb{}') + ; {END IF removed_OK} + ; underl_flag[bracelvl]:=TRUE + end + else if(inkeyw='\RTFv') then + begin outrem('{'); + if removed_OK then + begin begin_par; outkeyw('index{'); + end + else + outkeyw('RTFul{}') + ; {END IF removed_OK} + ; underl_flag[bracelvl]:=TRUE + end + else if(pos('\RTFheader',inkeyw)+pos('\RTFfooter',inkeyw)>0) then + begin outrem('{'); + if removed_OK then outkeyw(copy(inkeyw,2,999)+'{') + else outkeyw(copy(inkeyw,2,999)+'{\relax}') + ; {END IF removed_OK} + lvlcode[bracelvl]:=9; + end + else if(inkeyw='\RTFi') then + begin + if use_sl then add_to_bfsl('\sl') + else add_to_bfsl('\it') + ; {END IF} + ensure_sizebfsl; + end + else if(inkeyw='\RTFpard') then + begin (* old center_flag[bracelvl]:=0; flushright_flag[bracelvl]:=0; *) + close_math; close_envir; + center_flag[bracelvl]:=0; flushright_flag[bracelvl]:=0; + bfslcode[bracelvl]:='\rm'; + + if (abs(lvlcode[bracelvl])<>8) and (abs(lvlcode[bracelvl])<>9) + and (lvlcode[bracelvl]<>13) and (lvlcode[bracelvl]<>15) then + begin + leftskip:=0; rightskip:=0; + num_indent:=0; par_to_begin:=TRUE; + if last_is('\end{tabular}\par ') then + else (* never cut line+\check after \end{tabular} *) + begin + if (KOUT>0) then output_line; + outstg(' %\check '); output_line; (* for testing *) + end + ; + end + ; {END IF} + if lvlcode[bracelvl]=2 then lvlcode[bracelvl]:=0; + end + else if(inkeyw='\RTFpar') then + begin + if next_rtf[1]='}' then + begin inkeyw:=''; + delete(next_rtf,1,1); next_rtf:='}\par '+next_rtf; + end + else make_RTFpar('\par ') + ; {END IF next_rtf[1]} + end + else if(inkeyw='\RTFpagebb') then + begin + if next_rtf[1]='}' then + begin inkeyw:=''; + delete(next_rtf,1,1); next_rtf:='}\pagebb '+next_rtf; + end + else make_RTFpar('\clearpage ') + ; {END IF next_rtf[1]} + end + else if(inkeyw='\RTFpage') then + begin + if next_rtf[1]='}' then + begin inkeyw:=''; + delete(next_rtf,1,1); next_rtf:='}\page '+next_rtf; + end + else + begin output_size(spacingcode[bracelvl]); + outkeyw('break\eject\noindent '); output_size(sizecode[bracelvl]); + output_bfsl; + end + ; {END IF next_rtf[1]} + end + else if(inkeyw='\RTFsect') then + begin + if next_rtf[1]='}' then + begin inkeyw:=''; + delete(next_rtf,1,1); next_rtf:='}\par '+next_rtf; + end + else make_RTFpar('\par \relax ') + ; {END IF next_rtf[1]} + end + else if(inkeyw='\RTFrquote') then outchr('''') + else if(inkeyw='\RTFlquote') then outchr('`') + else if(inkeyw='\RTFmac') then mac_init + else if(inkeyw='\RTFansi') then ansi_init + else if(inkeyw='\RTFline') then outkeyw('break ') +{ flag to say future capitalized } + else if(inkeyw='\RTFcaps') then lvlcode[bracelvl]:=2 +{ flag to say we are in \fonttbl block } + else if(inkeyw='\RTFfonttbl') then + begin lvlcode[bracelvl]:=6; outrem_empty_braces; + outkrem(sizecode[bracelvl]); outrem('{'); + if removed_OK then outkeyw('RTFfonttbl{') + else outkeyw('RTFfonttbl{}{}{}\relax ') + ; {END IF} + end + else if(inkeyw='\RTFcolortbl') then + begin outrem_empty_braces; lvlcode[bracelvl]:=9; + outkrem(sizecode[bracelvl]); outrem('{'); + if removed_OK then outkeyw('RTFcolortbl{') + else outkeyw('RTFcolortbl{}{}{}\relax ') + ; {END IF} + end + else if(inkeyw='\RTFinfo') then + begin outrem_empty_braces; + outkrem(sizecode[bracelvl]); outrem('{'); + if removed_OK then outkeyw('RTFinfo{') + else outkeyw('RTFinfo{}{}{}\relax ') + ; {END IF} + end + else if(inkeyw='\RTFstylesheet') then + begin outrem_empty_braces; + outkrem(sizecode[bracelvl]); outrem('{'); + if removed_OK then + begin outkrem('RTFcolortbl{}'); outkeyw('RTFstylesheet{'); + end + else outkeyw('RTFstylesheet{}{}{}\relax ') + ; {END IF} + lvlcode[bracelvl]:=8; + end + else if(inkeyw='\RTFfield') then + lvlcode[bracelvl]:=11 + else if(inkeyw='\RTFflddirty') then + + else if(pos('\RTFfldinst',inkeyw)>0) and (lvlcode[bracelvl-1]=11) then + begin lvlcode[bracelvl]:=12; exit; (* to avoid resetting keyw:=0 *) + end + else if(inkeyw='\RTFtrowd') then + begin + perform_RTFtrow; + outkeyw('begin{tabular}{'); + clbrdrr:=FALSE; clbrdrl:=FALSE; clbrdrt:=FALSE; clbrdrb:=FALSE; + tab_nb_cellx[bracelvl]:=0; + tab_cellx[bracelvl]:=0; + end + else if(inkeyw='\RTFbrdrs') and (lvlcode[bracelvl]=13) then + (* ignore *) + else if(inkeyw='\RTFclbrdrl') and (lvlcode[bracelvl]=13) then + begin outchr('|'); + if (verbose>1) then + writeln(inkeyw,'[',lvlcode[bracelvl],',',bracelvl,']'); + clbrdrl:=FALSE; + end + else if(inkeyw='\RTFclbrdrr') and (lvlcode[bracelvl]=13) then + begin + if (verbose>1) then + writeln(inkeyw,'[',lvlcode[bracelvl],',',bracelvl,']'); + clbrdrr:=TRUE; + end + else if(inkeyw='\RTFclbrdrt') and (lvlcode[bracelvl]=13) then + begin + if (verbose>1) then + writeln(inkeyw,'[',lvlcode[bracelvl],',',bracelvl,']'); + clbrdrt:=TRUE; + end + else if(inkeyw='\RTFclbrdrb') and (lvlcode[bracelvl]=13) then + begin + if (verbose>1) then + writeln(inkeyw,'[',lvlcode[bracelvl],',',bracelvl,']'); + clbrdrb:=TRUE; + end + else if(inkeyw='\RTFintbl') then + begin + if (verbose>0) then + writeln('(found)',inkeyw,'[',lvlcode[bracelvl],',',bracelvl,']'); + if (lvlcode[bracelvl]=13) then + begin if clbrdrr then outchr('|'); clbrdrr:=FALSE; outchr('}'); + lvlcode[bracelvl]:=15; (* second part of \RTFtrowd *) + if clbrdrt then + begin outkeyw('hline'); output_line; + end + ; + tab_nb_ands[bracelvl]:=0; + if (verbose>1) then + writeln('(after)',inkeyw,'[',lvlcode[bracelvl],',', + bracelvl,']'); + end + else if (lvlcode[bracelvl]=15) then + begin + if (verbose>1) then + writeln('(ignored)',inkeyw,'[',lvlcode[bracelvl],',',bracelvl,']'); + end + else (* force \RTFtrowd if missing *) + begin + if (verbose>0) then + writeln('forcing\RTFtrowd',inkeyw,'[', + lvlcode[bracelvl],',',bracelvl,']'); + if last_is('\\\end{tabular}\par ') then + outkrem('end{tabular}\par ') + else if last_is('\\\hline \end{tabular}\par ') then + outkrem('end{tabular}\par ') + else if last_is('\end{tabular}\par ') then + begin + outkrem('end{tabular}\par '); outstg('\\'); + if clbrdrb then outkeyw('hline '); + end + else + outkeyw('begin{tabular}{ppppppppppppppp}') + ; {END IF last_is(...)} + perform_RTFtrow; + lvlcode[bracelvl]:=15; (* second part of \RTFtrowd *) + if (verbose>1) then + writeln('(<after)',inkeyw,'[',lvlcode[bracelvl],',', + tab_nb_cellx[bracelvl],',',bracelvl,']') + {END IF verbose}; + end + ; + end + else if(inkeyw='\RTFrow') then + begin + perform_RTFrow; + end + else if(inkeyw='\RTFcell') then + begin + perform_RTFcell; + end + else if(inkeyw='\RTFobject') then + begin + rtfpicw:=0; rtfpich:=0; { reset picture width and height to 0 } + pict_char_number:=0; pict_byte_number:=0; + pict_last_hexa:=0; { reset last hexa byte of the picture } + pict_left_hexa:=FALSE; pict_number:=pict_number+1; { count picture number } + sign_str(pict_number,pict_name); + figure_name:=figure_path+pict_name+figure_type; + while (pos('\',figure_name)>0) do + begin + posbsl:=pos('\',figure_name); figure_name[posbsl]:='/'; + end + ; {END DO} + begin_par; outkeyw(copy(inkeyw,2,99)+'{'+figure_name+'}'); + figure_name:=figure_path+pict_name+figure_type; + output_line; + println_msg(1,'Skipped object file '+figure_name); + lvlcode[bracelvl]:=10; + end + else if(inkeyw='\RTFpict') then + begin + rtfpicw:=0; rtfpich:=0; { reset picture width and height to 0 } + pict_char_number:=0; pict_byte_number:=0; + pict_last_hexa:=0; { reset last hexa byte of the picture } + pict_left_hexa:=FALSE; pict_number:=pict_number+1; { count picture number } + sign_str(pict_number,pict_name); + figure_name:=figure_path+pict_name+figure_type; + while (pos('\',figure_name)>0) do + begin + posbsl:=pos('\',figure_name); figure_name[posbsl]:='/'; + end + ; {END DO} + begin_par; outkeyw(copy(inkeyw,2,99)+'{'+figure_name+'}'); + figure_name:=figure_path+pict_name+figure_type; + output_line; + {$I-} + assign(figurefile,figure_name); rewrite(figurefile); testio:=ioresult; + if (testio <> 0) then + begin sign_str(testio,works); + println_msg(0,'Unable to open figure file '+figure_name + +' ; code='+works); + close_files; halt; + end + ; {ENF IF testio} + {$I+} + println_msg(1,'Opened picture file '+figure_name); + lvlcode[bracelvl]:=5; + end + else if(inkeyw='\RTFfootnote') then + begin + if math_mode[bracelvl]=0 then + begin lvlcode[bracelvl]:=3; outrem('{'); + if removed_OK then outkeyw('footnote{') + else outkeyw('footnote ') + ; {END IF removed} + end + else if math_mode[bracelvl]=1 then + begin close_math; + next_rtf:='\footnote '+next_rtf + end + else if math_mode[bracelvl-1]=1 then + next_rtf:='}{\footnote '+next_rtf + else if (bracelvl>=2) and (math_mode[bracelvl-2]=1) then + next_rtf:='}}{{\footnote '+next_rtf + else if (bracelvl>=3) and (math_mode[bracelvl-3]=1) then + next_rtf:='}}}{{{\footnote '+next_rtf + else outkeyw('footnote ') + ; {END IF math_mode} + end + else if(inkeyw='\RTFplain') then + begin outpsize(20*stdsize); + bfslcode[bracelvl]:='\rm'; + sizecode[bracelvl]:='normalsize'; + end + else if(inkeyw='\RTFchftn') then + begin remove_mathat; + end + else if(inkeyw='\RTFendash') then + if(math_mode[bracelvl]>0) then outchr('-') + else outstg('--') + else if(inkeyw='\RTFemdash') then + if(math_mode[bracelvl]>0) then outchr('-') + else outstg('---') + else if(inkeyw='\RTFfnil') then + store_word_font('fnil') { decl_font_num is a global variable } + else if(inkeyw='\RTFfroman') then + store_word_font('froman') + else if(inkeyw='\RTFfmodern') then + store_word_font('fmodern') + else if(inkeyw='\RTFfdecor') then + store_word_font('fdecor') + else if(inkeyw='\RTFfswiss') then + store_word_font('fswiss') + else if(inkeyw='\RTFfscript') then + store_word_font('fscript') + else if(inkeyw='\RTFftech') then + store_word_font('ftech') + else if(inkeyw='\RTFformulaB') then + form_code[bracelvl]:=truncate24(inkeyw) + else if(inkeyw='\RTFformulaO') then + form_code[bracelvl]:=truncate24(inkeyw) + else if(inkeyw='\RTFformulaLC') then + form_code[bracelvl]:=truncate24(form_code[bracelvl]+'LC') + else if(inkeyw='\RTFformulaRC') then + form_code[bracelvl]:=truncate24(form_code[bracelvl]+'RC') + else if(inkeyw='\RTFformulaBC') then + form_code[bracelvl]:=truncate24(form_code[bracelvl]+'BC') + else if(inkeyw='\RTFformulaF') then + form_code[bracelvl]:=truncate24(inkeyw) + else if(inkeyw='\RTFformulaR') then + form_code[bracelvl]:=truncate24(inkeyw) + else if(inkeyw='\RTFformulaS') then + form_code[bracelvl]:=truncate24(inkeyw) + else if(inkeyw='\RTFformulaD') then + form_code[bracelvl]:=truncate24(inkeyw) + else if(inkeyw='\RTFformulaX') then + form_code[bracelvl]:=truncate24(inkeyw) + else if(inkeyw='\RTFformulaI') then + form_code[bracelvl]:=truncate24(inkeyw) + else if(inkeyw='\RTFformulaSU') then + form_code[bracelvl]:=truncate24(form_code[bracelvl]+'SU') + else if(inkeyw='\RTFformulaPR') then + form_code[bracelvl]:=truncate24(form_code[bracelvl]+'PR') + else if(inkeyw='\RTFformulaIN') then + form_code[bracelvl]:=truncate24(form_code[bracelvl]+'IN') + else if(inkeyw='\RTFformulaRI') then + form_code[bracelvl]:=truncate24(form_code[bracelvl]+'RI') + else if(inkeyw='\RTFformulaBO') then + form_code[bracelvl]:=truncate24(form_code[bracelvl]+'BO') + else if(inkeyw='\RTFformulaLE') then + form_code[bracelvl]:=truncate24(form_code[bracelvl]+'LE') + else if(inkeyw='\RTFformulaTO') then + form_code[bracelvl]:=truncate24(form_code[bracelvl]+'TO') +{ case of \|<non-alpha> } + else if(inkeyw='\RTFformula') then + begin + if (CAT=0) and (next_rtf[1]='{') then + begin form_code[bracelvl]:=truncate24(form_code[bracelvl]+'{'); + kar:=' '; next_rtf[1]:=chr(0); { to prevent do_it_again } + end + else if (CAT=0) and (next_rtf[1]='}') then + begin form_code[bracelvl]:=truncate24(form_code[bracelvl]+'}'); + kar:=' '; next_rtf[1]:=chr(0); { to prevent do_it_again } + end + else + begin form_code[bracelvl]:=truncate24(form_code[bracelvl]+kar); + kar:=' '; { to prevent do_it_again } + end + ; {END IF} + end +(* case of \{ *) + else if(inkeyw='\RTFaccol ') then out_math('\{') +(* case of \} *) + else if(inkeyw='\RTFlocca ') then out_math('\}') + else + begin poskeyw:=0; inkeywb:=truncate24(inkeyw+' '); +(* check whether this keyword should be skipped in output *) + for k:=1 to num_skip_strings do + poskeyw:=poskeyw+pos(inkeyw,skip_strings[k]) + ; {END DO} +{ output other keywords with an additional space } + if poskeyw=0 then + begin outrem_empty_braces; outstg(inkeyw); +{ do not put a space if following is a (, for TeX macros syntax } + if kar <> '(' then outchr(' '); + end + ; {END IF poskeyw} + end + ; {END IF} +{ reset KEYW and try again } + keyw:=0; if(kar <> ' ') then do_it_again:=TRUE; + end + ; {END IF cat=11} +end; + +{---------------------------------------------------------------------------} +{ treats a character when KEYW is 3 } +{ Numeric arg of Keyword being decoded } + +procedure keyw_is_3; +var + sizeheader : string24; { will be 'large', 'Large', 'footnotesize'... } + magnification : integer; { will be 1000, 1095, 900... } + diff_cellx, style_ref, poskeyw, k, posmod : integer; + acc_converted, inkeywb, newfont : string24; + test_RTFstyle : string_RTFstyle; +begin + if(cat=16) then +{ case of a digit } + begin inkeyw:=inkeyw+kar; numval:=10*numval+numsign*(ord(kar)-icharz); + end + else + begin +{ case of a non digit: terminate but ignore some keywords with brace pairs } + if(pos('RTFsl{',inkeyw) > 0) then + begin outpsize(numval); sign_str(numval,works); + println_msg(2,'\RTFsl{'+works+'} --> \'+spacingcode[bracelvl]); + end + else if(pos('RTFli{',inkeyw) > 0) and (center_flag[bracelvl]<2) then + begin + if lvlcode[bracelvl]<>8 then leftskip:=numval + ; {END IF} + end + else if(pos('RTFri{',inkeyw) > 0) and (center_flag[bracelvl]<2) then + begin + if lvlcode[bracelvl]<>8 then rightskip:=numval + ; {END IF} + end + else if(pos('RTFf{',inkeyw) > 0) then + begin decl_font_num:=numval; { store numval for further use } + set_active_RTFf(numval); outstg('{}'); + end +{ use _ and ^ for sub/superscripts and put in math mode if needed } + else if(pos('RTFup{',inkeyw) > 0) then + begin + out_math_leave('\relax^{'); open_brace; auto_close[bracelvl]:=TRUE; + end + else if(pos('RTFdn{',inkeyw) > 0) then + begin + out_math_leave('\relax_{'); open_brace; auto_close[bracelvl]:=TRUE; + end +{ ignore \RTFfi if option '-v' } + else if (pos('RTFfi{',inkeyw) > 0) then + begin + num_indent:=1; + if (no_space_conv) and(numval>0) then + else + begin outkeyw('parindent='); output_num(numval); + outkeyw('RTFtwips'); output_line; + end + ; + end +{ style description } + else if(pos('RTFs{',inkeyw) > 0) then + begin sign_str(numval,works); + if (abs(lvlcode[bracelvl])=8) then + begin + if num_styles>=maxRTFstyles then + println_msg(0,'Too many styles, style '+works+' ignored.') + else if numval>255 then + println_msg(0,'Illegal style number, style '+works+' ignored.') + else + begin num_styles:=num_styles+1; ref_styles[numval]:=num_styles; + test_RTFstyle:=kar; + while (kar<>';') and (kar<>'}') do + begin read_char; test_RTFstyle:=test_RTFstyle+kar; + end + ; {END while} +(* clean style to the first blank after \snext *) + if kar=';' then kar:=' '; + k:=pos('\snext',test_RTFstyle); + m:=length(test_RTFstyle); + for l:=k to length(test_RTFstyle) do + begin if (test_RTFstyle[l]=' ') and (l<m) then m:=l; + end + ; sign_str(num_styles,worksa); +(* start at the first space in style text *) + n:=pos(' ',test_RTFstyle)+1; + RTFstyles[num_styles]:=copy(test_RTFstyle,n,m-n+1); + println_msg(2,works+' --> '+worksa+' "'+ + RTFstyles[num_styles]+'"'); + end + ; {END IF} + end + else + begin style_ref:=ref_styles[numval]; + if (style_ref<=0) or (style_ref>255) then + println_msg(0,'Illegal style number, style '+works+' ignored.') + else + begin if kar<>' ' then next_rtf:=kar+next_rtf; + kar:=' '; next_rtf:=RTFstyles[style_ref]+next_rtf; + end + ; {END IF} + end + ; {END IF} + end +{ font size description } + else if(pos('RTFfs{',inkeyw) + pos('RTFfldinstfs{',inkeyw) > 0) + and (lvlcode[bracelvl]<>8) then + begin +{ before putting \LARGE, \Huge etc., remove previous \bf, \rm, etc. } + outrem_empty_braces; outrem(bfslcode[bracelvl]); + +{ output \large, \normalsize, \footnotesize according to NUMVAL } + outfsize(numval, magnification); + + sizeheader:=truncate24('\'+sizecode[bracelvl]); + if(sizeheader='\footnotesize') then sizeheader:='\footnsize'; + +(* correct font names in bfslcode[bracelvl] according to latex209 or latex2e *) + font_clean(sizeheader,magnification); + + if (not par_to_begin) then + begin output_size(sizecode[bracelvl]); + output_bfsl; + if last_is('}') then + else if last_is('{') then + else outstg('{}') + ; {END IF} + end + ; {END IF} + end + else if(pos('RTFsb{',inkeyw) > 0) then + begin outkrem('par'); outkrem('par '); + if(lvlcode[bracelvl]<>8) and (lvlcode[bracelvl]<>9) then outkeyw('par '); + make_RTFsab(numval); + end + else if(pos('RTFsa{',inkeyw) > 0) then save_skip:=numval + else if(pos('RTFtrleft{',inkeyw) > 0) then (* en attente *) + else if(pos('\RTFcellx{',inkeyw)>0) and (lvlcode[bracelvl]=13) then + begin + (* \RTCcellx gives absolutes abscissae, but tabular's p{} needs differences *) + diff_cellx:=numval-tab_cellx[bracelvl]; + outstg('p{'); output_num(diff_cellx); outstg('\RTFtwips}'); + if clbrdrl then outchr('|'); clbrdrl:=FALSE; + tab_nb_cellx[bracelvl]:=tab_nb_cellx[bracelvl]+1; + tab_cellx[bracelvl]:=numval; + end + else if(pos('RTFpicw{',inkeyw) > 0) then + begin inkeyw:=inkeyw+'}'; outrem_empty_braces; outstg(inkeyw); + rtfpicw:=NUMVAL; + end + else if(pos('RTFpich{',inkeyw) > 0) then + begin inkeyw:=inkeyw+'}'; outrem_empty_braces; outstg(inkeyw); + rtfpich:=NUMVAL; + end + else if(pos('RTFobjw{',inkeyw) > 0) then + begin inkeyw:=inkeyw+'}'; outrem_empty_braces; outstg(inkeyw); + rtfpicw:=NUMVAL; + end + else if(pos('RTFobjh{',inkeyw) > 0) then + begin inkeyw:=inkeyw+'}'; outrem_empty_braces; outstg(inkeyw); + rtfpich:=NUMVAL; + end +{ case of \|DO( ... ) } + else if(pos('\RTFformulaDO{',inkeyw) > 0) then + if form_code[bracelvl]='' then form_code[bracelvl]:='\RTFformulaSDO' + else form_code[bracelvl]:=truncate24(form_code[bracelvl]+'DO') +{ case of \|UP( ... ) } + else if(pos('\RTFformulaUP{',inkeyw) > 0) then + if form_code[bracelvl]='' then form_code[bracelvl]:='\RTFformulaSUP' + else form_code[bracelvl]:=truncate24(form_code[bracelvl]+'UP') +{ case of \|FO( ... ) } + else if(pos('\RTFformulaFO{',inkeyw) > 0) then + begin + if form_code[bracelvl]='' then form_code[bracelvl]:='\RTFformulaDFO' + else form_code[bracelvl]:=truncate24(form_code[bracelvl]+'FO') + ; displ_skip:=numval; + end +{ case of \|UP( ... ) } + else if(pos('\RTFformulaBA{',inkeyw) > 0) then + begin + if form_code[bracelvl]='' then form_code[bracelvl]:='\RTFformulaDFO' + else form_code[bracelvl]:=truncate24(form_code[bracelvl]+'FO') + ; displ_skip:=-numval; + end +{ case of \|UP( ... ) } + else if(pos('\RTFformulaLI{',inkeyw) > 0) then + begin + if form_code[bracelvl]='' then form_code[bracelvl]:='\RTFformulaDLI' + else form_code[bracelvl]:=truncate24(form_code[bracelvl]+'LI') + ; displ_skip:=numval; + end +{ case of \|AI( ... ) } + else if(pos('\RTFformulaAI{',inkeyw) > 0) then +{ case of \|DI( ... ) } + else if(pos('\RTFformulaDI{',inkeyw) > 0) then +{ this test is eliminate first brace opened } + else if(pos('RTFrtf{',inkeyw) > 0) then + begin no_RTFrtf:=FALSE; + inkeyw:=inkeyw+'}'; outrem_empty_braces; outstg(inkeyw); + end +{ explicit references to symbol characters } + else if((pos('RTFfldinstsymbol',inkeyw) + + pos('RTFfldinstbsymbol',inkeyw) + + pos('RTFfldinstbisymbol',inkeyw)) > 0) then + begin if numval>255 then numval:=0; + acc_converted:=ftech_transl[numval]; + if acc_converted <> '' then out_math(acc_converted) + else outchr('?') + ; {END IF acc_converted} + end + else + begin poskeyw:=0; k:=pos('{',inkeyw); + if k>0 then inkeywb:=copy(inkeyw,1,k) + else inkeywb:=truncate24(inkeyw+'}'); +(* check whether this keyword should be skipped in output *) + for k:=1 to num_skip_strings do + poskeyw:=poskeyw+pos(inkeywb,skip_strings[k]) + ; {END DO} + if poskeyw=0 then + begin inkeyw:=inkeyw+'}'; outrem_empty_braces; outstg(inkeyw); + end + ; {END IF poskeyw} + end + ; {END IF} + keyw:=0; + if(kar <> ' ') then do_it_again:=TRUE; + end + ; {END IF} +end; + +{---------------------------------------------------------------------------} +{ treats a character when KEYW is 4 } +{ Hexadecimal arg of RTFac } + +procedure keyw_is_4; +var + acchexa : string2; + acc_converted : string24; + posbrace : integer; +begin + if(cat=10) then + + else if(num_hexa=0) then + begin num_hexa:=1; hexaone:=kar; + end + else if(num_hexa=1) then + begin hexatwo:=kar; acchexa:=hexaone+hexatwo; begin_par; + if (active_RTFf[bracelvl]='ftech') then + begin acc_converted:=ftech_transl[hs_to_i(acchexa)]; + if (acc_converted <> '') then out_math(acc_converted) + else outkeyw('RTFac{'+acchexa+'}') + ; {END IF acc_converted} + end + else + begin acc_converted:=acc_transl[hs_to_i(acchexa)]; + if (acc_converted <> '') then + begin if (acc_converted[1]='\') then outrem_empty_braces; + posbrace:= pos('{',acc_converted); + if (acc_converted[1]='$') then + begin outrem_empty_braces; + out_math(copy(acc_converted,2,999)); + end + else if posbrace<=1 then + outstgc(acc_converted) + else if (pos('\c{',acc_converted) + +pos('\dag{',acc_converted) + +pos('\pound{',acc_converted) + +pos('\copyright{',acc_converted) + +pos('\degree{',acc_converted))>0 then + begin + outstg(copy(acc_converted,1,posbrace-1)); + outstgc(copy(acc_converted,posbrace,999)); + end + else outstgc(acc_converted) + ; {END IF} + end + else + begin outkeyw('RTFac{'); outstg(acchexa); outchr('}'); + end + ; {END IF acc_converted} + end + ; {END IF active_RTF} + num_hexa:=0; keyw:=0; + end + else + begin sign_str(num_hexa,works); println_msg(0,'Wrong num_hexa:'+works); + end + ; {END IF} + +end; + +{---------------------------------------------------------------------------} +procedure make_latex_header; +var + i : integer; + strpts : string24; +begin + if latex209 then + outkeyw('documentstyle[') + else + outkeyw('documentclass[') + ; {END IF} + if(stdsize <> 10) then + begin sign_str(stdsize, strpts); outstg(strpts+'pt,') + end + ; {END IF} + outstg('twoside'); + + if latex209 then + begin + for i:=0 to num_latex_options do + outstg(','+latex_options[i]); + outstg(']{'+latex_style+'}'); output_line; + end + else + begin + outstg(']{'+latex_style+'}'); output_line; + outkeyw('usepackage{'); + outstg(latex_options[0]); + for i:=1 to num_latex_options do + outstg(','+latex_options[i]); + outstg('}'); output_line; + end + ; + + + + outkeyw('begin{document}\RTFsetfontheading'); output_line; +end; + +{---------------------------------------------------------------------------} +{ MAIN } +{---------------------------------------------------------------------------} +begin + clean_all; (* for safety... *) + + latex209:=FALSE; write_log:=FALSE; use_sl:=FALSE; latex_header:=TRUE; + simplify_ok:=TRUE; no_RTFrtf:=TRUE; base_flag:=FALSE; + no_space_conv:=FALSE; + last_percent:=FALSE; num_latex_options:=0; latex_style:='report'; + latex_options[0]:='rtflatex'; kar:=chr(0); save_skip:=0; space_after:=0; + math_mode[0]:=0; auto_close[0]:=FALSE; bracelvl:=0; input_line_number:=1; + (* envir_closed_ok:=FALSE; (test) *) + envir_closed_ok:=TRUE; + num_styles:=0; displ_skip:=0; + for k:=0 to 255 do ref_styles[k]:=0; + + verbose:=1; { default moderate verbosity } + tex_verbose:=0; { no insertion of flags within TeX output } + + title; charinit; sizeinit; open_files; + +{ "lvlcode" : say what to do of the contents of that block. 1=ignore +until end of current block, 2=caps, 3=ignore footnote headings, 4= +ignore contents of first arg of \footnote, 5= \RTFpict text, 6= \fonttbl +declaration, 7= \RTFformulaX[xx], 8= within \stylesheet, 9= within +\header/\footer, 9= within \RTFcolortbl, 10= \RTFobject text, 11= +\RTFfield text, 12= inside \RTFfldinst, 13= inside \RTFtrowd/\RTFrow, +15= inside \RTFtrowd/RTFrow after \RTFintbl, 16= +within \RTFformulaB(...), 17= within \RTFformulaF(...), 18= +\RTFformulaSUP(...), 19= \RTFformulaSDO(...), 20= \RTFformulaI, 21= idem +after ";", 22= idem after second ";", 23= \RTFformulaR, 24= \RTFformulaR +after ";", 25= ordinary brace within a formula, 26=\RTFformulaO, +27=\RTFformulaL, 28=\RTFformulaD } + lvlcode[0]:=0; + +{ bfslcode stores the recorded \bf, \sl, \it, \sf commands + to repeat them AFTER \large, \Large } + bfslcode[0]:=''; sizecode[0]:='normalsize'; active_RTFf[0]:=''; +close_kar[0]:=' '; form_code[0]:=''; spacingcode[0]:='relax'; +currsize[0]:=''; currbfsl[0]:=''; leftskip:=0; rightskip:=0; +leftcurskip:=0; rightcurskip:=0; +tab_nb_cellx[0]:=0; (* the number of cells in a tabular line = #\RTFcellx *) +tab_nb_ands[0]:=0; (* the number of &, must be < #\RTFcellx *) +tab_cellx[0]:=0; (* current \RTFcellx value *) +clbrdrr:=FALSE; clbrdrl:=FALSE; clbrdrt:=FALSE; clbrdrb:=FALSE; + + inkeyw:=''; numl:=0; numval:=0; numsign:=1; num_hexa:=0; ikar:=0; kinp:=0; + prev_kinp:=0; next_rtf:=''; num_indent:=0; + num_word_fonts:=0; { number of RTF/Word defined fonts } + numfonts:=0; { number of specially defined fonts } + KEYW:=0; { a flag to say whether we are decoding a keyword } + pict_number:=0; { counts the pictures } + + center_flag[0]:=0; flushright_flag[0]:=0; do_it_again:=FALSE; + underl_flag[0]:=FALSE; par_to_begin:=TRUE; + + cleanout; { clean EXFILE for safety } + + if(latex_header) then make_latex_header; + +{ main loop to read input RTF file } + + read_next_char; + while (ikar <> 26) do + begin + { read one character unless said to be retried } + if(do_it_again) then do_it_again:=FALSE + else read_char + ; {END IF} + if(ikar>=ord(' ')) then + case KEYW of + 0: keyw_is_0; + 1: keyw_is_1; + 2: keyw_is_2; + 3: keyw_is_3; + 4: keyw_is_4; + end; { case KEYW } + ; {END IF ikar} + + end; + if center_flag[bracelvl] > 0 then outkeyw('end{center}'); + if latex_header then outkeyw('end{document}') + else outkeyw('bye') + ; {END IF latex_header} + output_line; + + println_msg(0,'RTFLaTeX terminated'); + sign_str(bracelvl,works); println_msg(0,'brace level finally is:'+works); + sign_str(numl,works); + if(numl>0) then println_msg(0,works+' lines of code were generated.'); + sign_str(numfonts,works); + if(numfonts>0) then println_msg(0,works+' new fonts were declared:'); + for k:=1 to numfonts do println_msg(0,' '+newfonts[k]); + sign_str(pict_number,works); + if(pict_number>0) then println_msg(0,works+' pictures were stored in binary files.'); + close_files; +end. + + diff --git a/support/rtflatex/rtflatex.skw b/support/rtflatex/rtflatex.skw new file mode 100644 index 0000000000..6b1168b43b --- /dev/null +++ b/support/rtflatex/rtflatex.skw @@ -0,0 +1,62 @@ +\RTFfs{ +\RTFsa{ +\RTFred{ +\RTFgreen{ +\RTFblue{ +\RTFtx{ +\RTFcf{ +\RTFfldrslt +\RTFqj +\RTFpgnrestart +\RTFkeep +\RTFkeepn +\RTFhyphhotz{ +\RTFftnbj +\RTFftncn +\RTFmakebackup +\RTFsbknone +\RTFtqr +\RTFftntj +\RTFwidowctrl +\RTFftnrestart +\RTFftnstart +\RTFbrdrt +\RTFbrdrb +\RTFbrdrhair +\RTFendnhere +\RTFpgnx{ +\RTFpgny{ +\RTFlang{ +\RTFsbasedon{ +\RTFsnext{ +\RTFflddirty +\RTFtrgaph{ +\RTFclshdng{ +\RTFbrdrw{ +\RTFbrdrdb +\RTFaenddoc +\RTFformshade +\RTFfet{ +\RTFpnseclvl{ +\RTFpnumcrm +\RTFpnstart{ +\RTFpnindent{ +\RTFpnhang{ +\RTFnoextrasprl +\RTFcvmme +\RTFprcolbl +\RTFsprsspbf +\RTFbrkfrm +\RTFswpbdr +\RTFhyphcaps{ +\RTFtemplate +\RTFpnucrm +\RTFpntxta +\RTFpnucltr +\RTFpndec +\RTFpnlcltr +\RTFpntxtb +\RTFpnlcrm +\RTFtrqc +\RTFtrkeep +\RTFclmgf diff --git a/support/rtflatex/rtflatex.sty b/support/rtflatex/rtflatex.sty new file mode 100644 index 0000000000..7bcbc3609d --- /dev/null +++ b/support/rtflatex/rtflatex.sty @@ -0,0 +1,182 @@ +\def\NFdeft{\rm} +\def\bfit{\bf\itshape} +\def\ttit{\tt\slshape} +\def\ttsl{\tt\slshape} +\def\ttbf{\tt\bfseries} +\def\sfit{\sf\itshape} +\def\bfsl{\bf\slshape} +\def\sfsl{\sf\slshape} +\def\sfbf{\sf\bfseries} +\def\sfbfit{\sf\bfseries\itshape} +\def\sfbfsl{\sf\bfseries\slshape} + +\def\RTFf#1{} +\def\RTFrtf#1{\immediate\write15{RTFLaTeX by D. Taupin, your version #1}} +\def\RTFdeff#1{} +\def\RTFcolortbl#1{} +\def\RTFfonttbl#1{} +\def\RTFstylesheet#1{} +\def\RTFinfo#1{} + +\def\RTFbox{}\def\RTFbrsp#1{}\def\RTFpicscalex#1{}\def\RTFpicscaley#1{} +\def\RTFbrdrs{}\def\RTFbrdrsh{}\def\RTFflddirty{}\def\RTFobjemb{} +\def\RTFobjclass{}\def\RTFobjdata{}\def\RTFresult{} +\def\RTF@picwgoal#1{}\def\RTF@pichgoal#1{} +\def\RTFbrdrw#1{}\def\RTFbfsp#1{} +\def\RTFmacpict{\def\RTFpicwgoal{\RTF@picwgoal}% + \def\RTFpichgoal{\RTF@pichgoal}% + \def\RTFpicw{\RTF@picw}% + \def\RTFpich{\RTF@pich}% +} +\def\RTFwmetafile#1{\def\RTFpicwgoal{\RTFobjw}% + \def\RTFpichgoal{\RTFobjh}% + \def\RTFpicw{\RTF@picwgoal}% + \def\RTFpich{\RTF@pichgoal}% +} +\def\RTFobjw#1{\edef\RTF@picw{#1\RTFtwips}} +\def\RTF@picw#1{\edef\RTF@picw{#1\RTF@picunit}} +\def\RTFobjh#1{\hbox{\vrule\vbox to #1\RTFtwips{\hrule width\RTF@picw\vss + \hbox to \RTF@picw{\hss\tt\RTF@pict\hss}\vss\hrule}\vrule}} +\def\RTF@pich#1{\hbox{\vrule\vbox to #1\RTF@picunit{\hrule width\RTF@picw\vss + \hbox to \RTF@picw{\hss\tt\RTF@pict\hss}\vss\hrule}\vrule}} + %\check +\def\RTFoutl{\bf\sf} +\def\RTFsbasedon#1{} +\def\RTFtwoside{\global\@twosidetrue} +\newdimen\RTF@tx +\newdimen\RTFtwips +\newdimen\RTF@picunit +\global\RTFtwips=1pt \global\divide\RTFtwips by 20\relax +\RTF@picunit=1pt + %\check +\def\RTFemdash{{---}} +\def\RTFendash{{--}} +\def\RTFpaperw#1{} +\def\RTFpaperh#1{} +\def\RTFsnext#1{} +\def\RTFfield{} +\def\RTFfldinst{} +\def\RTFfldrslt{} +\def\RTFtitlepg{} +\def\RTFfracwidth{} + +\def\RTFpgnstart#1{\global\count0=#1\relax} + %\check +%\def\RTFfi#1{\parindent #1\RTFtwips} +\def\RTFfi#1{} + +\def\RTFqc{} +\def\RTFup#1{} +\def\RTFdeflang#1{\immediate\write15{\noexpand\deflang{#1} ignored.}} +\def\RTFri#1{\immediate\write15{\noexpand\ri{#1} ignored.}} +\def\RTFli#1{\immediate\write15{\noexpand\li{#1} ignored.}} +\def\RTFlang#1{\immediate\write15{\noexpand\lang{#1} ignored.}} +\def\RTFmargl#1{\immediate\write15{\noexpand\margl{#1} ignored.}} +\def\RTFgutter#1{\immediate\write15{\noexpand\gutter{#1} ignored.}} + %\check +\def\RTFheader#1{\markboth{#1}{#1}\gdef\theRTFheader{#1}} +\def\RTFheaderf#1{\immediate\write15{\noexpand\headerf{...} ignored.}} +\def\RTFheaderl#1{\RTFtwoside\markboth{#1}{\theRTFheader}} +\def\RTFheaderr#1{\RTFtwoside\markright{#1}} + %\check +\def\RTFfooter#1{\immediate\write15{\noexpand\footer{#1} ignored.}} +\def\RTFfooterf#1{\immediate\write15{\noexpand\footerf{#1} ignored.}} +\def\RTFfooterl#1{\immediate\write15{\noexpand\footerl{#1} ignored.}} +\def\RTFfooterr#1{\immediate\write15{\noexpand\footerr{#1} ignored.}} +\def\RTFmargr#1{\immediate\write15{\noexpand\margr{#1} ignored.}} +\def\RTFmargt#1{\immediate\write15{\noexpand\margt{#1} ignored.}} +\def\RTFmargb#1{\immediate\write15{\noexpand\margb{#1} ignored.}} +\def\RTFdxfrtext#1{\immediate\write15{\noexpand\dxfrtext{#1} ignored.}} +\def\RTFdeftab#1{\immediate\write15{\noexpand\deftab{#1} ignored.}} +\def\RTFftnstart#1{\immediate\write15{\noexpand\ftnstart{#1} ignored.}} +\def\RTFcols#1{\immediate\write15{\noexpand\cols{#1} ignored.}} +\def\RTFcolsx#1{\immediate\write15{\noexpand\colsx{#1} ignored.}} +\def\RTFfs#1{\immediate\write15{\noexpand\fs{#1} ignored.}} +\def\RTFcf#1{\immediate\write15{\noexpand\cf{#1} ignored.}} +\def\RTFbinfsxn#1{\immediate\write15{\noexpand\binfsxn{#1} ignored.}} +\def\RTFbinsxn#1{\immediate\write15{\noexpand\binsxn{#1} ignored.}} +\def\RTFbrdrbtw{\immediate\write15{\noexpand\brdrbtw ignored.}} +\def\RTFfldinstrefsymbol#1{\immediate\write15{\noexpand\fldinstrefsymbol{#1} ignored.}} +\def\RTFtrowd{\immediate\write15{\noexpand\trowd ignored.}} +\def\RTFtrleft#1{\immediate\write15{\noexpand\trleft{#1} ignored.}} +\def\RTFclbrdrb{\immediate\write15{\noexpand\clbrdrb ignored.}} +\def\RTFcellx#1{\immediate\write15{\noexpand\cellx{#1} ignored.}} +\def\RTFintbl{\immediate\write15{\noexpand\intbl ignored.}} +%\def\RTFcell{\immediate\write15{\noexpand\cell ignored.}} +\let\RTFcell\relax +\def\RTFrow{\immediate\write15{\noexpand\row ignored.}} +\def\RTFfldinstrefbsymbol#1{\immediate\write15{\noexpand\fldinstrefbsymbol{#1} ignored.}} + %\check + +\def\RTFsectd{} + +\def\RTFobject{\RTF@picunit=\RTFtwips\RTFpict} +\def\RTFpict#1{\edef\RTF@pict{#1}} + %\check + +\def\RTFpagebb{\clearpage} + +\def\RTFlinemod#1{} +\def\RTFlinex#1{} +\def\RTFheadery#1{} +\def\RTFfootery#1{} +\def\RTFul{\sl} +\def\RTFtqc{\null} +\def\RTFtqdec{\hskip 1em{}} +\def\RTFhrule{\leavevmode\vrule height 0.4pt depth 0pt width } +\global\emergencystretch 40pt +\ifx\r\undefined\write16{\noexpand\r undefined ! reset to \noexpand + \accent 23}\def\r#1{{\accent 23 #1}}\fi \def\degree{\r{}} +\ifx\undefined\HUGE\def\HUGE{\Huge}\fi + %\check + + + +\def\Alpha{\hbox{\rm A}} +\def\Beta{\hbox{\rm B}} +\def\Epsilon{\hbox{\rm E}} +\def\Zeta{\hbox{\rm Z}} +\def\Eta{\hbox{\rm H}} +\def\Iota{\hbox{\rm I}} +\def\Kappa{\hbox{\rm K}} +\def\Mu{\hbox{\rm M}} +\def\Nu{\hbox{\rm N}} +\def\Omicron{\hbox{\rm O}} +\def\Rho{\hbox{\rm P}} +\def\Tau{\hbox{\rm T}} +\def\varUpsilon{\hbox{\rm Y}} +\def\Chi{\hbox{\rm X}} + +\def\RTFac#1{\hbox{\tt\char 92RTFac[#1]}} + +\def\RTFaccol{\hbox{\tt\char 92RTFaccol[]}} + +\def\closebr#1{} + + %\check +\newdimen\boxedsize +\newbox\boxedbox +\def\boxed#1{\setbox\boxedbox\hbox{#1}\boxedsize=\dp\boxedbox + \advance\boxedsize by 3.4pt\leavevmode + \raise -\boxedsize\vbox{\hrule\hbox{\vrule\kern3pt + \vbox{\kern3pt\box\boxedbox\kern3pt}\kern3pt\vrule}\hrule}} + +\def\beginparagraph{\leavevmode\strut} + +\def\plainitem{\par \hangindent 1.0\parindent \textindent} + +\def\registered{\protect \pregistered} + \def\pregistered{{\sc \ooalign {\hfil \raise .07ex\hbox {r}\hfil \crcr +\mathhexbox 20D}}} + +\def\trademark{\protect \ptrademark} + \def\ptrademark{{\sc \leavevmode \raise .07ex\hbox {tm}}} + +\def\RTFsetfontheading{{\rm\def\wordsplita##1##2##3.{##1}% +\def\wordsplitb##1##2##3.{##2}% + % +\xdef\FontHdg{\expandafter\wordsplita\fontname\the\font.} +\xdef\FontHdge{\expandafter\wordsplitb\fontname\the\font.}} + % +\immediate\write16{ Fonts used:\FontHdg\FontHdge}\relax} + diff --git a/support/rtflatex/tfm/cmobx10.tfm b/support/rtflatex/tfm/cmobx10.tfm Binary files differnew file mode 100644 index 0000000000..7619c8a8bc --- /dev/null +++ b/support/rtflatex/tfm/cmobx10.tfm diff --git a/support/rtflatex/tfm/cmobx12.tfm b/support/rtflatex/tfm/cmobx12.tfm Binary files differnew file mode 100644 index 0000000000..e73c343013 --- /dev/null +++ b/support/rtflatex/tfm/cmobx12.tfm diff --git a/support/rtflatex/tfm/cmor10.tfm b/support/rtflatex/tfm/cmor10.tfm Binary files differnew file mode 100644 index 0000000000..d7be79a476 --- /dev/null +++ b/support/rtflatex/tfm/cmor10.tfm diff --git a/support/rtflatex/tfm/cmoss17.tfm b/support/rtflatex/tfm/cmoss17.tfm Binary files differnew file mode 100644 index 0000000000..c460d559ba --- /dev/null +++ b/support/rtflatex/tfm/cmoss17.tfm diff --git a/support/rtflatex/tfm/cmossb10.tfm b/support/rtflatex/tfm/cmossb10.tfm Binary files differnew file mode 100644 index 0000000000..692f4b8a30 --- /dev/null +++ b/support/rtflatex/tfm/cmossb10.tfm diff --git a/support/rtflatex/tfm/dcobx10.tfm b/support/rtflatex/tfm/dcobx10.tfm Binary files differnew file mode 100644 index 0000000000..02dcd9b0bd --- /dev/null +++ b/support/rtflatex/tfm/dcobx10.tfm diff --git a/support/rtflatex/tfm/dcobx12.tfm b/support/rtflatex/tfm/dcobx12.tfm Binary files differnew file mode 100644 index 0000000000..285f274975 --- /dev/null +++ b/support/rtflatex/tfm/dcobx12.tfm diff --git a/support/rtflatex/tfm/dcobx5.tfm b/support/rtflatex/tfm/dcobx5.tfm Binary files differnew file mode 100644 index 0000000000..8560400048 --- /dev/null +++ b/support/rtflatex/tfm/dcobx5.tfm diff --git a/support/rtflatex/tfm/dcobx6.tfm b/support/rtflatex/tfm/dcobx6.tfm Binary files differnew file mode 100644 index 0000000000..bc552f702c --- /dev/null +++ b/support/rtflatex/tfm/dcobx6.tfm diff --git a/support/rtflatex/tfm/dcobx7.tfm b/support/rtflatex/tfm/dcobx7.tfm Binary files differnew file mode 100644 index 0000000000..c19e7382d6 --- /dev/null +++ b/support/rtflatex/tfm/dcobx7.tfm diff --git a/support/rtflatex/tfm/dcobx8.tfm b/support/rtflatex/tfm/dcobx8.tfm Binary files differnew file mode 100644 index 0000000000..206ead6f29 --- /dev/null +++ b/support/rtflatex/tfm/dcobx8.tfm diff --git a/support/rtflatex/tfm/dcobx9.tfm b/support/rtflatex/tfm/dcobx9.tfm Binary files differnew file mode 100644 index 0000000000..71ee457a6e --- /dev/null +++ b/support/rtflatex/tfm/dcobx9.tfm diff --git a/support/rtflatex/tfm/dcobxs10.tfm b/support/rtflatex/tfm/dcobxs10.tfm Binary files differnew file mode 100644 index 0000000000..c8e190d80f --- /dev/null +++ b/support/rtflatex/tfm/dcobxs10.tfm diff --git a/support/rtflatex/tfm/dcobxs12.tfm b/support/rtflatex/tfm/dcobxs12.tfm Binary files differnew file mode 100644 index 0000000000..b474ed057f --- /dev/null +++ b/support/rtflatex/tfm/dcobxs12.tfm diff --git a/support/rtflatex/tfm/dcobxs8.tfm b/support/rtflatex/tfm/dcobxs8.tfm Binary files differnew file mode 100644 index 0000000000..d7ba399887 --- /dev/null +++ b/support/rtflatex/tfm/dcobxs8.tfm diff --git a/support/rtflatex/tfm/dcobxs9.tfm b/support/rtflatex/tfm/dcobxs9.tfm Binary files differnew file mode 100644 index 0000000000..e3606f6942 --- /dev/null +++ b/support/rtflatex/tfm/dcobxs9.tfm diff --git a/support/rtflatex/tfm/dcor10.tfm b/support/rtflatex/tfm/dcor10.tfm Binary files differnew file mode 100644 index 0000000000..10f7cd2740 --- /dev/null +++ b/support/rtflatex/tfm/dcor10.tfm diff --git a/support/rtflatex/tfm/dcor12.tfm b/support/rtflatex/tfm/dcor12.tfm Binary files differnew file mode 100644 index 0000000000..590bb8333e --- /dev/null +++ b/support/rtflatex/tfm/dcor12.tfm diff --git a/support/rtflatex/tfm/dcor17.tfm b/support/rtflatex/tfm/dcor17.tfm Binary files differnew file mode 100644 index 0000000000..de8806f733 --- /dev/null +++ b/support/rtflatex/tfm/dcor17.tfm diff --git a/support/rtflatex/tfm/dcor2.tfm b/support/rtflatex/tfm/dcor2.tfm Binary files differnew file mode 100644 index 0000000000..b248a2f001 --- /dev/null +++ b/support/rtflatex/tfm/dcor2.tfm diff --git a/support/rtflatex/tfm/dcor5.tfm b/support/rtflatex/tfm/dcor5.tfm Binary files differnew file mode 100644 index 0000000000..7c8e3ee1c2 --- /dev/null +++ b/support/rtflatex/tfm/dcor5.tfm diff --git a/support/rtflatex/tfm/dcor6.tfm b/support/rtflatex/tfm/dcor6.tfm Binary files differnew file mode 100644 index 0000000000..43fb15a31f --- /dev/null +++ b/support/rtflatex/tfm/dcor6.tfm diff --git a/support/rtflatex/tfm/dcor7.tfm b/support/rtflatex/tfm/dcor7.tfm Binary files differnew file mode 100644 index 0000000000..b6b0b4ef8b --- /dev/null +++ b/support/rtflatex/tfm/dcor7.tfm diff --git a/support/rtflatex/tfm/dcor8.tfm b/support/rtflatex/tfm/dcor8.tfm Binary files differnew file mode 100644 index 0000000000..d987fb91bc --- /dev/null +++ b/support/rtflatex/tfm/dcor8.tfm diff --git a/support/rtflatex/tfm/dcor9.tfm b/support/rtflatex/tfm/dcor9.tfm Binary files differnew file mode 100644 index 0000000000..4fc7e42b0f --- /dev/null +++ b/support/rtflatex/tfm/dcor9.tfm diff --git a/support/rtflatex/vf/dmobx10.vf b/support/rtflatex/vf/dmobx10.vf Binary files differnew file mode 100644 index 0000000000..26c6afeaa7 --- /dev/null +++ b/support/rtflatex/vf/dmobx10.vf diff --git a/support/rtflatex/vf/dmobx12.vf b/support/rtflatex/vf/dmobx12.vf Binary files differnew file mode 100644 index 0000000000..05afab7144 --- /dev/null +++ b/support/rtflatex/vf/dmobx12.vf diff --git a/support/rtflatex/vf/dmor17.vf b/support/rtflatex/vf/dmor17.vf Binary files differnew file mode 100644 index 0000000000..09bddbe8a9 --- /dev/null +++ b/support/rtflatex/vf/dmor17.vf diff --git a/support/rtflatex/vf/dmoss10.vf b/support/rtflatex/vf/dmoss10.vf Binary files differnew file mode 100644 index 0000000000..d27e9121e7 --- /dev/null +++ b/support/rtflatex/vf/dmoss10.vf diff --git a/support/rtflatex/vf/dmoss12.vf b/support/rtflatex/vf/dmoss12.vf Binary files differnew file mode 100644 index 0000000000..afe5d32344 --- /dev/null +++ b/support/rtflatex/vf/dmoss12.vf diff --git a/support/rtflatex/vf/dmoss17.vf b/support/rtflatex/vf/dmoss17.vf Binary files differnew file mode 100644 index 0000000000..8096f8bf58 --- /dev/null +++ b/support/rtflatex/vf/dmoss17.vf diff --git a/support/rtflatex/vf/dmossb10.vf b/support/rtflatex/vf/dmossb10.vf Binary files differnew file mode 100644 index 0000000000..d4415a3ae0 --- /dev/null +++ b/support/rtflatex/vf/dmossb10.vf |