# Putting extra brackets around equation adds whitespace to next line

As the title says, when I add an extra pair of {} brackets to the equation environment (on the outside), it adds a whitespace about the width of a space to the next line. Adding \noindent to the next line does not remove the space. Really I was trying to localize the scope of \medmuskip=3mu to the single equation with the brackets (see code below), which seems to have worked, but the whitespace is annoying me.

\documentclass[12pt]{report}
\begin{document}
\noindent Paragraph stuff lalala.
{\medmuskip=3mu
$$Ax=b$$}
Hello % there's an extra space before Hello
\end{document}

• \noindent won't work because this isn't the start of a new paragraph. \ignorespaces should wprk, but the easiest fix is to add a % after the closing brace, as stated in the answers. – barbara beeton May 26 '17 at 0:53

For eliminating white space on beginning of next paragraph add % after curly braces:

\documentclass[12pt]{report}
\usepackage{lipsum}

\begin{document}
\lipsum[1]
{\medmuskip=3mu
$$Ax=b$$
\lipsum[2]
\end{document}


• Ah, you deleted and then restored the same answer that I gave.... I'll remove mine since you beat me by three minutes. – JPi May 25 '17 at 23:11

The closing bracket seems to start a new paragraph. Add \noindent:

\documentclass[12pt]{report}

\begin{document}

\noindent Paragraph stuff lalala.
{\medmuskip=3mu
$$Ax=b$$}\noindent
Hello % there's an extra space before Hello

\end{document}

• hm, it seems that it sufficient to add % e.g.: }%. It not start new paragraph but insert spurious space (of one letter). – Zarko May 25 '17 at 22:22
• You're right. Actually , adding anything immediately after the bracket works. I'll remove my answer, as it's not the real explanation. Please write your own answer. – Bernard May 25 '17 at 22:26

Just set the parameter inside equation:

\documentclass[12pt]{report}

\begin{document}

\noindent Paragraph stuff lalala.
$$\medmuskip=20mu Ax=b+c$$
Hello

\noindent Paragraph stuff lalala.
$$Ax=b+c$$
Hello

\end{document}


This wouldn't work with amsmath alignments; here's a workaround: the optional argument to local must be assignments, the mandatory argument is the environment to use internally.

\documentclass[12pt]{report}
\usepackage{amsmath,xparse}

\NewDocumentEnvironment{local}{O{}m}
{#1\csname #2\endcsname}
{\csname end#2\endcsname\ignorespacesafterend}

\begin{document}

\noindent Paragraph stuff lalala.
\begin{local}[\medmuskip=20mu]{equation}
Ax=b+c
\end{local}
Hello

\noindent Paragraph stuff lalala.
\begin{local}[\medmuskip=20mu]{align}
Ax&=b+c\\
Bx&=d
\end{local}
Hello

\noindent Paragraph stuff lalala.
\begin{align}
Ax&=b+c\\
Bx&=d
\end{align}
Hello

\end{document}