Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add double prime symbol via " or \dprime #648

Merged
merged 1 commit into from Oct 24, 2016

Conversation

eoghanmcilwaine
Copy link
Contributor

Includes @stufflebear 's suggestion to call it "dprime" to be consistent with unicode-math.

@laughinghan
Copy link
Member

Since " is not synonymous with \dprime in real LaTeX ( http://mathb.in/63742 ), I think we should only use \dprime here and not have " at all, or if you want typing double-quote " to result in this, do CharCmds['"'] has the only mention of ". (Also, can you remind me why to normal primes '' doesn't suffice?)

@laughinghan
Copy link
Member

We could even do something like CharCmds['"'] = bind(LatexFragment, "''"); so that typing " would insert two normal primes

@eoghanmcilwaine
Copy link
Contributor Author

I've removed the " character binding and updated the pull request. Just checking that it's ok to include \dprime which seems to be specific to the unicode-math latex package?

The ability to render this as a single symbol is useful to us because (a) the cursor traverses it in one movement and (b) the appearance (size and spacing) is a bit better than either a plain " or two 's.

@laughinghan
Copy link
Member

laughinghan commented Oct 18, 2016

Just checking that it's ok to include \dprime which seems to be specific to the unicode-math latex package?

Well, your code actually outputs a double-quote, which does not render to the double-prime character, so we should change that.

But augh...outputting \dprime would not be okay. This is really frustrating. Compat with MathJax seems to be mutually exclusive with compat with "real LaTeX" here, to the extent that such a thing exists.

To display ″ (aka \u2033) in MathJax we have 2 options, either directly include the Unicode character in the LaTeX source, or use MathJax's custom \unicode{} extension (\unicode{x2033}), which nobody else supports.

The best claim to the throne of "real LaTeX" is pdfTeX (the default TeX engine in most LaTeX distributions), which doesn't support rendering arbitrary Unicode characters by hex code but in this case, by using the utf8x package, I was able to render ″ in [LaTeXiT](based on pdfTeX) by directly including the Unicode character in the LaTeX source. The newer TeX engines XeTeX and LuaTeX have full UTF-8 support and should also support directly including Unicode in the source. (More about the various TeX engines: overview, detailed.)

The unicode-math package doesn't actually add Unicode support to anything, it only works on XeTeX and LuaTeX anyway, it's actually just a convenience package providing backslash commands for every Unicode math symbol.

So now what?

Well, directly including the Unicode character in the LaTeX source has broad support, including even "real LaTeX" (pdfTeX) if utf8x is used. Let's go with that, and let's not do \dprime, which doesn't work in MathJax and would gratuitously add a dependency on unicode-math for XeTeX and LuaTeX.

This isn't ideal, of course. For one thing, if we're assuming support for directly including Unicode in the source, why not just do that for all symbols? I guess the answer is that where possible we use the commands supported by pdfTeX out-of-the-box, and only fallback to assuming utf8x if absolutely necessary (gotta document this). For another, apparently utf8x is discouraged in preference to utf8 because utf8x relies on the unmaintained ucs package, but I tried utf8 and it didn't support ″, so we're stuck with the deprecated dependency.

TL;DR I'll submit a PR to use the Unicode character for both input and output, never double-quote. (\dprime will still be accepted as input.)

laughinghan added a commit to laughinghan/mathquill that referenced this pull request Oct 18, 2016
Also, parse the Unicode char, so that it'll be symmetric.

Note that "real LaTeX" (pdfTeX) requires the utf8x package to work with
this Unicode char. It just works with MathJax and the newer TeX engines
XeTeX and LuaTeX, though, and I can't find any way to render that
character with pdfTeX out-of-the-box (in fact there's apparently no way
to render arbitrary Unicode characters by hex code [1]), so, this is the
best we got. Discussion:
mathquill#648 (comment)

[1]: http://tex.stackexchange.com/questions/289982/how-to-type-unicode-in-plain-tex/290011#comment703254_290032
@laughinghan laughinghan merged commit 57b4158 into mathquill:master Oct 24, 2016
laughinghan added a commit that referenced this pull request Oct 24, 2016
Add double prime symbol via `"` or \dprime
@eoghanmcilwaine
Copy link
Contributor Author

Thanks @laughinghan, we can definitely work with this. Appreciate the detailed information too!

laughinghan added a commit to desmosinc/mathquill that referenced this pull request Nov 24, 2016
 Conflicts:
	src/commands/math/basicSymbols.js
	  ARIA name for 'prime' added on master-dcg in line next to
	  line added by mathquill#648 on master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants