6

When working on an additional answer to this question of mine, I stumbled across the following problem with \mathpalette. For simplicity I give an example where in practice it is ridiculous to use \mathpalette: \mathpalette{}{B}_b gives the output , whereas the straightforward B_b gives . Note that in the latter version the subscript is closer to the "B", which is good. If instead of \mathpalette one uses the version \mathchoice{B}{B}{B}{B}_b, one (of course) has the same problem.

Is there a way around this problem? (I mean other than \mathpalette{}{B_b}, which is not an option for what I need.)

Hendrik Vogt
  • 37,935

2 Answers2

4

Short answer: no. If you use \mathchoice, this is unavoidable.

Luatex offers a way to do \mathstyle-based typesetting without having to fall back on \mathchoice, see my answer to this question for details.

Taco Hoekwater
  • 13,724
  • 43
  • 67
  • You have the habit of posting negative answers to my questions ;-). I fear that again I'll have to accept your answer. Still this property of \mathchoice is a bit annoying, isn't it? – Hendrik Vogt Oct 08 '10 at 09:35
  • I really am sorry about those negative answers, but then, that is one reason for the existence of luatex. See my answer to http://tex.stackexchange.com/questions/1223/ for a luatex-based solution to this problem. – Taco Hoekwater Oct 08 '10 at 09:42
  • OK, that question is indeed very much related to my question, and your LuaTeX-answer looks quite good indeed. I think the link should go into your answer here; then the answer would be a lot less negative! – Hendrik Vogt Oct 08 '10 at 10:00
4

As I understand it the \mathchoice gives you choice item in the math list; the _b gives you an ord atom with no nucleus or superscript. In contrast, B_b gives you a single ord atom with a nucleus and subscript.

You can look at this by using \showlists in TeX.

$\mathchoice{B}{B}{B}{B}_b\showlists$
$B_b\showlists$
\bye

Then in the log, you see for the first math list,

\mathchoice
D\mathord
D.\fam1 B
T\mathord
T.\fam1 B
S\mathord
S.\fam1 B
s\mathord
s.\fam1 B
\mathord
_\fam1 b

and for the second, you get

\mathord
.\fam1 B
_\fam1 b

Note the \mathord in the penultimate line of the first list.

This is described in Chapters 17 and 26 of the TeXbook.

TH.
  • 62,639
  • @TH: This doesn't really answer my question, but it nicely explains the behaviour I observed. Thank you! Now I'm a bit uncertain which answer to accept ... – Hendrik Vogt Oct 08 '10 at 09:52
  • @Hendrik Vogt: Taco answered your question. I just looked up why the answer was no. :) – TH. Oct 08 '10 at 10:03