6

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?

3
  • 1
    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)$.
    – Sigur
    May 2, 2015 at 8:23
  • 2
    I simply use f(x) and consider all the other proposed usages wrong.
    – egreg
    May 2, 2015 at 8:36
  • 3
    \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.
    – wipet
    May 2, 2015 at 9:05

2 Answers 2

6

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}

enter image description here

2
  • 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.
    – Sverre
    May 6, 2015 at 13:33
  • @Sverre I use f(x) inside a formula; that's implicit. But I'll add it for clarity.
    – egreg
    May 6, 2015 at 13:47
1

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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.