...
> I like to type unicode characters directly in the source code; for
> example:
> The suit is =E2=99=A0. The floor of `x` is `=E2=8C=8Ax=E2=8C=8B`.
> (I set :math: as the default role in conf.py). In the HTML output, this
> works beautifully for both regular text and jsmath equations.
> Today I tried to generate a LaTeX version of the handout, and some symbols
> (like card suits) weren't properly converted to their LaTeX counterparts. I
> wrote this little extension that does the mapping:
> http://gist.github.com/652626
> Unfortunately, this does not work for symbols within math roles. In the
> example above, the suit is converted, but the floor delimiters aren't. The
> workaround would be to start using `\lfloor x\rfloor` in my .rst source
> file, but I really want to keep the cleaner version above. Typing `=CE=94=
>=CF=89` by
> using vim digraphs is much more convenient than `\Delta\omega`.
> Is there a simple way to map unicode symbols within math roles to their
> LaTeX versions?
I suppose that the UnicodeChar -> LaTeX conversion only works for
text. To get a similar setup for math, you will need to
configure/extend/modify the math extension (mathbase.py in shinx/ext).
(This way you can also set up separate conversions for text- and
math-mode avoiding a lot of \ensuremath.)
Günter
You can use latex_elements['utf8extra'] in conf.py, e.g.: