[metapost] Problem with defaultscale

Laurence Finston lfinsto1 at gwdg.de
Wed Aug 6 18:05:43 CEST 2008


On Tue, 5 Aug 2008, Oliver Buerschaper wrote:

> One more thing perhaps … I just realized that this scales the text  
> *after* TeX typeset it, doesn't it? Now how can I make TeX itself  
> typeset the text at the right font size (especially math) such that I  
> get the opticals right? Would I have to use a preamble like the one  
> Laurence suggested?
> 

The following text is an example.  It's not so very difficult after all, 
and the TeX code for setting the fonts can be included using `\include', 
which avoids cluttering up your MetaPost input file.

Laurence

%% Divide the following text into the files `ttemp.tex', `atemp.mp'
%% and `ctemp.tex'.  
%% Then call `mpost', `tex' and `dvips' like this:
%%
%% mpost atemp.mp && tex ctemp && dvips -o ctemp.ps ctemp

%% ttemp.tex

\font\twelverm=cmr12
\font\twelvei=cmmi12
\font\twelvesy=cmsy12
\font\twelveex=cmex12
\font\twelveit=cmti12
\font\twelvesl=cmsl12
\font\twelvebf=cmbx12
\font\twelvett=cmtt12

\font\ninerm=cmr12
\font\ninei=cmmi12
\font\ninesy=cmsy12
\font\nineex=cmex12
\font\nineit=cmti12
\font\ninesl=cmsl12
\font\ninebf=cmbx12
\font\ninett=cmtt12

\catcode`@=11

\newdimen\z@ \z@=0pt % can be used both for 0pt and 0

% To make the plain macros more efficient in time and space,
% several constant values are declared here as control sequences.
% If they were changed, anything could happen; so they are private symbols.
\chardef\@ne=1
\chardef\tw@=2


\textfont0=\twelverm \scriptfont0=\ninerm \scriptscriptfont0=\sevenrm
\def\rm{\fam\z@\twelverm}
\textfont1=\twelvei \scriptfont1=\ninei \scriptscriptfont1=\seveni
\def\mit{\fam\@ne} \def\oldstyle{\fam\@ne\twelvei}
\textfont2=\twelvesy \scriptfont2=\ninesy \scriptscriptfont2=\sevensy
\def\cal{\fam\tw@}
\textfont3=\twelveex \scriptfont3=\twelveex \scriptscriptfont3=\twelveex
\newfam\itfam \def\it{\fam\itfam\twelveit} % \it is family 4
\textfont\itfam=\twelveit
\newfam\slfam \def\sl{\fam\slfam\twelvesl} % \sl is family 5
\textfont\slfam=\twelvesl
\newfam\bffam \def\bf{\fam\bffam\twelvebf} % \bf is family 6
\textfont\bffam=\twelvebf \scriptfont\bffam=\ninebf
\scriptscriptfont\bffam=\sevenbf
\newfam\ttfam \def\tt{\fam\ttfam\twelvett} % \tt is family 7
\textfont\ttfam=\twelvett

\catcode`@=12 % at signs are no longer letters

\endinput

%% End of ttemp.tex

%% atemp.mp

beginfig(1)

label(btex $\sqrt{2} = (x_0^{32} + 24) \times 33$  etex, (0, 0));

endfig;

verbatimtex \input ttemp.tex etex

beginfig(2)

label(btex $\sqrt{2} = (x_0^{32} + 24) \times 33$  etex, (0, 0));

endfig;

end;

%% End of atemp.mp

%% ctemp.tex

%% \input epsf

\epsffile{atemp.1}
\vskip1cm
\epsffile{atemp.2}

\bye

%% End of ctemp.tex


More information about the metapost mailing list