mosra / m.css

A no-nonsense, no-JavaScript CSS framework, site and documentation theme for content-oriented websites
https://mcss.mosra.cz
Other
406 stars 92 forks source link

Doxygen Latex Inline #106

Closed goldbattle closed 5 years ago

goldbattle commented 5 years ago

Is there a specific syntax I should be following to get proper inline equation formatting? It looks like if I follow this the m-math class is not added properly to the svg. I am on commit 97e5cca1c99aed335107add0ac35dddfe57613c7.

Example:

The distance between \f$(x_1,y_1)\f$ and \f$(x_2,y_2)\f$ is 
\f$\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}\f$.

\f[
|I_2|=\left| \int_{0}^T \psi(t) 
       \left\{ 
          u(a,t)-
          \int_{\gamma(t)}^a 
          \frac{d\theta}{k(\theta,t)}
          \int_{a}^\theta c(\xi)u_t(\xi,t)\,d\xi
       \right\} dt
    \right|
\f]

\f{eqnarray*}{
  g &=& \frac{Gm_2}{r^2} \\ 
    &=& \frac{(6.673 \times 10^{-11}\,\mbox{m}^3\,\mbox{kg}^{-1}\,
        \mbox{s}^{-2})(5.9736 \times 10^{24}\,\mbox{kg})}{(6371.01\,\mbox{km})^2} \\ 
    &=& 9.82066032\,\mbox{m/s}^2
\f}

image

goldbattle commented 5 years ago

I was able to fix this by removing the following in plugins/latex2svgextra.py: https://gist.github.com/goldbattle/c230bfcc56efdbb3442f385f486a5547/revisions#diff-4e8e7edf1a3bb5316b79ca3b5a5eafbf

< _patch_src = re.compile(r"""<\?xml version='1\.0' encoding='UTF-8'\?>
---
> _patch_src = re.compile(r"""<\?xml version='1\.0'\?>

Seems that the output of dvisvgm was slightly different, thus the regex failed. I am on Ubuntu 16.04 with dvisvgm (TeX Live) 1.9.2.

mosra commented 5 years ago

Hi, thanks for the report and sorry for my delayed reply -- been busy with other projects. I pushed the above as 29ddf48aa3e0cf46b60fd (ignoring the encoding attribute if it's not there).

One note though -- 1.9.2 is extremely buggy and even though the above makes it work at least partially, I doubt it fixes the vertical misalignment (seen on the screenshot above). I was fighting this for a while until I ultimately gave up: https://github.com/mosra/m.css/pull/75 . If you can, upgrade to 2.2 (18.04) at least, the output will get much better :)

goldbattle commented 5 years ago

Fixed it for me, thanks!