question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

After colon, dot and comma a whitespace is added.

See original GitHub issue

Describe the bug:

Katex renders a division colon :, a dot · and a comma , by adding a space after the sign: image

= \frac{24\color{blue}{:6}}{30\color{blue}{:6}}

Expected was: image

This can only be achieved by using {:} instead of :. But we cannot start to edit 100,000s of posts of our users that have used : and comma (German decimal!) in their latex.

Same situation is when using · instead of {·}: image

Same for comma: image

Q: How can we set up Katex to render accordingly so that no whitespace is added?


To Reproduce:

  1. Go to https://katex.org/

  2. Enter latex:

\frac{12}{100} = 0,12
\\
\frac{12}{100} = 0{,}12
  1. See different output:

image

Environment (please complete the following information):

  • KaTeX Version: 0.12.0
  • Device: Deskto
  • OS: Windows 10
  • Browser: Chrome
  • Version: 85.0.4

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
q2aprocommented, Sep 15, 2020

Thanks. I could fix the issue by calling the autorender extension with:

renderMathInElement(document.body, {
    delimiters: [
        {left: "$$", right: "$$", display: true},
        {left: "\\(", right: "\\)", display: false},
    ],
    macros: {
        ":": "{\\char`:}",
        ",": "{\\char`,}",
        "·": "{\\char`·}",
    },
    fleqn: true
});
0reactions
edemainecommented, Sep 15, 2020

Hmm, we must be running it differently? Here’s what I got with the same input (after adding \usepackage{color}):

image

I just confirmed on my local PDFLaTeX installation:

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Colon and the Semicolon - University of Sussex
While you're studying these examples, notice again that the colon is never preceded by a white space and never followed by anything except...
Read more >
Spacing with Punctuation
With a computer, use only one space following periods, commas, semicolons, colons, exclamation points, question marks, and quotation marks.
Read more >
Regex to add a space after each comma in Javascript
This regex checks the following character and only replaces if its no a space character. ... Always replace comma and n spaces by...
Read more >
space after colon - Microsoft Community
There is one space between the colon and the opening parenthesis. In the Replace With box, enter the expression. : \1. There are...
Read more >
How Many Spaces After a Period? One vs. Two Spaces - 2022
When in doubt, use single spacing in research papers, essays, and your creative writing. This is true regardless of whether your sentence ends ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found