1

I thought to point out this strange problem. I was using code from answer in improving spacing between math expressions automatically? which changes the sqrt sign, so instead of

enter image description here

It now looks like

enter image description here

The strange thing, is that once I also load breqn, something strange happens. compare this

\documentclass[12pt]{book}

\usepackage{amsmath} 
\usepackage{breqn}

\iftrue
%see https://tex.stackexchange.com/questions/553382/improving-spacing-between-math-expressions-automatically
%added july 13, 2020
% Give a nicer sqrt symbol. 
\usepackage{letltxmacro}
\makeatletter
\let\oldr@@t\r@@t
\def\r@@t#1#2{%
    \setbox0=\hbox{$\oldr@@t#1{#2\,}$}\dimen0=\ht0
    \advance\dimen0-0.2\ht0
    \setbox2=\hbox{\vrule height\ht0 depth -\dimen0}%
    {\box0\lower0.4pt\box2}}
\LetLtxMacro{\oldsqrt}{\sqrt}
\renewcommand*{\sqrt}[2][\ ]{\oldsqrt[#1]{#2}\,}
\makeatother
\fi 

\begin{document}
\[
\frac{\sqrt{2}\, \mathrm{arctanh} \left(\frac{f \sqrt{2}}{2 \sqrt{c_{1}}}\right)}{\sqrt{c_{1}}}
\]

\end{document}

compiled with lualatex, gives

enter image description here

The letter f alignment becomes bad. It has fallen down. Compiling the above again, but without loading breqn, this is the output

enter image description here

Now f base is higher, which is the normal.

So for now I have removed the code which changes the sqrt sign and kept breqn, as I need this much more. This is the result

\documentclass[12pt]{book}

\usepackage{amsmath} 
\usepackage{breqn}

\begin{document}
\[
\frac{\sqrt{2}\, \mathrm{arctanh} \left(\frac{f \sqrt{2}}{2 \sqrt{c_{1}}}\right)}{\sqrt{c_{1}}}
\]

\end{document}

enter image description here

Who is at fault here? Is it breqn or is it the code from the above linked question which changes the sqrt sign that causes this alignment problem?

2
  • 1
    The comment to the code should be “how to get a worce sqrt sign”, not “nicer”.
    – egreg
    Dec 9, 2022 at 11:11
  • 1
    breqn changes essentially all aspects of math typesetting, there is no reason to expect patches to internal standard commands work as intended or even avoid low level errors if you load that package. Dec 9, 2022 at 11:44

1 Answer 1

2

The problem is not the f, but the root: it is too large. As has been mentioned in the comment (and in earlier answers) breqn redefines many aspects of math typesetting. That makes it quite fragil. Beside others it loads the mathstyle package which redefines the primitive \mathchoice command and that doesn't handle the square root with optional argument correctly. As one can see in the following it works if you force the scriptstyle manually or if you revert to the original \mathchoice (but this could break other things in breqn ...).

\documentclass[12pt]{book}
\usepackage{amsmath} 

\let\orimathchoice\mathchoice
\usepackage{mathstyle}

\begin{document}
\[
\frac{\frac{f\sqrt[x]{2}  \sqrt{2}}{2}}{xxx}
\]

\[
\frac{\frac{f\scriptstyle \sqrt[x]{2}\sqrt{2}}{2}}{xxx}
\]

\let\mathchoice\orimathchoice

\[
\frac{\frac{f\sqrt[x]{2}  \sqrt{2}}{2}}{xxx}
\]

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .