# Spacing around longer function argument's parentheses

The line

i(x,y,z,t) = \delta(x-\ell_x(z)) \delta(y-\ell_y(z)) \hat{\imath}(\xi(z),t)

produces (for my eyes, at least) too little space between the successive function calls. It is difficult to visually distinguish the three calls. I guess the underlying reason is that the expressions that serve as function arguments are relatively long. For comparison,

i(x,y,z,t) = \delta(x) \delta(y) \hat{\imath}(\xi(z),t)

already looks a lot better in my opinion.

I know that I could

1. Manually adjust spacing using \, etc., including the option to define a macro that does this automatically.
2. Insert \cdot as a means of adding seperating space.

However, my question is: Is there a canonical way (e.g. a package) of dealing with this problem? I imagine I'm not the first one to encounter this problem... still, I wasn't able to find useful, general solutions to the problem.

A possible solution might be something along the lines of

i(x,y,t) = \delta \funcargs{x-\ell_x(z)} \delta \funcargs{y-\ell_y(z)} \hat{\imath} \funcargs{\xi(z)}{t}

Note that I find the use of \cdot to be unsatisfying since it introduces inconsistency in the document (sometimes having the dot and sometimes not, with the meaning being the same).

• Use \, or \; to add more space. – skpblack Nov 3 '14 at 14:39
• As I said, I know that I can manually adjust spacing. This is not the solution I was asking for. I'll try to further clarify the question. – jhin Nov 3 '14 at 14:47
• How do you feel about wrapping them inside \mathinner{...}s? – morbusg Nov 3 '14 at 14:49
• Because the added space is dependent on what follows (another function[yes] vs. a comma or an additional close paren [no]), making it active would seem to be the only way. And making it active would introduce all sorts of other problems, I would guess. Thus, I agree with @skpblack that adding it manually is the best approach. – Steven B. Segletes Nov 3 '14 at 14:49
• @Steven: With \mathinner, no space would be inserted between it and \mathclose, but \thinmuskip would be inserted between it and \mathpunct. – morbusg Nov 3 '14 at 14:56

First, let me give a paraphrasing from The TeXbook showing the amounts of spaces between different types of math atoms:

where

• Ord includes things like a, \theta, and things inside \mathord or just plain {}'s;
• Op includes things like \sin, \gcd, and things inside \mathop;
• Bin includes things like \pm, \otimes, and things inside \mathbin;
• Rel includes things like \leq, \mid, and things inside \mathrel;
• Open includes things like \langle, (, and things inside \mathopen;
• Close includes things like \rangle, ), and things inside \mathclose;
• Punct includes things like ,, ., and things inside \mathpunct;
• Inner includes things like \cdots and things inside \mathinner.

Here is an example document illustrating a couple of different ways:

\let\funarg\mathinner
\def\funop#1{\mathop{{}#1}}
$$i(x,y,z,t) = \delta(x-\ell_x(z)) \delta(y-\ell_y(z)) \hat\imath(\xi(z),t),$$
$$i\funarg{x,y,z,t} = \delta\funarg{(x-\ell_x(z))} \delta\funarg{(y-\ell_y(z))} \hat\imath\funarg{(\xi(z),t)},$$
$$\funarg{i(x,y,z,t)} = \funarg{\delta(x-\ell_x(z))} \funarg{\delta(y-\ell_y(z))} \funarg{\hat\imath(\xi(z),t)},$$
$$\funop i(x,y,z,t) = \funop\delta(x-\ell_x(z)) \funop\delta(y-\ell_y(z)) \funop{\hat\imath}(\xi(z),t),$$
\bye

So as you can see, you probably want the last option of using a \mathop atom for the function "name".

With LaTeX, this could be defined as follows (the second row below shows the output of your original code):

\documentclass{article}
\newcommand\funop[1]{\mathop{{}#1}}
\begin{document}
$i(x,y,z,t) = \funop\delta(x-\ell_x(z)) \funop\delta(y-\ell_y(z)) \funop{\hat\imath}(\xi(z),t)$

vs.

$i(x,y,z,t) = \delta(x-\ell_x(z)) \delta(y-\ell_y(z)) \hat{\imath}(\xi(z),t)$
\end{document}

(The reason I didn't include the parenthesis in the command is that I felt it would be too much effort to measure the arguments to decide on the size of the fences. I think it's simpler to just manually define the height with \bigl( etc., and also it's nicer to see the parens in the manuscript instead of {}'s)

• Thanks, this is really helpful! What I do right now is \newcommand{\func}[2]{\operatorname{#1} \left( #2 \right)}. I first tried \mathop as it seemed more appropriate than \mathinner but it resulted in weird vertival spacing, so I settled to \operatorname. I have \left and \right fixed as proposed in tex.stackexchange.com/a/2610/64293. The result looks really good in my opinion. – jhin Nov 3 '14 at 17:12
• @jhin: Yes, the first empty group in my plain-tex definition takes care of the weird vertical spacing. I could have sworn there is either a LaTeX or AMSMath command to achieve the same thing, I'm just having trouble finding it. – morbusg Nov 3 '14 at 17:17
• @jhin You can use \mleft and \mright from mleftright package. In any case, I wouldn't use them. I would prefer a wrapper around \DeclarePairedDelimiter\parenthesis{\lparen}{\rparen} and then passing the optional comand like \func[\big]{..}{..} to \parenthesis[\big]{..}. – Manuel Nov 3 '14 at 17:18
• @Mico: Thanks! Though, I was thinking of a \mathop to be the "suggested" math atom because the \mathinner adds a \thinmuskip in case of a following \mathpunct atom. Do you recall if there is a LaTeX or AMSMath command which basically does \mathop{{}#1}? – morbusg Nov 3 '14 at 17:28
• @Manuel - and could you elaborate a bit on why you would prefer such a wrapper over the \mleftrightpackage...? – jhin Nov 3 '14 at 17:42

Inserting a thinspace (\,) between the multiplicative factors should work. Inserting \cdot in these locations should work too. You could also combine the thinspaces with making the outer parentheses a tad bigger than the inner ones (by using \bigl( and \bigr)). The three possibilities are illustrated below:

\documentclass{article}
\begin{document}
$i(x,y,z,t) = \delta(x-\ell_x(z)) \, \delta(y-\ell_y(z)) \, \hat{\imath}(\xi(z),t)$

$i(x,y,z,t) = \delta(x-\ell_x(z)) \cdot \delta(y-\ell_y(z)) \cdot \hat{\imath}(\xi(z),t)$

$i(x,y,z,t) = \delta\bigl(x-\ell_x(z)\bigr) \, \delta\bigl(y-\ell_y(z)\bigr) \, \hat{\imath}\bigl(\xi(z),t)\bigr)$
\end{document}

One can automate the third method by creating a macro such as

\def\myfunc#1{\bigl(#1\bigr)\,}

and then typing

$i(x,y,z,t) = \delta\myfunc{x-\ell_x(z)} \delta\myfunc{y-\ell_y(z)} \hat{\imath}\myfunc{\xi(z),t)}$
• Thanks for the answer. I prefer the solution given by morbusg, though. Note that \bigl etc. introduce additional (undesired) spacing between the function name and the parentheses, see e.g. tex.stackexchange.com/questions/40829/… – jhin Nov 3 '14 at 15:23
• @jhin - You may have misinterpreted that posting: The extra, unwanted space is inserted if one uses \left( and \right). In contrast, no extra space is inserted by \bigl( and \bigr). You can verify this assertion by modifying the third row of the code above to omit the two \, directives : You'll find that there's no absolutely no extra space. – Mico Nov 3 '14 at 15:56
• I wasn't sure whether the two produce the same spacing, so I looked at your attached picture and concluded that yes they do, since in fact there is a larger space between the delta and the parenthesis in the third row than in the two previous rows... might just be the effect of the scaling, though. Thanks for correcting me! – jhin Nov 3 '14 at 16:23
• @jhin - The additional whitespace in the third row comes from the \, macros, not from \bigl( and \bigr). It's exactly the same amount of whitespace as in the first row (which also uses \, macros). – Mico Nov 3 '14 at 17:09
• Sorry, perhaps should have clarified: I'm really referring to the whitespace between the \delta and its successive ( or \bigl, respectively. And that is indeed a tiny little bit larger in the third row than in the two previous rows. – jhin Nov 3 '14 at 17:17