% ttex % $Log: ttex.mp,v $ % Revision 1.2 1996/11/22 20:40:40 tjchol01 % Changed draft to texlabels. % % Revision 1.1 1996/11/22 20:36:20 tjchol01 % Initial revision if unknown ttex_included: ttex_included:=0; % apparently working only in the current file % prolog for LaTeX and btex/etex pairs (borrowed from texnum.mp) %verbatimtex % \ifx\documentclass\undefined \else % \ifx\blackandwhite\undefined % \documentclass{article} % \else \documentclass{slides} % \fi % \begin{document} % \fi %etex % prolog for ttex and mtex macros string texprolog; if unknown texprolog: texprolog:="\ifx \documentclass\undefined \else \ifx\blackandwhite\undefined \documentclass{article} \else \documentclass{slides} \fi \begin{document} \fi"; fi; string italicfont, indexfont; italicfont:="cmr10"; indexfont:="cmr7"; if unknown texlabels: texlabels = 0 fi; % set |texlabels| to 1 to process labels through TeX vardef txt (expr s) = if picture s: s else: if texlabels = 0: s infont defaultfont scaled defaultscale else: write "verbatimtex{}" & texprolog & "{}etex" to "tmptexmp.mp"; write "btex{}" & s & "{}etex" to "tmptexmp.mp"; write EOF to "tmptexmp.mp"; scantokens "input tmptexmp" fi fi enddef; vardef mtex primary s = txt ("$" & s & "$") enddef; vardef indexedtxt (expr txt_, indx) = if texlabels = 0: save _p; picture _p; _p := txt_ infont italicfont; addto _p also indx infont indexfont shifted (lrcorner _p - (0, 2pt)); _p else: mtex (txt_ & "_{" & indx & "}") fi enddef; fi; endinput