Page MenuHomePhabricator

Breaking a line after </math> even if a non-space symbol follows
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue:

  • (let <math>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</math>)
  • Lorem ipsum dolor sit amet, consectetur adipiscing elit <math>K</math>-theory

Non-space symbol after </math> jumps to a new line, but shouldn't.

Instead of this behaviour we could assume that a non-breaking symbol exists after </math>:

  • (let {{nowrap|<math>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</math>)}}
  • Lorem ipsum dolor sit amet, consectetur adipiscing elit {{nowrap|<math>K</math>-theory}}

Event Timeline

Bezik renamed this task from Breaking line after </math> even if non-space symbol follows to Breaking a line after </math> even if a non-space symbol follows.Dec 20 2022, 12:40 PM
Bezik updated the task description. (Show Details)
Physikerwelt subscribed.

Unfortunately, I don't see the problem in my screenshot from https://www.mediawiki.org/wiki/Extension:Math/T325625

Screenshot 2022-12-20 at 13-57-23 Extension Math_T325625 - MediaWiki.png (362×1 px, 58 KB)

Please be more specific regarding the HTML output to be produced.

At least in Firefox 107.0.1 (Linux, 64-bit):

symbol-after-math-bug.png (230×1 px, 31 KB)

OK. I get the idea. So the LaTeX equivalent is that one should write Section~\ref{sc.intro} instead of Section \ref{sc.intro}. Is that the problem to be solved? This brings me to the idea to check how cite does it.

You can fix that in your local wiki by adding a CSS rule

.mwe-math-element {
  white-space: nowrap;
}

Thank you, CSS fix works (I've added the rule to local user CSS and checked it in .ru wiki)

I suppose the issue should be fixed globally, because a breaking the line before parenthesis, punctuation sign etc. looks rough… Some editors to prevent line breaking writes something like "by variable <math>x,</math> and…" or "<math>p-</math>adic" (put textual comma or dash inside formulas). So, I hope it could be prevented automatically.

You can fix that in your local wiki by adding a CSS rule

.mwe-math-element {
  white-space: nowrap;
}

Sure, but this probably should be added everywhere if it’s a good CSS rule to have.