Skip to content

\Big{( is valid (though weird) LaTeX, but fails in KaTeX #3553

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

Open
nschloe opened this issue Feb 10, 2022 · 3 comments
Open

\Big{( is valid (though weird) LaTeX, but fails in KaTeX #3553

nschloe opened this issue Feb 10, 2022 · 3 comments
Labels

Comments

@nschloe
Copy link
Contributor

nschloe commented Feb 10, 2022

Here's a really weird one. The following math notation looks wrong (mind the order of the brackets), but compiles into LaTeX

\documentclass{article}

\begin{document}
\[
\Big{(a + b \Big)}^2
\]
\end{document}

screenshot

It fails in KaTeX, and really I can't blame KaTeX.

What's going on in LaTeX? \Big is a command that accepts one argument. As usual, if no brackets are here, it's just the first thing it sees, it many cases a bracket like \Big(. In the "typo" above, however, it takes the whole (a + b \Big) as argument, but it really only acts on the first bracket in there.

If you want to improve LaTeX compatibility, this could be fixed.

@nschloe nschloe added the bug label Feb 10, 2022
@edemaine
Copy link
Member

edemaine commented Feb 11, 2022

Fascinating; I didn't know this works in LaTeX, but I confirmed that it does. I wonder if \Big fully expands the first argument in order to get the first character? I'll have to look at the original code to be sure.

Granted, I don't think this is the most important thing to fix, but it'd be a small nicety. In any case, thanks for reporting. A PR would also be welcome!

@nschloe
Copy link
Contributor Author

nschloe commented Feb 11, 2022

I only got to the bottom of it after I asked the question on tex.so. You'll also find the expansion there.

@nschloe nschloe changed the title \Big{( is valid (bug weird) LaTeX, but fails in KaTeX \Big{( is valid (though weird) LaTeX, but fails in KaTeX Jun 9, 2022
@nschloe
Copy link
Contributor Author

nschloe commented Oct 14, 2023

The simpler case \Big{(} also fails with KaTeX (#3876).

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

No branches or pull requests

2 participants