# ‘Correct’ way of writing a function?

So for all these years, I have been writing a function f(x) as $\mathop{f}(x)$.

But now that I begin to think about a correct way of writing a function, what should it be?

Is it f(x) or \mathop{f}(x) or \mathop{f}\left(x\right) or f\left(x\right)?

Or is it actually none of these?

• There is no "right" way but most common way. Usually I do $f(x)=$ to define and then refer to it as $f$. But sometimes, depending on the size of arguments, I do $f \bigl( \bigr)$. May 2, 2015 at 8:23
• I simply use f(x) and consider all the other proposed usages wrong. May 2, 2015 at 8:36
• \mathop{f}(x) is absolutely wrong because the leter f is vertically positioned not by baseline but centered by math axis. Try \mathop{g}(x) where the wrong result is more visible. Of course, the vertically positioning by math axis can be cancelled by adding something second to the \mathopparameter (\kern0pt in egreg's example) but normal f(x) is the best. May 2, 2015 at 9:05

I simply use f(x) (inside a formula, that is, between $...$ or $...$ or any other mathematical construct, which shall be implicit in what follows) and consider all the other proposed usages wrong. One might argue about \mathop{\kern0pt f}(x) so a thin space would be added in front of the f if preceded by certain kinds of atoms (what happens for \sin and \log). A definition should be

\newcommand{\fn}[1]{\mathop{\kern0pt #1}\nolimits}


and \fn{f}(x) would give the desired result.

However, the following example shows that it is suboptimal: there is no reason for the thin space.

\documentclass{article}

\newcommand{\fn}[1]{\mathop{\kern0pt #1}\nolimits}

\begin{document}

$g(x)f(x)$

$\fn{g}(x)\fn{f}(x)$

$f(x)\ne f'(x)$

$\fn{f}(x)\ne \fn{f}'(x)$

\end{document}


• Not to be pedantic, but you're not using f(x), you're using $f(x)$. Maybe that's given to a mathematician, but I thought you were in fact writing f(x) until I saw your code. May 6, 2015 at 13:33
• @Sverre I use f(x) inside a formula; that's implicit. But I'll add it for clarity. May 6, 2015 at 13:47

If your typoscript is to be processed (not retyped) by a scientific journal or book publisher, then stick to conventions and keep it as simple as possible lest you will annoy the copy editor. Hence f(x). Or f\left(\frac{a}{b}\right) if the function argument has extra height or depth.

If you are your own editor, then, as others have said, there is no such category as "correctness". Still: why not keep things simple?