# WordPress.org

## LaTeX for WordPress Unnecessary space around formulae (4 posts)

1. Fifis
Member
Posted 1 year ago #

Dear Zhiqiang,

I am a Russian typesetter and writer. In general, there should be no space around the full stop sign (a point). However, the 3.4.6 update added that annoying feature that makes my paragraphs look poor due to isolated points. Just think of these examples, if it were rendered fully:

Suppose that f(x), which is negative, is a derivative of g(x).
Suppose that $$f(x)$$, which is negative, is a derivative of $g(x)$.
X is distributed exponentially (l = 4), which means...
$$X$$ is distributed exponentially ($$l = 4$$), which means...

Most people write this way, which is correct. There must be only one-side spacing around the formulae, which is provided by the <Space> key. In the second one, no spaces are needed at all. However, the 3.4.6 update ruins all the elegance and technical correctness of my texts.

Could you remove the forced space, please? A user should have a choice whether he needs spaces around or not. I should be most obliged if you considered an opportunity to make this an optional feature enabled at the admin panel. Many people copy fragments from their own works with expressions like “$f(x)$.” and “($f$ equals to $g$)” adjacent to the punctuation, and this plugin should not turn a properly typeset text into an improper one. LaTeX exists for ideal texts.

Yours sincerely,
Andreï Victorovitch Kostyrka.

2. davibarbosa
Member
Posted 1 year ago #

I totally agree!

3. Fifis
Member
Posted 1 year ago #

Solved! I figured it out!

At line 129 (ver. 3.4.6) or so you will see the following:

else return " <span class='MathJax_Preview'>".(get_option('latex_img_server')==""?"$$".(formula_text)."$$":"<img src='$cache_formula_url' style='".get_option('latex_imgcss')."$padding' class='tex' alt=\"".($formula_text)."\" />")."</span>".(get_option("mathjax_server") != ""?"<script type='math/tex'>".($formula_text)."</script> ":" ");

Eliminate the spaces before the opening “span class” and after the closing “/script”, like this:
else return "<span class='MathJax_Preview'>".(get_option('latex_img_server')==""?"$$".(formula_text)."$$":"<img src='$cache_formula_url' style='".get_option('latex_imgcss')."$padding' class='tex' alt=\"".($formula_text)."\" />")."</span>".(get_option("mathjax_server") != ""?"<script type='math/tex'>".($formula_text)."</script>":"");

The result is just as desired. I am currently maintatining a blog at http://kostyrka.ru/blog, and there are lots of formulæ in some posts, as you can see, and now they are perfectly and tenderly touched by commas and brackets.

4. sudosensei
Member
Posted 7 months ago #

The explanation needn't be so complex to showcase the issue with spacing around inline formulae. It's as simple as trying to say: each $$i$$th element .... I always do that to promote consistency and provide visual cues, but now it is impossible because the space ruins this. I find it really hard to understand what the motivation behind this change was.

Edit: Just tested your fix, Fifis. It works great. Thank you. Hopefully this will get an official "fix" soon.

This topic has been closed to new replies.