Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In Physics, I often have functions like f(x), but also multiplications like y(-x). I would like my math to be easy to understand, so I am looking for a way to suggest function calls and multiplications.

In programming languages like C or Python, this is easy. A function call is f(x) and a multiplication has to have a * in it. I think it would be ugly and confusing to put \cdot everywhere, since that is more thought of as am inner product.

In Mathematica, function calls are with square brackets, like f[x], whereas multiplication is with round parenteses y(-x).

Since LaTeX has the \! command, a friend thought of using that between the function name and the parameters.

I tried the negative spacing and the square brackets, but I am not sure whether it is valid to use \! at that point. Or should I use even more negative spacing?

The font in the image is Bitstream Charter with mathdesign.

The code for the examples is:

f\del x y \del{-x}
f\sbr x y \del{-x}
f \! \del x y \del{-x}
f \! \sbr x y \del{-x}

Where \del and \sbr come from the commath package and create automatically sized parenteses and square brackets.

share|improve this question
    
Instead of writing y(-x) you could either use y\times(-x) (the \times might be confudes with the cross product) or you could write -xy instead of y(-x) which is, I believe, the best option - unless, of course, you're not in a commutative algebra. I don't think readers will see the difference between y(-x) and y\!(-x). –  gniourf_gniourf Jun 21 '13 at 9:30
1  
Can you show the code you used for producing the examples? –  egreg Jun 21 '13 at 9:52
    
I think queueoverflow's observation is very good, and I agree with his opinion about how to typeset these symbols. –  Lover of Structure Jun 21 '13 at 10:36
1  
The excess space is actually inserted by those \del and \sbr macros. Don't use them. –  egreg Jun 21 '13 at 11:51
1  
@tohecz: How is it against the idea of LaTeX? –  queueoverflow Jun 21 '13 at 12:20
show 7 more comments

2 Answers

up vote 9 down vote accepted

Arguably the function form ought to be \mathop{{}f}(x) although this renders the same way.

In MathML (and so now in Unicode) we faced the same problem and have invisible operators FUNCTION APPLICATION (U+2061) (InvisibleApplication in Mathematica) and INVISIBLE TIMES (U+2062) (InvisibleTimes in Mathematica). As their names suggest, by default these have no affect on visual rendering but in aural renderings (and when generating code from markup) they help to distinguish these cases with f⁡(x) usually being read as f of x and f⁢(x) being read as f times x.

Whether you should distinguish these in traditional print form is really an open question, usually a reader can distinguish by context and if you vary too much from the traditional layout the reader is more distracted by the novel display than helped by the distinguished notation. (I think this is the case with the Mathematica [] convention which would be fatally distracting if used in general mathematical context rather than explicitly discussing Mathematica code.)

So... It is good to have different markup for the two cases even if you make them render the same way, as that makes the expressions distinguishable in other contexts, and also of course allows you to easily experiment with different typeset renderings affecting the whole document, by changing the definitions of your function application and invisible times commands.

share|improve this answer
    
The distraction is my worry as well. Since I read a lot of programming source code, Mathematica syntax makes it easier for me. But I do see the problem for non-programming Physicists. –  queueoverflow Jun 21 '13 at 12:15
add comment

The problem you face is due to commath. I can't recommend using this package under any circumstance. Examples:

\documentclass{article}
\usepackage[charter]{mathdesign}
\usepackage{amsmath}
\usepackage{commath}
\begin{document}
With \texttt{commath}
\begin{gather}
\dif(f\wedge g) \\
\left(\pd{f}{x}\right) \\
f\del{x}
\end{gather}
Without \texttt{commath}
\begin{gather}
\mathrm{d}(f\wedge g) \\
\left(\frac{\partial f}{\partial x}\right) \\
f(x)
\end{gather}
\end{document}

enter image description here

As you can see, the result in lines 1 and 2 is completely wrong; in line 3 an additional space is inserted.

share|improve this answer
    
Since you use f \left( x \right), that is not worse than \del. And \dif takes one argument, so it should be \dif{(f\wedge g)} I think. The partial derivative could be fixes with \dpd to make it \displaystyle. –  queueoverflow Jun 21 '13 at 12:30
    
@queueoverflow No, \dif doesn't take arguments. About the partial derivative: the package is supposed to ease input, not to complicate it. Automatically supplying \left and \right is very disputable; I'd never type f\left(x\right), since I know it adds an unwanted space. –  egreg Jun 21 '13 at 12:38
    
If I have a bigger expression and have to use \left, is that space wanted then? –  queueoverflow Jun 21 '13 at 13:00
    
@queueoverflow Yes, and the added spacing may help, in that case. –  egreg Jun 21 '13 at 13:02
    
While we are at it: Is f(x^2) a case where \left( already makes sense, or should the ^2 protrude a little? –  queueoverflow Jun 21 '13 at 16:54
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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