13

I stumbled across this line in chktex (here) with a note saying

This is a warning which you may ignore, but for maximum aestethic pleasure, you should enclose your bracket characters with `{}'s.

What happens (technically) if I add these brackets?

The following MWE shows the difference with and without the additional brackets; note that the version with the additional brackets results in the superscript being a little bit higher (which, according to chktex seems to be preferred?).

\documentclass{scrartcl}
\title{}
\begin{document}

\begin{equation}
\{X\}^T
{\{X\}}^T
\end{equation}

\end{document}

enter image description here

dpaetzel
  • 133

2 Answers2

19

Apparently, the developer of chktex advises to always do something like

{(a+b)}^2

which is not what's normally done. There's no need for it and the output is very disputable in typographic terms: compare by yourself, left the normal, right the braced combo:

\documentclass{article}
\begin{document}

\begin{equation}
(a+b)^2 \quad {(a+b)}^2
\end{equation}

\begin{equation}
(\sqrt{2}+1)^2 \quad {(\sqrt{2}+1)}^2
\end{equation}

\end{document}

enter image description here

The second one is obviously wrong. The warnings of chktex are

Warning 3 in badchk.tex line 5: You should enclose the previous parenthesis with `{}'.
(a+b)^2 \quad {(a+b)}^2
    ^
Warning 3 in badchk.tex line 9: You should enclose the previous parenthesis with `{}'.
(\sqrt{2}+1)^2 \quad {(\sqrt{2}+1)}^2
           ^

and I heartily disagree.

egreg
  • 1,121,712
  • 3
    On one hand it is uglier with the dynamically scaling exponent height, but on the other hand semantically in tex (a+b)^2 means that the right parenthesis has a superscript, rather than the whole expression, which makes me feel unclean. – SamYonnou Feb 25 '20 at 22:49
  • 1
    @SamYonnou Don't feel unclean. That's how it has been done for a few centuries. The exponent is indeed to the whole expression delimited by the parenthesis: no need to add levels. – egreg Feb 25 '20 at 22:49
  • I mean in tex as a computer language specifically, not in conventional mathematical notation – SamYonnou Feb 25 '20 at 22:51
  • @SamYonnou Really, that's the way it should be done. Braces around math material make a subformula, where spaces are frozen and other things happen. Sometimes it's useful, generally it isn't. – egreg Feb 25 '20 at 22:54
2

Using braces seems to be either irrelevant or bad.

In display mode,

\documentclass{article}

\begin{document}

\begin{equation}
\left(\sqrt 2 + 1\right)^2 = {\left(\sqrt 2 +1\right)}^2
\end{equation}

\end{document}

enter image description here

the result is identical.

Inline, using braces disturbs the interline spacing.

No braces (\sqrt 2 + 1)^2:

enter image description here

Braces {(\sqrt 2 + 1)}^2:

enter image description here

Conclusion: disable chktex Warning 3 permanently.

Damien L
  • 621