0

To improve legibility, I'd sometimes like to reinstate display-style spacing in sub- or superscripts. However, adding \displaystyle also changes the font size and switches \tfrac to \frac, as can be seen from the following example

enter image description here

\documentclass{scrartcl}
\usepackage{mathtools}

\begin{document}
\begin{align}
&e^{-S[\phi] + J \cdot \phi - \frac{1}{2} \phi \cdot R_k \cdot \phi - J \cdot \varphi_k + \frac{1}{2} \varphi_k \cdot R_k \cdot \varphi_k}\\
&e^{\displaystyle-S[\phi] + J \cdot \phi - \frac{1}{2} \phi \cdot R_k \cdot \phi - J \cdot \varphi_k + \frac{1}{2} \varphi_k \cdot R_k \cdot \varphi_k}
\end{align}
\end{document}

How can I increase spacing around operators like +, -, \cdot without affecting any other part of the output?

2
  • 1
    Normally, \mathbin spacing goes away in smaller (\scriptstyle) math sizes that are found in sub/super-scripts. You can manually add it back in the manner of \,+\,, etc., though I presume there is an automatic way to do this as well (though I don't know it). However, egreg will tell you not to do it: tex.stackexchange.com/questions/219278/…. See also tex.stackexchange.com/questions/214147/… Apr 17, 2017 at 14:21
  • \displaystyle is a bit excessive in a superscript, you could use \textstyle but it would still increase the font size Apr 17, 2017 at 14:29

2 Answers 2

2

You could locally make - and + mathop rather than mathbin then they would get thin (rather than medium) space, even in superscripts

enter image description here

\documentclass{scrartcl}
\usepackage{mathtools}

\begin{document}
\begin{align}
&e^{-S[\phi] + J \cdot \phi - \frac{1}{2} \phi \cdot R_k \cdot \phi - J \cdot \varphi_k + \frac{1}{2} \varphi_k \cdot R_k \cdot \varphi_k}\\
&e^{\textstyle -S[\phi] + J \cdot \phi - \frac{1}{2} \phi \cdot R_k \cdot \phi - J \cdot \varphi_k + \frac{1}{2} \varphi_k \cdot R_k \cdot \varphi_k}\\
&e^{
\mathcode`\+="102B
\mathcode`\-="1200
 -S[\phi] + J \cdot \phi - \frac{1}{2} \phi \cdot R_k \cdot \phi - J \cdot \varphi_k + \frac{1}{2} \varphi_k \cdot R_k \cdot \varphi_k}
\end{align}
\end{document}

Although that also loses the automatic loss of spacing for the prefix - unless you use {-}S

2
  • The third option looks nice. What would be the \mathcode to increase spacing for \cdot? Is there some place to look these up?
    – Janosh
    Apr 17, 2017 at 14:51
  • @Casimir \mathchardef\cdot="1201 Apr 17, 2017 at 15:08
2

Use the \exp notation.

\documentclass{scrartcl}
\usepackage{mathtools}

\begin{document}
\begin{itemize}
\item Equation \eqref{A} is unreadable
\item Equation \eqref{B} is confusing
\item Equation \eqref{C} is right
\item Equation \eqref{D} is better: the dot is almost never used
\item Equation \eqref{E} is possibly better
\end{itemize}
\begin{align}
\label{A}
&e^{-S[\phi] + J \cdot \phi - \frac{1}{2} \phi \cdot R_k \cdot \phi 
    - J \cdot \varphi_k + \frac{1}{2} \varphi_k \cdot R_k \cdot \varphi_k}\\
\label{B}
&e^{\textstyle-S[\phi] + J \cdot \phi - \frac{1}{2} \phi \cdot R_k \cdot \phi
    - J \cdot \varphi_k + \frac{1}{2} \varphi_k \cdot R_k \cdot \varphi_k}\\
\label{C}
&\exp\Bigl(-S[\phi] + J \cdot \phi - \frac{1}{2} \phi \cdot R_k \cdot \phi 
           - J \cdot \varphi_k + \frac{1}{2} \varphi_k \cdot R_k \cdot \varphi_k\Bigr)\\
\label{D}
&\exp\Bigl(-S[\phi] + J\phi - \frac{1}{2} \phi R_k \phi - J \varphi_k 
           + \frac{1}{2} \varphi_k R_k \varphi_k\Bigr)\\
\label{E}
&\exp\Bigl(-S[\phi] + J\phi - \tfrac{1}{2} \phi R_k \phi - J \varphi_k 
           + \tfrac{1}{2} \varphi_k R_k \varphi_k\Bigr)
\end{align}
\end{document}

enter image description here

If you want to preserve the spacing around the operation symbols you can use \text, but I don't recommend doing it. Prefer \exp.

\documentclass{scrartcl}
\usepackage{mathtools}

\begin{document}

\begin{equation}
e^{\text{$-S[\phi] + J \cdot \phi - \frac{1}{2} \phi \cdot R_k \cdot \phi
    - J \cdot \varphi_k + \frac{1}{2} \varphi_k \cdot R_k \cdot \varphi_k$}}
\end{equation}

enter image description here

1
  • In this case, \cdotindicates a particular scalar product. Leaving it out would create ambiguity. But I guess you're right, \exp is the way to go here.
    – Janosh
    Apr 17, 2017 at 15:13

You must log in to answer this question.

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