Skip to content

Add LaTeX #2306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed

Add LaTeX #2306

wants to merge 5 commits into from

Conversation

quantumsheep
Copy link

Add basic LaTeX language highlighting.

@joshgoebel
Copy link
Member

First question:

Is this different than:

https://github.com/highlightjs/highlight.js/blob/master/src/languages/tex.js

@quantumsheep
Copy link
Author

Oh, I didn't see it until now! Well, I think we can close this PR 😢

@quantumsheep
Copy link
Author

Reverting my choice, the actual implementation is not that great, I tried to fit the same highlighting as GitHub does for LaTeX files. This can be discussed tho.

@quantumsheep quantumsheep reopened this Dec 4, 2019
@joshgoebel
Copy link
Member

Our tex grammar looks a bit more complex than yours. What does it NOT handle properly if you run the included sample tests against it?

@quantumsheep
Copy link
Author

It does not properly handle text inside {} and [], it colors it as string but it shouldn't in certain cases, \textit{} for example. But I should make modifications to the existing code instead of creating a new one.

@joshgoebel
Copy link
Member

But I should make modifications to the existing code instead of creating a new one.

Exactly! Unless it's VERY VERY badly broken, indeed... but still the PR would need to be change against the existing source, not a whole new file...

And I think we probably could add "latex" as an alias here also (if you're going to submit a new PR).

Closing this PR. Another one that modifies the existing grammar would be great!

@joshgoebel joshgoebel closed this Dec 6, 2019
@quantumsheep
Copy link
Author

I'll work on it!

@quantumsheep quantumsheep deleted the add-latex branch December 6, 2019 19:31
@joshgoebel
Copy link
Member

Should I assume you actually use Latex in a career or hobby? Is Latex the more popular naming vs "Tex"?

@quantumsheep
Copy link
Author

quantumsheep commented Dec 7, 2019

I use it for both career and hobby! TeX is the markup language, LaTeX is a document maker using TeX, I badly named my PR too haha.

@joshgoebel
Copy link
Member

Yes, I googled since then... though for practical purposes I'm still thinking perhaps Tex/Latex as a single language makes more sense here, what do you think?

Latex is really a super-set of Tex (or a library built on top of it, etc), yes?

@quantumsheep
Copy link
Author

quantumsheep commented Dec 7, 2019

LaTeX seems more like a package for the Tex language since it only introduce macros (\textit, \section and a lot more). But it could makes sense to use "LaTeX" while speaking about Tex since it's what's more commonly used.

We can compare it to the JavaScript, we could say "ECMAScript" but we say "JavaScript".

@joshgoebel
Copy link
Member

LaTeX seems more like a package for the Tex language since it only introduce macros (\textit, \section and a lot more).

Right, so LaTex would cover both Tex and Latex... but Tex wouldn't include Latex. (if we're being technical). We have precedent already for using supersets... like using JSON for Json + Comments, and using INI for INI + TOML, etc...

@quantumsheep
Copy link
Author

Most LaTeX highlighters call the language "LaTeX" so yeah, it would include TeX and LaTeX coloration if we would make it perfect (italic text for \textit, specific coloration for \documentclass, etc...).

When I have time I'll work on an upgrade of the current version in hightlight.js.

@egor-rogov
Copy link
Collaborator

I use LaTeX too. There are couple of other systems built on top of TeX, like XeTeX and LuaTeX, but looks like LaTeX is most popular. AFAIK no one uses bare TeX these days.
I totally agree that we should extend existing TeX grammar to cover LaTeX extensions. No need for two different languages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants