CarLaTeX
Inline math formulae in a justified paragraph are stretched.
How to avoid it for any formula in the paragraph?
```
\documentclass{article}
\usepackage{ragged2e}
\begin{document}
\justifying
Some text with a justified formula
$a+b+c=d$. How don't\linebreak stretch it?
I thought to put it in a box
\makebox{$a+b+c=d$}, but it is not\linebreak
a general solution.
\end{document}
```

Top Answer
Skillmon
The following changes the definitions of `\(` and `\)` to always put braces around the complete expression. Pay attention to [@barbara beeton's comment](https://topanswers.xyz/transcript?room=2048&id=138627#c138627), this might not always look good. Also line breaking of inline maths doesn't work this way.
You still get the default behaviour if you use `$...$` for inline maths.
```
\documentclass{article}
\usepackage{ragged2e}
\AddToHook{cmd/(/after}{\bgroup}
\AddToHook{cmd/)/before}{\egroup}
\begin{document}
\justifying
Some text with a justified formula
\(a+b+c=d\). How don't\linebreak stretch it?
Some text with a justified formula
$a+b+c=d$. How don't\linebreak stretch it?
I thought to put it in a box
\makebox{$a+b+c=d$}, but it is not\linebreak
a general solution.
\end{document}
```
