I read that rule in \overline command is placed 3 * linethickness above top of the argument.
In my custom class I use this part of code to determine line thickness:
\setbox2\vbox{\hrule width 10mm}
\newdimen\@RuleThickness
\@RuleThickness=\dp2
\the\@RuleThickness
\advance\@RuleThickness\ht2
\the\@RuleThickness
\the\dp2
\the\ht2
I get \@RuleThickness 0.4pt with \documentclass[12pt]{article}, but it seems that rule in \overline for 12pt is little bit more than 3 * 0.4pt = 1.2pt. So, I think I got rule thickness for 10pt, not 12pt.
How can I determine linethickness for 12pt, or generally, for current font I use?
koksi <ivan.ko...@gmail.com> wrote:
> Hi everybody.
> I read that rule in \overline command is placed 3 * linethickness above top of the argument.
> In my custom class I use this part of code to determine line thickness:
> \setbox2\vbox{\hrule width 10mm}
> \newdimen\@RuleThickness
> \@RuleThickness=\dp2
> \the\@RuleThickness
> \advance\@RuleThickness\ht2
> \the\@RuleThickness
> \the\dp2
> \the\ht2
> I get \@RuleThickness 0.4pt with \documentclass[12pt]{article},
You get always 0.4pt, because of the defaults for TeX rules.
From "The TeXbook":
| If you leave a dimension unspecified, you get the following by default:
|
| \hrule \vrule
| width * 0.4pt
| height 0.4pt *
| depth 0.0pt *
|
| Here `*' means that the actual dimension depends on the context;
| the rule will extend to the boundary of the smallest box or alignment
| that encloses it.
> but it seems that rule in \overline for 12pt is little bit
> more than 3 * 0.4pt = 1.2pt. So, I think I got rule
> thickness for 10pt, not 12pt.
\overline is independent from \hrule or \vrule, it uses a different
line width. This is a property of the math font and \fontdimen8 is
used:
>I read that rule in \overline command is placed 3 * linethickness above top of the argument.
>In my custom class I use this part of code to determine line thickness:
> \setbox2\vbox{\hrule width 10mm}
> \newdimen\@RuleThickness
> \@RuleThickness=\dp2
> \the\@RuleThickness
> \advance\@RuleThickness\ht2
> \the\@RuleThickness
> \the\dp2
> \the\ht2
>I get \@RuleThickness 0.4pt with \documentclass[12pt]{article}, but it seems that rule in \overline for 12pt is little bit more than 3 * 0.4pt = 1.2pt. So, I think I got rule thickness for 10pt, not 12pt.
[Math fonts in TeX are a cruel joke played on us by Knuth.]
\hrule is not the same as \overline. \hrule *always* uses .4pt when a height is not specified (and 0pt for the depth). Therefore, the effect of your complicated code is to always
set \@RuleThickness to .4pt.
The line used in \overline is determined by a parameter called
the default_rule_thickness. It is a \fontdimen parameter determined by the current size in math family 3. That is,
the main math extension family is used (default cmex) and the
current math size (text, script or scriptscript). It is \fontdimen8
of this font. To obtain it in the text size, use
\@RuleThickness=\fontdimen8\textfont3
in script size us \scriptfont instead of \textfont and use
\scriptscriptfont for the scriptscript size.
Even in a 12pt document, latex uses cmex10 by default, because this font consists mostly of extensible delimiters that grow to any size. In fact, cmex10 is also the default for script and scriptscript sizes. Thus, you will always get a rule that is 0.39998pt thick.
Also, in LaTeX, the math families are only loaded at the first use of math. So to even get a value instead of an error, you need to use math first: something like
\setbox0\hbox{$$} \@RuleThickness=\fontdimen8\textfont3
If you want an \overrule that varies with the document font size, you need \usepackage{exscale}
Personally, I think this makes the rules too thick and too far above the material being overlined.
Finally, I cannot say what happens when a package is loaded that uses a math extension font other than the cmex family.
Because exscale seems only to change the behavior of cmex.
Dan
To reply by email, change LookInSig to luecking
>And \printlw prints 0.39998pt in all math styles.
>I don't know, why this is smaller than 0.4pt by 1sp.
There are at least 3 conversions to different formats:
In cmex10.mf it says
rule_thickness# = .4pt#;
...
fontdimen 8: rule_thickness#;
So however MF writes fontdimens, it actually works with the
variable rule_thickness#, which contains MF's internal version of 0.4 (the integer 26214) not 0.4 itself.
This has to be stored in the TFM file as a fraction of design size. It is stored as a binary integer interpreted as multiple of 2^{-20}). This requires division by 10 (the design size) and multiplication by 2^4.
With rounding this gives 41942. (tftopl reports .039999 which is very, very close to 41942*2^{-20}).
Then TeX has to multiply that by 10 and divide by 16 (to
convert to a multiple of 2^{-16}. If the division is an integer division (truncation) one loses 1 scaled point.
So it could be because MF rounds while TeX truncates.
Dan
To reply by email, change LookInSig to luecking
Dan Luecking <LookIn...@uark.edu> wrote:
> On Mon, 17 Sep 2012 19:40:25 +0200, Heiko Oberdiek
> <heiko.oberd...@googlemail.com> wrote:
> >And \printlw prints 0.39998pt in all math styles.
> >I don't know, why this is smaller than 0.4pt by 1sp.
> There are at least 3 conversions to different formats:
> In cmex10.mf it says
> rule_thickness# = .4pt#;
> ...
> fontdimen 8: rule_thickness#;
> So however MF writes fontdimens, it actually works with the
> variable rule_thickness#, which contains MF's internal > version of 0.4 (the integer 26214) not 0.4 itself.
> This has to be stored in the TFM file as a fraction of > design size. It is stored as a binary integer interpreted > as multiple of 2^{-20}). This requires division > by 10 (the design size) and multiplication by 2^4.
> With rounding this gives 41942. (tftopl reports .039999 > which is very, very close to 41942*2^{-20}).
> Then TeX has to multiply that by 10 and divide by 16 (to
> convert to a multiple of 2^{-16}. If the division is an > integer division (truncation) one loses 1 scaled point.
> So it could be because MF rounds while TeX truncates.
Hi Dan and Heiko! Thank you both for your explanations. I had some time playing with your code last evening.
But I'd like to point out my real problem. I'm trying to make "math accent" that will put arc over argument in math mode (something like rule in \overline). We use that notation for circular arc in Croatia.
Since there's no appropriate character in font table to do that (with \DeclareMathAccent) and I don't want to play with Metafont, my idea was to avoid WYSIWYM paradigm in this case (unfortunately) and implement that "accent" with scaled parenthesis rotated by 90 degrees and shifted to the exact height where rule in \overline is.
(There's a package in MiKTeX distribution called yhmath that provides this accent in the WYSIWYM paradigm, but unfortunately .fd file isn't included in package and compiler can't produce that accent. If you have access to the source of this package it would be nice to fix it.)
Anyway, with or without yhmath package, I would like to show you my demo:
koksi <ivan.ko...@gmail.com> writes:
>Hi Dan and Heiko! Thank you both for your explanations. I had some time >playing with your code last evening.
>But I'd like to point out my real problem. I'm trying to make "math accent"
>that will put arc over argument in math mode (something like rule in >\overline). We use that notation for circular arc in Croatia.
If I understand your requirements (which I may not), it seems
to me that there are several solutions available already,
documented in (e.g.) Scott Pakin's "Comprehensive LaTeX
Symbols List"; for instance, the fourier package includes
\widearc as an extensible (math mode) accent, and the arcs package provides extensible text mode arc accents
(but I'm sure that forcing them to work in math mode
is not beyond human ingenuity).
Hi! Thank you for your answer. I looked at the fourier package and tested it. I don't like that it changes font (though font itself looks really nice). Also, \widearc and \wideparen commands don't produce the result I want - "accent" an the same height as \overline and auto-width. But thank you once again!
koksi <ivan.ko...@gmail.com> writes:
> (There's a package in MiKTeX distribution called yhmath that provides
> this accent in the WYSIWYM paradigm, but unfortunately .fd file isn't
> included in package and compiler can't produce that accent.
the accent seems to work using yhmath.sty -- the .fd is not needed if
someone has coded use into a package.
however, it will only work in maths mode, afaict. my guess from your
remark about the accent being used in text in croation is that you want
it in text as well.
i note that the accent is visible in the unicode tables for latin
extended-b (in my aged copy of iso 10646-1; only for aeiou and r -- is r
a vowel in croatian? -- fwiw, iso calls the accent "inverted breve").
do those characters not appear in unicode fonts you have access to? --
if it does you could possibly switch to using xelatex or the like, and
use a unicode text font.
> If you
> have access to the source of this package it would be nice to fix it.)
everyone has access to source of pretty much every tex/latex/context ...
object you find in miktex or any other free distribution.
"fixing" a maths package so it works in text seems extreme to me -- i
really think you need a text font with the character.
("C:\Program Files\MiKTeX 2.9\tex\latex\base\utf8.def"
File: utf8.def 2008/04/05 v1.1m UTF-8 support for inputenc
Now handling font encoding OML ...
... no UTF-8 mapping file for font encoding OML
Now handling font encoding T1 ...
... processing UTF-8 mapping file for font encoding T1
I've searched a little bit this group and found many complains about yhmath.
It seems that it uses old Metafont definitions that aren't even included in the package. I've seen some pdfs that use cm-super and yhmath, and \wideparen looks rasterized. (See here on page 16/27 http://memo2011.math.hr/documents/MEMO2011solutions.pdf.)
So, while there's problem with yhmath, I would like to finish my implementation with parenthesis. Can you help me to level red and black rule (from question above) no matter which font size is set?
>LaTeX Font Info: No file OMXyhex.fd. on input line 13.
This file is part of the yhmath package. It should be installed is you install the whole package.
If you use MiKTeX, and you installed yhmath through its
package installation system, then you should complain.
If you installed it yourself, you need to get the whole directory macros/latex/contrib/yhmath/
as well as all of
fonts/yhmath/
And, of course, generate all necessary files, move them where required, and update the filename database.
Note (in answer to your other post) that yhmath is available as a type 1 postscript font.
The real problems with yhmath is not that it is a raster font, but rather that its font metrics are broken. Since it was originally written using metafont (and only later converted to pfb), its metrics suffer from metafont's limitation on the TFM file format: there are allowed to be at most 16 different character heights.
Yhmath's metafont code defines far more than that. So when metafont writes the TFM file, it changes some of the heights as little as possible so that there are only 16 different ones. Unfortunately, "as little as possible" still means some are changed by more than one point and one can get rather bad vertical positioning for some combinations.
Dan
To reply by email, change LookInSig to luecking
Ok, I see now. How can I install yhmath package manually? (On Windows family operating systems.) And, is there any possibility that yhmath's font will be PostScript font one day instead of limited Metafont font?
On Wed, 19 Sep 2012 11:39:36 -0700 (PDT), Ivan Kokan
<ivan.ko...@gmail.com> wrote:
>Ok, I see now. How can I install yhmath package manually? >(On Windows family operating systems.) And, is there any > possibility that yhmath's font will be PostScript font one > day instead of limited Metafont font?
Last question first: I have already said that it IS a postscript
type 1 font. MiKTeX has it in the yhmath package.
But it appears that MiKTeX is missing two files needed by
yhmath and a few that might be useful. Most of them you can get from CTAN as follows.
The important one is OMXyhex.fd. (I don't know why MiKTeX doesn't have it, you should file a bug report.) The others
may be useful. The file yhmath.sty is a slight update of the version MiKTeX already has. The .mf files permit raster fonts to be created in the unlikely event they are needed.
The files created can be handled as follows: Find your "local texmf tree" or create one if there isn't one (see your MiKTeX documentation). I will call it LOCALTEXMF, but you should replace that with whatever directory it actually is. (In the following instructions, if a folder does not exist, you will have to create it.)
- Move the two files OMXyhex.fd and yhmath.sty to
LOCALTEXMF\tex\latex\yhmath\
- Either delete the four .mf files or move them to
LOCALTEXMF\fonts\source\public\yhmath\
- Delete yhmath.drv.
- Open a plain text editor (notepad should be OK) and create a file named yhmath.map containing the single line:
yrcmex10 Yhcmex <yhcmex.pfb
(If you use notepad, make sure it does not add ".txt" to the file name yhmath.map)
- Copy yhmath.map to the folder
LOCALTEXMF\fonts\map\dvips\yhmath\
- Now run whatever MiKTeX requires to "update the filename database" and then whatever MiKTeX requires to register the font map file.
I think that's all.
Dan
To reply by email, change LookInSig to luecking
I've tested that example a little bit more. If I use 11pt instead of 10pt, rule in \overline is at 3.3\@RuleThickness height, and if I use 12pt instead of 10pt, rule in \overline is at 3.6\@RuleThickness height.
How does amsmath affect the position of rule in \overline? I think it would be better if I implement \arc "accent" raising parenthesis at 3\@RuleThickness height, and capture correct length in \@RuleThickness.