Skip to content

Add latin-1 letters as math symbols#796

Merged
k4b7 merged 2 commits intoKaTeX:masterfrom
chrismessiah:add-latin-1-letters-as-math
Aug 19, 2017
Merged

Add latin-1 letters as math symbols#796
k4b7 merged 2 commits intoKaTeX:masterfrom
chrismessiah:add-latin-1-letters-as-math

Conversation

@chrismessiah
Copy link
Copy Markdown
Contributor

Currently katex throws an EOF parse error when receiving an input of latin-1 letters that is not inside a \text{} clause. To prevent this the latin-1 letters are added as math-symbols as well.

skarmavbild 2017-08-16 kl 09 47 12

@khanbot
Copy link
Copy Markdown

khanbot commented Aug 16, 2017

CLA signature looks good 👍

@sophiebits
Copy link
Copy Markdown
Contributor

I can't tell, is that Computer Modern in your screenshot? Not sure if our fonts support these chars.

@chrismessiah
Copy link
Copy Markdown
Contributor Author

Good catch. Didn't notice that they were using different fonts. What is the procedure for adding such letters to the font?

skarmavbild 2017-08-16 kl 21 46 54

@k4b7
Copy link
Copy Markdown
Member

k4b7 commented Aug 16, 2017

Oh noes... we aren't using CM for latin-1 chars inside \text either. Having this work correctly will require #632 and the some additional work to actually render combining marks for each of the accent types. We'll also need to update how we calculate the height (ascent) and depth (descent) for the combined glyphs that we construct. There's a fair amount of work involved so it's probably best to split it up. I'm okay with this diff as is, but we should aim for rendering CM glyphs for latin-1 eventually.

@edemaine
Copy link
Copy Markdown
Member

Given that KaTeX already supports math-mode accents, we should be able to macro each Latin-1 Unicode character in math mode to the corresponding accent command (ideally with a loop over the characters and a call to some Unicode splitting).

To fix Latin-1 characters in text mode, we should first do #638 (text-mode accent functions). Then we can follow the above approach.

@k4b7
Copy link
Copy Markdown
Member

k4b7 commented Aug 16, 2017

@edemaine can a macro be defined for something without a leading \?

@k4b7
Copy link
Copy Markdown
Member

k4b7 commented Aug 17, 2017

I've added a project to track work relating to latin-1 support.

Copy link
Copy Markdown
Member

@k4b7 k4b7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Normally I'd ask for screenshots, but I don't think they add much value in this case since we don't have the right fonts yet.

@edemaine
Copy link
Copy Markdown
Member

@kevinbarabash No, macros currently need to start with \. But we could easily add support for single-character macros (in the spirit of TeX active characters). I'll give it a try...

@edemaine edemaine mentioned this pull request Aug 17, 2017
@edemaine
Copy link
Copy Markdown
Member

Moving discussion to #801

@k4b7 k4b7 merged commit 81037e5 into KaTeX:master Aug 19, 2017
@ronkok ronkok mentioned this pull request Jan 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants