Re: [NTG-context] [OS X TeX] Default rule thickness
On Wed, Aug 6, 2008 at 12:21 PM, Bruno Voisin
Le 6 août 08 à 09:34, Oliver Buerschaper a écrit :
does someone know how to find out the current value of default_rule_thickness in a (La)TeX document? TeX uses it to determine the line width of fraction bars and roots in math mode …
The short story: 0.4 pt.
The long story: LaTeX defines \frac in terms of the TeX primitive \over, and \sqrt in terms of the TeX primitive \radical (a primitive being a command defined in the source code of TeX itself). Hence the only way to get an answer for sure would be to inspect the source code of TeX.
The TeXbook has an appendix G "Generating boxes from formulas" mentioning in several places (for \overline, \underline, \radical, ...) a default_rule_thickness called either $\theta$ or $\xi_8$, but not giving its value. Being a mere mortal, I must admit I can't make much sense of this appendix.
My feeling is that TeX uses the same default rule thickness for all rules (in \overline, \underline, \over, \sqrt, \footnote, ...) and that it is the thickness given at the beginning of chapter 21 "Making Boxes":
\hrule width=<depends on contest>, height=0.4pt, depth=0.0pt \vrule width=0.4pt, height=<depends on contest>, depth=<depends on contest>
The rule is between 0.4pt and 0.5pt \starttext \dontleavehmode \scale[factor=200]{$1 \over 2$} \scale[factor=200]{$1 \above .47pt 2$} \stoptext
Now, if you want to specify the rule thickness yourself for a fraction, say to 1pt, I see two solutions:
- In plain TeX, replace \over by \above. For example, replace {a\over b} by {a\above1pt b}.
- In LaTeX, use the amsmath package and replace \frac by \genfrac. For example, replace \frac{a}{b} by \genfrac{}{}{1pt}{}{a}{b}.
I don't know what can be done for square roots.
Bruno Voisin
PS Normally, such a question which has nothing Mac-specific would be better posted to a general LaTeX forum such as comp.tex.text. However, comp.tex.text may be quite intimidating to the novice (chances are you'll either get your question ignored or be flamed for asking a stupid question), and as a result I have myself asked general questions here more than once and avoid comp.tex.text whenever possible.
Wolfgang
The rule is between 0.4pt and 0.5pt
\starttext \dontleavehmode \scale[factor=200]{$1 \over 2$} \scale[factor=200]{$1 \above .47pt 2$} \stoptext
Lovely! This applies to ConTeXt's default font size of 12pt, doesn't it? Hence we would have the following linear relation if the thickness is 0.4pt at 10pt font size: thickness = 0.4pt * fontsize/10pt. Judging from the following: --- \startuseMPgraphic{rule} linecap := butt; defaultrulethickness := 0.4pt*BodyFontSize/10pt; path p; p := origin--(EmWidth,0); draw p withpen pencircle scaled defaultrulethickness; \stopuseMPgraphic \starttext Lorem ipsum dolor sit amet \startformula \sum_{n=0}^\infty \frac{x^n}{n!}\!\vcenter{\useMPgraphic{rule}} \stopformula \setupbodyfont[32pt] Lorem ipsum dolor sit amet \startformula \sum_{n=0}^\infty \frac{x^n}{n!}\!\vcenter{\useMPgraphic{rule}} \stopformula \setupbodyfont[72pt] Lorem ipsum dolor sit amet \startformula \sum_{n=0}^\infty \frac{x^n}{n!}\!\vcenter{\useMPgraphic{rule}} \stopformula \stoptext --- this seems to be true in general. (Hans, Taco, can you confirm this officially?) Could one perhaps pass "DefaultRuleThickness" on to MetaFun just as the variables "BodyFontSize", "ExHeight" etc. are made available? Best, Oliver
Oliver Buerschaper wrote:
this seems to be true in general. (Hans, Taco, can you confirm this officially?)
Sorry I missed this thread earlier. The default rule thickness in is the eight font parameter of the fonts in math family 3. A bare context file with the standard 12pt fonts gives the value 0.47998pt. You can get the value via : \edef\defautlrulethickness{\the\fontdimen8\textfont3} Afaik, in all math setups three fonts in math family 3 are the same actual font so just the one value will do. But the actual value will definately vary a bit depending on the font setup. For example, palatino 12pt has 0.708pt. Best wishes, Taco
Sorry I missed this thread earlier. The default rule thickness in is the eight font parameter of the fonts in math family 3. A bare context file with the standard 12pt fonts gives the value 0.47998pt. You can get the value via :
\edef\defautlrulethickness{\the\fontdimen8\textfont3}
Afaik, in all math setups three fonts in math family 3 are the same actual font so just the one value will do. But the actual value will definately vary a bit depending on the font setup. For example, palatino 12pt has 0.708pt.
OK. However, this doesn't seem to scale properly within the same font … try the following: --- \edef\defaultrulethickness{\the\fontdimen8\textfont3} \starttext Lorem ipsum dolor sit amet \defaultrulethickness \startformula \sum_{n=0}^\infty \frac{x^n}{n!} \stopformula \setupbodyfont[32pt] Lorem ipsum dolor sit amet \defaultrulethickness \startformula \sum_{n=0}^\infty \frac{x^n}{n!} \stopformula \stoptext --- So, your font parameter always returns the same value but clearly the fraction bar is scaled correctly … something else must be happening behind the curtain. If only I knew what it were ;-) Oliver
Oliver Buerschaper wrote:
Sorry I missed this thread earlier. The default rule thickness in is the eight font parameter of the fonts in math family 3. A bare context file with the standard 12pt fonts gives the value 0.47998pt. You can get the value via :
\edef\defautlrulethickness{\the\fontdimen8\textfont3}
Afaik, in all math setups three fonts in math family 3 are the same actual font so just the one value will do. But the actual value will definately vary a bit depending on the font setup. For example, palatino 12pt has 0.708pt.
OK. However, this doesn't seem to scale properly within the same font … try the following:
--- \edef\defaultrulethickness{\the\fontdimen8\textfont3}
That is because of the \edef. Changing to a plain \def should help: \def\defaultrulethickness{\the\fontdimen8\textfont3\relax} (the \relax is now needed because there could be a digit following). Best wishes, Taco
OK. However, this doesn't seem to scale properly within the same font … try the following:
--- \edef\defaultrulethickness{\the\fontdimen8\textfont3}
That is because of the \edef. Changing to a plain \def should help:
\def\defaultrulethickness{\the\fontdimen8\textfont3\relax}
Yep, works! What's the correct way of piping this to MetaFun? Putting DefaultRuleThickness := \defaultrulethickness; into each "\startuseMPgraphic{}" block works, but how can I define this globally? Moving it into "\startMPinclusions" creates a scope problem … see also the other thread about BodyFontSize etc. Thanks for your help, Oliver
Oliver Buerschaper wrote:
OK. However, this doesn't seem to scale properly within the same font … try the following:
--- \edef\defaultrulethickness{\the\fontdimen8\textfont3} That is because of the \edef. Changing to a plain \def should help:
\def\defaultrulethickness{\the\fontdimen8\textfont3\relax}
Yep, works!
What's the correct way of piping this to MetaFun? Putting
DefaultRuleThickness := \defaultrulethickness;
into each "\startuseMPgraphic{}" block works, but how can I define this globally? Moving it into "\startMPinclusions" creates a scope problem … see also the other thread about BodyFontSize etc.
\def\defaultrulethickness{\the\fontdimen8\textfont\plusthree} \startMPinitializations DefaultRuleThickness := \defaultrulethickness; \stopMPinitializations ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
What's the correct way of piping this to MetaFun? Putting
DefaultRuleThickness := \defaultrulethickness;
into each "\startuseMPgraphic{}" block works, but how can I define this globally? Moving it into "\startMPinclusions" creates a scope problem … see also the other thread about BodyFontSize etc.
\def\defaultrulethickness{\the\fontdimen8\textfont\plusthree}
\startMPinitializations DefaultRuleThickness := \defaultrulethickness; \stopMPinitializations
This works like a charm! Now I'm a bit confused though as to which definitions need this "MPinitializations" block and which ones can/should go to "MPinclusions". For example, a subsequent --- \startMPinclusions medium := DefaultRuleThickness; thick := 1.5medium; \stopMPinclusions --- doesn't work. However, color definitions for instance seem to be OK there. Could you give me a hint? Thanks, Oliver
Oliver Buerschaper wrote:
What's the correct way of piping this to MetaFun? Putting
DefaultRuleThickness := \defaultrulethickness;
into each "\startuseMPgraphic{}" block works, but how can I define this globally? Moving it into "\startMPinclusions" creates a scope problem … see also the other thread about BodyFontSize etc. \def\defaultrulethickness{\the\fontdimen8\textfont\plusthree}
\startMPinitializations DefaultRuleThickness := \defaultrulethickness; \stopMPinitializations
This works like a charm!
Now I'm a bit confused though as to which definitions need this "MPinitializations" block and which ones can/should go to "MPinclusions". For example, a subsequent
inclusions happen once, initializations for each graphic ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (4)
-
Hans Hagen
-
Oliver Buerschaper
-
Taco Hoekwater
-
Wolfgang Schuster