unicode-math icon indicating copy to clipboard operation
unicode-math copied to clipboard

Subscripts treated as normal letters in command names

Open thirs opened this issue 6 years ago • 5 comments

Description

Writing \mooᵥ results in an "Undefined control sequence" error. How easy would it be to stop command names when sub/superscripts characters are encountered?

Check/indicate

  • [X] Relevant for XeTeX
  • [X] Relevant for LuaTeX
  • [X] Issue tracker has been searched for similar issues?
  • [ ] Links to <tex.stackexchange.com> discussion if appropriate

Minimal example demonstrating the issue

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{texgyrepagella-math.otf}
\begin{document}
\[
  \mooᵥ
\]
\end{document}

Further details

thirs avatar Sep 27 '18 09:09 thirs

They are letters.

If you mean to use ᵥ (U+1D65 LATIN SUBSCRIPT SMALL LETTER V) in place of _{v}, don't. If you insist, then

\usepackage{newunicodechar}
\newunicodechar{ᵥ}{\ifmmode_{v}\elseᵥ\fi}

but don't hope that, after similar definitions for the other subscripts characters, something like

$xᵥₐ$

works.

eg9 avatar Sep 27 '18 10:09 eg9

Ok... thanks for your answer. Would you please mind explaining why hoping to use ᵥ instead of _{v} is wrong? It does make latex code much more readable.

thirs avatar Sep 27 '18 11:09 thirs

On Thu, 27 Sep 2018 at 12:09, thirs [email protected] wrote:

Ok... thanks for your answer. Would you please mind explaining why hoping to use ᵥ instead of _{v} is wrong? It does make latex code much more readable.

If you make it an active character expanding to _{v} as then it is OK, but if you just set it directly as a subscript character then the positioning will be inconsistent with all other subscripts and always be positioned at a fixed position below the baseline:The position of _{v} varies depending on the depth of the base and also on the size of any superscript that is on the same base.

The Unicode sub and superscript characters are really designed for simple text usage and not to fit in with a math layout

David

davidcarlisle avatar Sep 27 '18 11:09 davidcarlisle

Thanks David. How about adding these active characters as an option?

thirs avatar Sep 27 '18 12:09 thirs

@davidcarlisle / @eg9 — unicode-math (perhaps foolishly) already interprets these unicode chars as if the user intended to write a maths subscript (like how ' works in traditional LaTeX). If I was to re-write the package I'd probably drop this feature, but it seems popular (-ish).

The only problem here is that is catcode 11. So no need for newunicodechar etc:

\documentclass{article}
\usepackage{unicode-math}
\def\moo{m}
\catcode`\ᵥ=12
\begin{document}
\[ \mooᵥᵥ \]
\end{document}

I'll consider a package option to do this automatically.

wspr avatar Oct 03 '18 14:10 wspr