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\operatornamedoes but without the font change – David Carlisle Feb 16 '22 at 17:18u(x)\cos x. But I understand it's a matter of personal preferences. – Rmano Feb 16 '22 at 17:22\cdot. – yannisl Feb 16 '22 at 17:57\mathop, how should LaTeX know if you meancos(xu(x))orcos(x)u(x)? I think @Rmano gives you a good suggestion. – mickep Feb 16 '22 at 18:48\cos{x}rather than\cos x. Then it should be clear that onlyxis the argument of\cos. – dashmile Feb 16 '22 at 19:01u xforu(x)likecos x. When the function name is single-letter likeu, it is not clear whether it is a function or variable, so we need parentheses, I guess. When the function name is multiple-letter likecos, it is clearer that it is a function rather than a variable, especially if it is written with upright font rather than variable's italicized font. – dashmile Feb 16 '22 at 19:09\,which is the command of choice for such cases where you do want to override the automatic spacing. – egreg Feb 16 '22 at 22:03\,here is the preferable method, and I believe that you can find an example in the TeXbook recommending that. In fact, there's a list of examples on p.169 regarding explicit input spaces. – barbara beeton Feb 17 '22 at 02:35