Math & ScienceSpacing before '\left'

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
bdmckay
Posts: 2
Joined: Sat Nov 05, 2011 1:26 pm

Spacing before '\left'

Post by bdmckay »

This is something that bothered me for a while.

Code: Select all

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

\begin{document}
\[  x + F  \left( \frac{k}{q} \right) \]
\[  x + F \biggl( \frac{k}{q} \biggr) \]
\end{document}
Looking very closely, everything is the same except that the first display has more (in my opinion, too much) space between the F and the left parenthesis. Despite some effort I could not discover where this space comes from and why the two lines should appear different. What I'd really like is to get rid of the extra space in the first line so that it looks like the second. Thanks for any advice.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Spacing before '\left'

Post by Stefan Kottwitz »

By adding some braces you can reduce the spacing:

Code: Select all

\[  x + F  {\left( \frac{k}{q} \right)} \]
Stefan
LaTeX.org admin
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Spacing before '\left'

Post by Stefan Kottwitz »

Another fix by redefining \left and \right from here: Spacing around \left and \right:

Code: Select all

\documentclass[12pt]{article}
\usepackage{amsmath}
\let\originalleft\left
\let\originalright\right
\renewcommand{\left}{\mathopen{}\mathclose\bgroup\originalleft}
\renewcommand{\right}{\aftergroup\egroup\originalright}
\begin{document}
\[  x + F  \left( \frac{k}{q} \right) \]
\[  x + F \biggl( \frac{k}{q} \biggr) \]
\end{document}
Stefan
LaTeX.org admin
bdmckay
Posts: 2
Joined: Sat Nov 05, 2011 1:26 pm

Spacing before '\left'

Post by bdmckay »

Thanks, the big revelation from that page is that the problem comes all the way from plain TeX (which I just checked). No wonder I couldn't find it in the latex sources. The suggested redefinitions seem to work just fine; thanks again!

To Stefan: Your solution is essentially the same, but the group you made with braces has math type ordinary instead of mathopen so it won't space correctly in all circumstances.
Stefan_K wrote:Another fix by redefining \left and \right from here: Spacing around \left and \right:

Code: Select all

\documentclass[12pt]{article}
\usepackage{amsmath}
\let\originalleft\left
\let\originalright\right
\renewcommand{\left}{\mathopen{}\mathclose\bgroup\originalleft}
\renewcommand{\right}{\aftergroup\egroup\originalright}
\begin{document}
\[  x + F  \left( \frac{k}{q} \right) \]
\[  x + F \biggl( \frac{k}{q} \biggr) \]
\end{document}
Stefan
Post Reply