# Best practice for putting space between functions that are multiplied

I am wondering what is the best practice for putting space between functions that are multiplied.

Here is a specific problem I have. I want to render \cos{x} u(x), which is meant to represent the product of two functions \cos{x} and u(x). However, direct rendering of this expression produces a result without enough space between x and u(x) and looks like \cos{x u(x)}:

In order to avoid this problem, I actually have been surrounding the function name u with \mathop to write \cos{x} \mathop{u}(x). This puts a proper space in front of u(x):

However, I just learned that surrounding a single letter with \mathop shifts the baseline, as discussed here. (You can see that u is shifted upward in the above rendering.) Using \operatorname instead of \mathop avoids this issue, but it uses an upright rather than italicized font for a single-letter function name.

Obviously, the easiest solution would be to put a space explicitly by \cos{x}\,u(x), but I don't want to disturb TeX's automatic spacing scheme as argued convincingly here. Is there a better way to inform TeX that there should be a space between two functions multiplied?

• \mathop{{}u} would do what \operatorname does but without the font change Commented Feb 16, 2022 at 17:18
• IMHO I would use parenthesis around x in this case.... Or write u(x)\cos x. But I understand it's a matter of personal preferences. Commented Feb 16, 2022 at 17:22
• Why, why, mathematicians like to write a function as f(x), but write the trigonometric functions as cos x? I would use a \cdot. Commented Feb 16, 2022 at 17:57
• If we do not add parentheses or some kind of class changing like \mathop, how should LaTeX know if you mean cos(xu(x)) or cos(x)u(x)? I think @Rmano gives you a good suggestion. Commented Feb 16, 2022 at 18:48
• Thin space or not, readers will be puzzled about the meaning of cos x u(x). If you write u(x) cos x nobody would misunderstand. If you insist in cos x u(x), just use \, which is the command of choice for such cases where you do want to override the automatic spacing. Commented Feb 16, 2022 at 22:03

TeX primitive command \mathop does vertically centering of is argument, if this argument consists only from single object. That is the reason why \mathop{u} centers the u at math axis. If the argument of \mathop has more than single object then the argument is at baseline.

You can define

\def\op#1{\mathop{{}#1}}


and use

\cos x \op u(x)


With this code

$\cos x \,u(x)$


you dont have problems. The rendering is:

• Sorry, but I mentioned in OP that the explicit use of \, is what I want to avoid. Commented Feb 16, 2022 at 18:13
• Yes, but it works without calling guru's hair sectioning. Commented Feb 16, 2022 at 18:26

For absolute clarity, consistency and beauty use eq(1)

\begin{gather}
\begin{align}
\cos{(x)}\cdot \operatorname{u}(x)\\
\cos x \operatorname{fn}x
\end{align}
\end{gather}