latex3 / unicode-math

XeLaTeX/LuaLaTeX package for using unicode/OpenType maths fonts
http://ctan.org/pkg/unicode-math
LaTeX Project Public License v1.3c
243 stars 28 forks source link

Allow use of CM (cm-super) #388

Closed ViktorQvarfordt closed 7 years ago

ViktorQvarfordt commented 7 years ago

I must be missing something, but why not support the font we all know and love? You'll tell me to use LM instead, well it does not give satisfactory results. Example:

CM: image

LM: image

Produced with xelatex and

\documentclass[a4paper]{article}
\usepackage{mathrsfs}
\begin{document}
$\mathcal{H}\mathscr{H}$
\end{document}

and

\documentclass[a4paper]{article}
\usepackage{unicode-math}
\begin{document}
$\mathcal{H}\mathscr{H}$
\end{document}

Besides the result being wrong, LM has terrible hinting (why?). Next you'll tell me to use another math font. I might respond with that font not going well with CM as I want for the text. But that's not the point: I don't want to use another math font, CM gives good results, lets support it!

Using the standard CM for unicode math input can be achieved by

\documentclass[a4paper]{article}
\usepackage{newunicodechar}
\newunicodechar{α}{\alpha}
\begin{document}
$α$
\end{document}

giving image as expected.

davidcarlisle commented 7 years ago

As far as I know, cm-super does not include an opentype math font does it? that is one with the math layout specified via an opentype Math table rather than via traditional tex tfm metrics. (If it does now, it should work with Unicode math) If you are using the classic TeX math font metrics then there is nothing for Unicode-math to do, surely?

David (not a unicode-math package developer but an interested observer:-)

ViktorQvarfordt commented 7 years ago

Sure, but (not mockingly) who cares? Correct me if I'm wrong, but the purpose of unicode-math is to allow us to input unicode and get the expected output. As demonstrated, this is doable with CM. I'm certain that this is a wanted feature. Let's do it!

(Arguably, using a font that is not CM does not give the expected output. But I don't want to or need to use this line of argument, since my point is: People want CS. It can be done. Let's do it.)

davidcarlisle commented 7 years ago

sorry I do not understand.

You can use tfm based math fonts already in luatex and xetex without using unicode-math. The whole point of unicode-math is to set things up for the completely different internal setup required to handle opentype math tables.

what would you want unicode-math to do other than just quit and do nothing?

perhaps you are looking for something like mathspec package which sets up math using the traditional math layout engine but using unicode text fomnts wheer appropriate?

On 29 April 2017 at 23:29, Viktor Qvarfordt notifications@github.com wrote:

Sure, but (not mockingly) who cares? Correct me if I'm wrong, but the purpose of unicode-math is to allow us to input unicode and get the expected output. As demonstrated, this is doable with CM. I'm certain that this is a wanted feature. Let's do it!

(Arguably, using a font that is not CM does not give the expected output. But I don't want to or need to use this line of argument, since my point is: People want CS. It can be done. Let's do it.)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/wspr/unicode-math/issues/388#issuecomment-298198480, or mute the thread https://github.com/notifications/unsubscribe-auth/ABNcAt2arE2QhlH-yl0EhvDeCvlrbCuxks5r07nIgaJpZM4NMZbj .

ViktorQvarfordt commented 7 years ago

mathspec is the opposite of what I want, mathspec alters the output, I'm talking about altering the input yet having the same output.

what would you want unicode-math to do other than just quit and do nothing?

Allow me to write α in my source instead of \alpha and still get the standard LaTeX output (with CM font).

Perhaps this is not at all what unicode-math is about, then close this issue (and please explain to me why, because clearly one feature of unicode-math is to allow for α in the source instead of \alpha).

davidcarlisle commented 7 years ago

On 29 April 2017 at 23:57, Viktor Qvarfordt notifications@github.com wrote:

Perhaps this is not at all what unicode-math is about, then close this issue (and please explain to me why, because clearly one feature of unicode-math is to allow for α in the source instead of \alpha).

but it is about setting up fonts that follow the unicode math block so for example it maps your input α (U+03B1) to U+1D6FC which is MATHEMATICAL ITALIC SMALL ALPHA in Unicode but if you are not using an OpenType Math font then this slot is most likely empty in the font. Essentially nothing that Unicode-math does applies to a font that is not an OpenType math font.

ViktorQvarfordt commented 7 years ago

Ok, I see.

Essentially nothing that Unicode-math does applies to a font that is not an OpenType math font.

Could we not extend the coverage of unicode-math then?

davidcarlisle commented 7 years ago

On 30 April 2017 at 00:45, Viktor Qvarfordt notifications@github.com wrote:

Ok, I see.

Essentially nothing that Unicode-math does applies to a font that is not an OpenType math font.

Could we not extend the coverage of unicode-math then?

That's up to Will:-)

It could only be extended in the sense that you could extend the package to typeset tables or include images or anything else TeX does, by taking an entirely different set of definitions and artificially appending them to the end of the file.

It would be more useful, and less confusing, if you (or someone) made a small extension of the newunicodechar package that defined α to be \ensuremath{\alpha} and similarly the other standard math characters. Note that would be then usable in pdftex as well (an indication of just how unrelated to the unicode-math package that is)

jfbu commented 7 years ago

Le 30 avr. 2017 à 09:59, David Carlisle notifications@github.com a écrit :

It would be more useful, and less confusing, if you (or someone) made a small extension of the newunicodechar package that defined α to be \ensuremath{\alpha} and similarly the other standard math characters. Note that would be then usable in pdftex as well (an indication of just how unrelated to the unicode-math package that is)

for pdftex only, and Greek letters only, package [alphabeta] (http://www.ctan.org/pkg/alphabeta) does that (in particular). Edit: it does not do \ensuremath but uses \TextOrMath branching.

corrected link: http://www.ctan.org/tex-archive/language/greek/greek-fontenc

JF

ViktorQvarfordt commented 7 years ago

I might create such a package. Alphabeta is limited to only greek chars.

I'll start by just parsing https://raw.githubusercontent.com/wspr/unicode-math/master/unicode-math-table.tex.

However, in that file I see lots of non-standard definitions \muptau, and \BbbC, etc. Where do these come from? Suggestions for how to best translate them back to standard LaTeX?

ViktorQvarfordt commented 7 years ago

I did it: https://github.com/ViktorQvarfordt/unicode-latex. Still WIP but all is there, it works. Except sub/superscripts, see the todo remark in the readme. Anyone knows how to implement parsing of ¹² to ^{12}?

If anyone likes this, I welcome all contribution and collaboration.

wspr commented 7 years ago

On 30 Apr 2017, at 11:38 pm, Viktor Qvarfordt notifications@github.com wrote:

However, in that file I see lots of non-standard definitions \muptau, and \BbbC, etc. Where do these come from? Suggestions for how to best translate them back to standard LaTeX?

They’re part of a now semi-official mapping from TeX commands to Unicode characters. Hard to automate the mapping but should be fairly understandable which ones are supported by plain LaTeX and which are not.

wspr commented 7 years ago

On 2 May 2017, at 6:14 am, Viktor Qvarfordt notifications@github.com wrote:

I did it: https://github.com/ViktorQvarfordt/unicode-latex. Still WIP but all is there, it works.

Great stuff.

Except sub/superscripts, see the todo remark in the readme. Anyone knows how to implement parsing of ¹² to ^{12}?

unicode-math does this already — you could try to grab that code if you’re familiar in any way with expl3. See the function “\@@_scan_sscript:” in the DTX files. Actually now that I look at it I see it needs a re-write :) But it would still get you started.

Cheers, Will

wspr commented 7 years ago

To summarise, as @davidcarlisle mentioned, extending unicode-math to handle legacy maths is not really on the radar — so I'll close this issue now.