Assume the following all output numerals of their respective styles:
(the paired commands produce the same output as each other)
\mathbf{0123456789}
\mathbfup{0123456789}
\mathsf{0123456789}
\mathsfup{0123456789}
\mathbfsf{0123456789}
\mathbfsfup{0123456789}
Where the "no-up" versions for latin and greek letters are sensitive
to package options (e.g., \mathbf can be made to output either upright
or italic Greek letters) but the "up" versions always force their
output upright regardless of the shape of the input chars.
In your opinion, how would expect the following to behave? (For latin/
greek, these commands force their output italic.)
\mathbfit{0123456789}
\mathsfit{0123456789}
\mathbfsfit{0123456789}
Option #1:
\mathbfit{0123456789} -> \mathbf{0123456789}
\mathsfit{0123456789} -> \mathsf{0123456789}
\mathbfsfit{0123456789} -> \mathbfsf{0123456789}
Option #2:
\mathbfit{0123456789} -> 0123456789
\mathsfit{0123456789} -> 0123456789
\mathbfsfit{0123456789} -> 0123456789
I can make arguments on both sides; until now I've chosen #1 in
unicode-math but I'm revisiting that decision now.
--
Will
Option #1 treats numbers as having identical “upright” and “italic”
shapes and so makes \mathXXit{0123456789} meaningful; option #2
considers \mathXXit{0123456789} meaningless, since these symbols do not
exist.
My sympathies are with option #2; if you have a mathematical use for
italic-numeral-shaped symbols use a text font while you petition Unicode
to include these new symbols.
Note also that I do not think the heavy alphabets are appropriate for
emphasis: \mathbf{x^2+y^2=z^2} is *not* the same as
\setmathfont{Hypothetical Math Bold}
\(x^2+y^2=z^2\)
By the same token, it is incorrect to refer to the double-struck Greek
or italic symbol sets as math alphabets. U+2146 (ⅆ) is not the letter
‘d’ in double-struck italic style; it is unambiguously the differential
‘d’ with a rendering suitable for US patent applications. For
convenience of reference, it may be appropriate to find these symbols by
means of \mathbbit{d}, but \mathbbit{x} is an error.
To recap: If someone explicitly wants italic numbers, they’re asking
for something that does not exist. Tell them that.
—Joel Salomon
> Note also that I do not think the heavy alphabets are appropriate for
> emphasis: \mathbf{x^2+y^2=z^2} is *not* the same as
> \setmathfont{Hypothetical Math Bold}
> \(x^2+y^2=z^2\)
Right; unicode-math doesn't yet support LaTeX's "math versions" to
allow this sort of "bold-as-emphasis math font", but I've got plans
for it down the track.
> By the same token, it is incorrect to refer to the double-struck Greek
> or italic symbol sets as math alphabets. U+2146 (ⅆ) is not the
> letter
> ‘d’ in double-struck italic style; it is unambiguously the
> differential
> ‘d’ with a rendering suitable for US patent applications. For
> convenience of reference, it may be appropriate to find these
> symbols by
> means of \mathbbit{d}, but \mathbbit{x} is an error.
Not so sure here. At present, \mathbbit{} does only map the five
italic double-struck characters (as that's all it can do). If a font
wishes to define italic bb, however, (such as Linux Libertine Italic),
then I'm not opposed to mapping it to the \mathbbit command -- while
keeping the "unambiguous" characters mapped correctly to their unicode
code points.
Yes, unicode defines "every math glyph" and anything not in there
(supposedly) has never been used in maths before, but I also believe
that we shouldn't be restricting usage based simply on what is in
unicode. I people want, say, sans serif Greek, then we should let them
use it -- and if it catches on, then it can be added to unicode 6 or 7
or 17.
(I'm not yet willing to go so far for "bold double-struck" as that
seems more definitively tied to the idea of "bold-as-emphasis" rather
than "bold-as-semantics". Always willing to change my mind, however.)
--
Will
On 18/10/2009, at 4:06 AM, Chris Rowley wrote:
>
> Just for the record: the MathML guys have been just this week
> grappling with
> such questions in the far more limited context of the mathvariant
> attribute,
> which is used to declare that such font-related variants denote
> mathematical
> distinctions rather than simply varying the rendering.
Yes.
I agree with this completely.
>
> I think that authors should be using them to imply an absolute chnage
> to exactly which variant
> they want but they need to be warned that what they actually do in a
> particular document may
> depend on two things:
>
> the math-typography conventions in use
>
> the fonts and glyphs available.
True.
>
> The first point is important in that LaTeX should support many
> different conventions and make
> them reasonably easy to set up.
This is particularly relevant to me at this time of
the academic year. Exams are due.
I write mine using a TeX style that I developed
more than a decade ago. For each question I include
the answer, set entirely in bold-face, to differentiate
from the questions which are set in CM, and the layout
of the exam structure (question and part numbers, marks
allocated, etc.) which is mostly in sans-serif.
Thus different styles differentiate the different purpose
of the displayed information. Obviously the student is not
supposed to see the bold solutions. These are for the benefit
of the exam checker before the exam is submitted, and for the
marker (usually myself) once the exam has been sat.
Now LaTeX's \mathvariant macro is useful for switching
styles --- but this is *not* the same concept as MathML's
mathvariant attribute.
Maybe \mathvariant should have been called \mathstyle ?
There should be an even higher level macro, say \mathpurpose ,
with a constructor \newmathpurpose .
With these, I would declare \newmathpurpose{solution}{...}
in which the ... would define the math aspects for new
environments, declared via:
\newenvironment{solution}{...
\mathpurpose{solution}}%
{...}
Thus the expansion of \mathpurpose{solution} would include
the declaration \mathstyle{bold} or something similar;
ensuring that this is setup inside each usage of
\begin{solution} ... \end{solution} .
> Of course it also needs a 'base
> convention' which could be
>
> a derivative/extension of the ideas in UTR25;
>
> an extension of the AMS conventions;
>
> something we invent.
These should be at the level of \mathstyle .
But there should also be the higher concept of \mathpurpose .
Then an author just needs to question him/herself about
why he/she wants the maths to be in a particular style.
If it is because of a particular purpose, which does not
affect the meaning of any of the mathematics, just the way
it is presented, then this is the time to use a
\newmathpurpose declaration.
If, on the other hand, the desired style adds meaning
to how the mathematics should be interpreted:
such as super-/subscripts set in roman, greek, bold
to denote different things in tensor-/matrix- algebras
(e.g., as used by physicists studying non-flat spacetime
geometries);
then there needs to be special macros written to achieve
a good representation that captures the semantics, perhaps
within only specific contexts (such as super-/subscripts).
>
> The first two are probably similar but not identical since UTR25 tries
> to cover typical US
> Physicists math-conventions more than do the AMS.
>
> The last seems unnecessary and confusing!
>
> The second point will always be with us although it is probably
> sensible for the base set up
> to supply everytjing that can be donne with the final version of the
> STIX fonts (which may be
> somewhat more than what is covered by UTR25.
Some basic \mathpurpose ; e.g. \mathpurpose{usual}
with a collection of various \mathstyle{...} setups,
that contain the methods to do stylistic things with
various kinds of font or font-encoding.
Consider how this would fit with the \mathpurpose -- \mathstyle
distinction that I describe above.
>
> 2. Should the variation apply (in principle, although largely
> unattainable due
> to lack of meaning or lack of glyphs) to any character string (that is
> valid in math-mode)?
Oooh. By character string, do you mean "string of symbols"
(e.g., arbitrary math expressions) or just "string of letters" ?
>
> 3. Is such a general specification mechanism 'the same as' the lower-
> level Unicode-trick
> of applying 'a transformation to any suitable code-point' (here,
> suitability depends on the
> variant in use). Or does this need its own low-level commands which
> can be completely specified
> in terms of precise Unicode slot transformations and is directly
> equivalent to putting certain
> Unicode Math Alphanumeric (see UTR25) characters into the .tex file.
>
> chris
>> (I'm not yet willing to go so far for "bold double-struck" as that
>> seems more definitively tied to the idea of "bold-as-emphasis" rather
>> than "bold-as-semantics". Always willing to change my mind, however.)
>>
>> --
>> Will
I hope my musings here are useful.
Cheers,
Ross
------------------------------------------------------------------------
Ross Moore ro...@maths.mq.edu.au
Mathematics Department office: E7A-419
Macquarie University tel: +61 (0)2 9850 8955
Sydney, Australia 2109 fax: +61 (0)2 9850 8114
------------------------------------------------------------------------
> Yes, I think you are making pretty much the same types of distinction
> as I, with different names.
>
> I think you have 2 levels of 'math-styling': ie changes that do not
> indicate
> change of mathematical meaning:
>
> \mathpurpose and \mathstyle
>
> I maybe would call these \mathsetup and \mathstyle ???
>
> Neither of these indicates that the meaning of the mathematical object
> (whose glyph(s)
> is/are changed) changes, as in the following (random notation):
>
> If $\mathrm{GX}$ denotes the noramlised form of $GX$ then
> its double cover is denoted $\mathbf{GX}$.
>
> It is only this kind of change that both PMML and I (for PltxM) want
> to call mathvariant (\mathvariant).
(By the way, \mathrm is now \mathup because it incorporates Greek as
well. \mathrm is still available, of course. Not that any of this is
important right now.)
I agree with all of this. Hypothetically, you could define the
\mathXYZ commands as:
\DeclareRobustCommand \mathbf {\mathvariant{bf}}
\DeclareRobustCommand \mathscr {\mathvariant{scr}}
\DeclareRobustCommand \mathsf {\mathvariant{sf}}
and so on. While \mathstyle (née \mathversion ?!), hypothetically,
could be a "sans serif unicode maths font" that automatically fulfils
the necessary bf,scr,frak,etc. shapes -- but in reality may require
several different fonts for the different math variants.
* * *
(Now I'm going to think out loud for a few minutes.)
Along these lines, there's a very important distinction that is made
in LaTeX that I'm currently not honouring in unicode-math. In the
past, we've written things like $\mathit{Re}$ to denote multi-letter
variables such as "Reynolds number" (although I see on Wikipedia they
use $\mathrm{Re}$) where the text font is used instead of the maths
font (the big difference, of course, being kerning and ligatures).
In unicode-math, however, I use \mathit to access the italic letters
from a unicode maths font. I suppose this is wrong, the more I think
about it. But what alternative control sequence would work for when
you've got upright by default (e.g., TeX's uppercase Greek) and you
want italic?
On the other hand, many maths fonts won't even have an italic latin
ascii range. (STIX does, but STIX is slightly weird.)
So it seems like the only solution is that, by default, \mathit uses
math italic (plane 1), but an override should exist to allow it,
\mathit, to use text latin (ascii) instead -- which is *not* mirrored
by naked letters in math mode; i.e., $a$ still grabs the plane 1 glyph
instead.
Boy. And I thought I was getting somewhere with this package.
(There've been quite some commits over the last couple of months to
the GitHub repository <http://github.com/wspr/unicode-math> in which,
amongst adding features and removing bugs, there's now some more
documentation as well.)
-- Will
>> If people want, say, sans serif Greek, then we should let them
>> use it -- and if it catches on, then it can be added to unicode 6
>> or 7
>> or 17.
> Now I would not go that far! Unless you want to get involved in the
> techno-politics
> International Standards Committees.
BB assures me that there's been some change of heart in the relevant
committees and subsequent additions should be accepted without too
much gnashing of teeth.
> 1. Would it be better move to a \mathvariant commeand with #1: variant
> name
> #2:
> character string
Probably!
A huge inefficiency in unicode-math is the remapping of mathcodes
whenever changing math alphabets. This state of affairs is only
temporary, as I plan on moving to active mathchars as per breqn, but
it would be even simpler again to not allow constructions like
\mathbf{a+b}.
Of course, \mathit{Re} or \mathup{Re} as multi-letter variables is
still tricksome.
> 2. Should the variation apply (in principle, although largely
> unattainable due
> to lack of meaning or lack of glyphs) to any character string (that is
> valid in math-mode)?
Considering the odd or just unusual remapping that occurs for things
like nabla, digamma, the non-math plane "italic h", and so on, the
(albeit internal) machinery is all there to support arbitrary
characters if you want to wire up a new font to allow, say, "equals
sign with drop shadow" \mathdropshadow{=}
> 3. Is such a general specification mechanism 'the same as' the lower-
> level Unicode-trick
> of applying 'a transformation to any suitable code-point' (here,
> suitability depends on the
> variant in use). Or does this need its own low-level commands which
> can be completely specified
> in terms of precise Unicode slot transformations and is directly
> equivalent to putting certain
> Unicode Math Alphanumeric (see UTR25) characters into the .tex file.
Ah, that's something I've not thought much about yet. Is it the same
to write [math bold a] and \mathbf{a} ? By default, in unicode-math,
yes. But only because the mappings are defined the same; \mathbf{a}
doesn't map to [math bold a] in the input before the [math bold a]
glyph appears in the output.
I suppose it's relevant to note that these transformations will
sometimes be forced across font boundaries (especially if we start
talking about a "bold style" with a "bold variant" -- double-bold?).
So at some stage it becomes less a transformation between code points
and more a basic font change.
-- Will
There are multiple reasons to use a construction like \mathit, and they
have to be decoupled.
Here’s an example. I’m using fontspec+unicode-math for my thesis, the
text set in Constantia and the math in Cambria Math.
If I want to inject a bit of text into an equation, e.g.,
\[ a=b \quad \text{and \emph{also}} \quad y=z \],
then I want “and” in Constantia & “also” in Constantia Italic.
On the other hand, if I want to explicitly use italic style for “R×e”, e.g.,
\[ \mathvarit{Re} \]
then I want both letters in the math italic alphabet of Cambria Math,
with normal math spacing.
On the gripping hand, if I want to set the Reynolds number symbol in
italics, I need
\[ \mathtextit{Re} \]
to be different from both the above—actually, I probably want it to set
the letters in Cambria Italic (the text font, *not* Cambria Math!) with
normal text spacing.
Seems normal LaTeX uses \mathit to refer to the third case, while
unicode-math uses it for the second; and you want to change.
I’m not sure you ought to. In order to make \mathtextit work, you need
to define three fonts: a text font, a math font, and a math-text font.
For my thesis, these would be Constantia, Cambria Math, and Cambria.
But if the math font was Khaled Hosny’s Euler OTF, what would I choose?
—Joel Salomon
—Joel Salomon
> There are multiple reasons to use a construction like \mathit, and
> they
> have to be decoupled.
>
> Here’s an example. I’m using fontspec+unicode-math for my thesis, the
> text set in Constantia and the math in Cambria Math.
[snip, e.g.:]
> \[ a=b \quad \text{and \emph{also}} \quad y=z \],
> \[ \mathvarit{Re} \]
> \[ \mathtextit{Re} \]
Yes, this sums it up well.
> Seems normal LaTeX uses \mathit to refer to the third case, while
> unicode-math uses it for the second; and you want to change.
>
> I’m not sure you ought to. In order to make \mathtextit work, you
> need
> to define three fonts: a text font, a math font, and a math-text font.
> For my thesis, these would be Constantia, Cambria Math, and Cambria.
> But if the math font was Khaled Hosny’s Euler OTF, what would I
> choose?
Indeed. I think it's very important to make the distinction between
\textit and \mathit -- they won't be the same font unless you're using
a holistic font family such as Computer Modern.
But since this means that the "math-text" font will be undefined in
some cases, it doesn't make sense to have \mathit default to it. But
defining something like your \mathtextit command does seem quite
sensible.
Finally, note that for many purposes "\mathit that uses math plane
italic" will be perfectly fine for a substitute "\mathtextit that uses
italic ascii", since kerning and shape differences are fairly minor
most of the time.
Oh, and I should also mention that many people (I expect) will be
faking maths characters with italic ascii latin ones (see also Andrew
Moschou's mathspec package). Which means for their purposes that
\mathit and \mathtextit are identical anyway.
-- Will
I've shied away from such syntax before but I'll keep it in mind. I
prefer something like
\setmathfont[Range=\mathtextit]{Cambria Italic}
but if the "mathtext" font turns out to be more generally useful then
I'll need to re-think that.
In an ideal world I think there'd be a difference between upright text
latin and upright mathematical latin glyphs (and same for Greek but
more so). Some fonts in the future may even make this distinction via
OpenType features. In which case, using \mathtextup would be the
appropriate command (rather than \mathup) for operators such as \sin
and \lim.
In fact, I suspect I'll implement that command as well. I've added
\mathtextit and \mathtextup (pending final decision on their macro
names -- more suggestions welcome) to the issue tracker.
-- Will