| 1 |
% $Id: TEX.mp,v 1.5 2005/03/19 20:16:08 taco Exp $ |
| 2 |
% Public domain. |
| 3 |
% This file defines TEX <string_primary> to return the picture |
| 4 |
% resulting from running the string through tex. It is slow, |
| 5 |
% but more general than the standard btex..etex construction |
| 6 |
% |
| 7 |
% New in this version (1.4), for metapost 0.9: |
| 8 |
% support of pre- and post TeX texts. |
| 9 |
|
| 10 |
string preverbatimtex_, postverbatimtex_; |
| 11 |
|
| 12 |
vardef TEXPRE text s = preverbatimtex_ := s; enddef; |
| 13 |
|
| 14 |
vardef TEXPOST text s = postverbatimtex_ := s; enddef; |
| 15 |
|
| 16 |
vardef TEX primary s = |
| 17 |
if known preverbatimtex_: |
| 18 |
write "verbatimtex "&preverbatimtex_&" etex" to "mptextmp.mp"; |
| 19 |
fi |
| 20 |
write "btex "&s&" etex" to "mptextmp.mp"; |
| 21 |
if known postverbatimtex_: |
| 22 |
write "verbatimtex "&postverbatimtex_&" etex" to "mptextmp.mp"; |
| 23 |
fi |
| 24 |
write EOF to "mptextmp.mp"; |
| 25 |
scantokens "input mptextmp" |
| 26 |
enddef; |
| 27 |
|