wspr / breqn

Automatic line breaking in LaTeX equations
18 stars 2 forks source link

Lower case greek and mathit #5

Open imbrish opened 9 years ago

imbrish commented 9 years ago

I've just found out that if I combine breqn with mathit and lower case greek letters I get weird results. For example

\documentclass{article}
\usepackage{breqn}
\begin{document}
\begin{math}\mathit{\pi}\end{math}
\end{document}

Compiles to Compiled code Upper case letters display fine.

jborme commented 6 years ago

This also happens with \mathrm{}, \it, \bf. It does not require one to use the dmath environment, loading the breqn package in the preamble is enough. The following produces the same buggy output (\pi compiles to the same as \ss).


\documentclass{article}
\usepackage{breqn}
\begin{document}
$\mathrm{\pi}$
\end{document}
jg110 commented 4 years ago

Checking in to report that this is still a bug, in my case with \mathbf. Including the breqn package in the document makes all of my lower case Greek letters with \mathbf turn into random other characters inside equation environments, even without using any dmath environments in my document.

My distribution is texlive from the Fedora repository.

dryabov commented 4 years ago

The \pi is expanded into \mathchar"0119 without breqn, and into \mathchar"7119 with it. I'm not sure, but most likely it is necessary to change the category of greek letters from Var to Ord. The following code after \usepackage{breqn} fixes the problem:

\DeclareFlexSymbol{\pi}{Ord}{greek}{19}
dryabov commented 4 years ago

Uppercase Greek letters should be of Var category (see https://github.com/wspr/breqn/blob/master/flexisym.dtx#L789-L799 - correct), but lowercase Greek letters should be Ord (see https://github.com/wspr/breqn/blob/master/flexisym.dtx#L824-L852 - incorrect).

dryabov commented 4 years ago

BTW, the same is true for \imath and \jmath (both should be Ord).

wspr commented 4 years ago

Thanks much for the detailed feedback here, really appreciate it. Unfortunately it will take me some time to make these changes and add test files — sorry for the inconvenience.