Taco Hoekwater | 4 Aug 2008 19:39
Gravatar

Re: Problem with defaultscale

Oliver Buerschaper wrote:
> Dear MetaPost wizards,
> 
> I'm trying to change the default font size MetaPost uses for labels  
> but the following code keeps giving me trouble:
> 
> ---
> beginfig(1);
>      defaultscale := 6;
>      label(btex Hallo $\sum$ etex, origin);
> endfig;
> 
> end
> ---
> 
> Whatever the value of "defaultscale" the font size of the label  
> doesn't seem to be affected :-( My typesetting command is

Defaultscale only works for string labels, not for btex ... etex
labels. But the good news is that scaling a btex ... etex label
is really simple also:

    label(btex Hallo $\sum$ etex scaled 6, origin);

Best wishes,
Taco

--
http://tug.org/metapost/

(Continue reading)

Oliver Buerschaper | 5 Aug 2008 13:37
Picon
Favicon

Re: Problem with defaultscale

> Defaultscale only works for string labels, not for btex ... etex
> labels. But the good news is that scaling a btex ... etex label
> is really simple also:
>
>   label(btex Hallo $\sum$ etex scaled 6, origin);

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?

Oliver
--
http://tug.org/metapost/

Laurence Finston | 6 Aug 2008 18:05
Picon
Favicon

Re: Problem with defaultscale

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
(Continue reading)

Taco Hoekwater | 5 Aug 2008 16:44
Gravatar

Re: Problem with defaultscale


Oliver Buerschaper wrote:
>> Defaultscale only works for string labels, not for btex ... etex
>> labels. But the good news is that scaling a btex ... etex label
>> is really simple also:
>>
>>   label(btex Hallo $\sum$ etex scaled 6, origin);
> 
> 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?

Yes, something like that. But as noted already: redefining math fonts 
isn't a lot of fun, so you may decide not to bother (I certainly
wouldn't).

Best wishes,
Taco
--
http://tug.org/metapost/

Oliver Buerschaper | 8 Aug 2008 10:28
Picon
Favicon

Re: Problem with defaultscale

>> 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?
>
> Yes, something like that. But as noted already: redefining math  
> fonts isn't a lot of fun, so you may decide not to bother (I certainly
> wouldn't).

Yes, you're absolutely right … fiddling with the fonts is going to  
spoil my day!

Now what about this: I've just realized that mptopdf actually runs a  
ConTeXt background process that appears to have its default font size  
set to 12pt. Incidently, my TeX labels come out at exactly 12pt …  
since I'm almost always going to use mptopdf as a compiler anyway  
could I perhaps make it run the ConTeXt process at 10pt font size?

Thus I'd probably get the opticals right and someone else would do the  
fiddling for me ;-)

Oliver
--
http://tug.org/metapost/

Taco Hoekwater | 8 Aug 2008 11:23
Gravatar

Re: Problem with defaultscale


Oliver Buerschaper wrote:
> 
> Now what about this: I've just realized that mptopdf actually runs a 
> ConTeXt background process that appears to have its default font size 
> set to 12pt. Incidently, my TeX labels come out at exactly 12pt … since 
> I'm almost always going to use mptopdf as a compiler anyway could I 
> perhaps make it run the ConTeXt process at 10pt font size?

verbatimtex
\setupbodyfont[10pt]
etex

Best wishes,
Taco
--
http://tug.org/metapost/

Oliver Buerschaper | 8 Aug 2008 15:21
Picon
Favicon

Re: Problem with defaultscale

>> Now what about this: I've just realized that mptopdf actually runs  
>> a ConTeXt background process that appears to have its default font  
>> size set to 12pt. Incidently, my TeX labels come out at exactly  
>> 12pt … since I'm almost always going to use mptopdf as a compiler  
>> anyway could I perhaps make it run the ConTeXt process at 10pt font  
>> size?
>
> verbatimtex
> \setupbodyfont[10pt]
> etex

Wicked! That kills three birds with (almost) a single line … now I can  
also save myself typing all the scaling factors after "etex" …

Thanks,
Oliver
--
http://tug.org/metapost/

Laurence Finston | 5 Aug 2008 18:44
Picon
Favicon

Re: Problem with defaultscale

On Tue, 5 Aug 2008, Taco Hoekwater wrote:

> Yes, something like that. But as noted already: redefining math fonts 
> isn't a lot of fun, so you may decide not to bother (I certainly
> wouldn't).

Well, I admit that I don't usually bother, either.  However, it's not 
that difficult.  Here's what you need to change, if you care to try.
It's just a matter of choosing larger sizes, e.g., `\tenrm' instead of
`\sevenrm'. 

I'm pretty sure that you can just have TeX process it after it's read
`plain.fmt';  the definitions are just overwritten.  However, 
it's been many long years since I've actually done this, so it's quite
possible that I've overlooked something.

Laurence

%% Excerpt from Knuth's `plain.tex'.
%% Typical location:  `/usr/share/texmf/tex/plain/base/'

% We make  <at>  signs act like letters, temporarily, to avoid conflict
% between user names and internal control sequences of plain format.
\catcode` <at> =11

\newdimen\z <at>  \z <at> =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.
(Continue reading)

John Kitzmiller | 4 Aug 2008 21:09
Picon

Re: Problem with defaultscale

----- Original Message ----- 
From: "Taco Hoekwater" <taco <at> elvenkind.com>
Subject: Re: [metapost] Problem with defaultscale

> But the good news is that scaling a btex ... etex label
> is really simple also:
> 
>    label(btex Hallo $\sum$ etex scaled 6, origin);

Doh! I will crawl back into my hole now.

But what about making changes within btex ... etex?

Any help with why:

label(btex \sffamily Hallo etex, origin);

works when:

label(btex \large Hallo etex, origin);

does not?
(No file mpx314.aux.
 !Undefined control sequence.)

(Apologies for usurping the thread.)

--
http://tug.org/metapost/

(Continue reading)

Laurence Finston | 4 Aug 2008 21:18
Picon
Favicon

Re: Problem with defaultscale


> Any help with why:
> 
> label(btex \sffamily Hallo etex, origin);
> 
> works when:
> 
> label(btex \large Hallo etex, origin);
> 
> does not?
> (No file mpx314.aux.
>  !Undefined control sequence.)

Presumably because `\large' is undefined.  You can define it in a 
`verbatimtex ... etex' block.

Laurence Finston

On Mon, 4 Aug 2008, John Kitzmiller wrote:

> ----- Original Message ----- 
> From: "Taco Hoekwater" <taco <at> elvenkind.com>
> Subject: Re: [metapost] Problem with defaultscale
> 
> 
> > But the good news is that scaling a btex ... etex label
> > is really simple also:
> > 
> >    label(btex Hallo $\sum$ etex scaled 6, origin);
> 
(Continue reading)

John Kitzmiller | 4 Aug 2008 22:51
Picon

Re: Problem with defaultscale


>> Any help with why:
>>
>> label(btex \sffamily Hallo etex, origin);
>>
>> works when:
>>
>> label(btex \large Hallo etex, origin);
>>
>> does not?
>> (No file mpx314.aux.
>>  !Undefined control sequence.)
>
> Presumably because `\large' is undefined.  You can define it in a
> `verbatimtex ... etex' block.
>
> Laurence Finston
>

Thank you, Laurence.

Do you have time to provide a brief example? Or point me to where I might
find an example?

I am trying things like:

verbatimtex
%&latex
\def\large#1{\large{#1}}
\begin{document}
(Continue reading)

Laurence Finston | 5 Aug 2008 08:38
Picon
Favicon

Re: Problem with defaultscale

> Do you have time to provide a brief example? Or point me to where I might
> find an example?

I'm usually quite happy to make minimal examples, but I'm not a 
LaTeX user and I never use LaTeX for typesetting labels in MetaPost.  I 
don't even remember how it's done, otherwise I would have written one up.  
However, Taco has done so, so I'm off the hook.  

I don't want to start an ideological argument, but I don't really 
see the  advantage of using LaTeX for this purpose, since labels are 
usually just short snippets of text rather than documents.  You can get 
any font you want by simply using the `\font' command in a `verbatimtex 
... etex' block.  The advantage of doing this is that you can get many 
fonts at their proper size rather than scaling them.  Of course, for some 
sizes, the fonts will be scaled, anyway.

Changing the size of fonts in math mode is a genuine problem with plain 
TeX.  I don't know how (or if) LaTeX has a solution for this problem.  
However, it's not really that difficult to modify `plain.tex', if one 
needs text in math mode to have different sizes.  I don't usually bother.

Laurence

On Mon, 4 Aug 2008, John Kitzmiller wrote:

> 
> > > Any help with why:
> > >
> > > label(btex \sffamily Hallo etex, origin);
> > >
(Continue reading)

Taco Hoekwater | 4 Aug 2008 23:12
Gravatar

Re: Problem with defaultscale

John Kitzmiller wrote:
> 
> I am trying things like:

Adding a \documentclass line should help.

> verbatimtex
> %&latex
> \def\large#1{\large{#1}}
> \begin{document}
> etex
> 
> with no positive result.
> 
> A further question is why \sffamily is defined and \large is not? They both
> work in a latex file.

Because \sffamily is a latex core command, whereas \large is defined via
the document class (at least, iirc)

Best wishes,
Taco
--
http://tug.org/metapost/

John Kitzmiller | 5 Aug 2008 00:08
Picon

Re: Problem with defaultscale

> John Kitzmiller wrote:
>>
>> I am trying things like:
>
> Adding a \documentclass line should help.
>
>> verbatimtex
>> %&latex
>> \def\large#1{\large{#1}}
>> \begin{document}
>> etex
>>
>> with no positive result.
>>
>> A further question is why \sffamily is defined and \large is not? They 
>> both
>> work in a latex file.
>
> Because \sffamily is a latex core command, whereas \large is defined via
> the document class (at least, iirc)
>

Twice in one day I raise my hand, and twice in one day Taco gives a gentle 
and very informative answer. This community is gifted.

To keep my previous example short I stupidly omitted that I routinely use:

\documentclass{minimal}

in my metapost preamble when 'drawing' metapost figures. Changing it to 
(Continue reading)


Gmane