Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to tell LaTeX it's a binary operator (or whatever)

803 views
Skip to first unread message

porky_...@my-deja.com

unread,
Nov 2, 2011, 7:25:29 PM11/2/11
to
Say, I'm writing something like this:

$ a \overset{t}{+} b$,

that is $a + b$ but with a little t above plus sign. When I typeset
it, the spacing around the plus sign is no longer correct and so I
have to insert some extra white space. I know that's
DefineMathOperator command, but I'm looking for something I can tell
LaTeX it's a binary operator, on the fly, inline, so to speak.
Something like, say,

$ a \binop\overset{t}{+} b$.

Can't find anything anywhere.
Any suggestions? TIA,

PPJ.

Philipp Stephani

unread,
Nov 2, 2011, 7:46:21 PM11/2/11
to
"porky_...@my-deja.com" <porky_...@my-deja.com> writes:

> Say, I'm writing something like this:
>
> $ a \overset{t}{+} b$,
>
> that is $a + b$ but with a little t above plus sign. When I typeset
> it, the spacing around the plus sign is no longer correct and so I
> have to insert some extra white space.

I see no difference at all.

> I know that's
> DefineMathOperator command, but I'm looking for something I can tell
> LaTeX it's a binary operator, on the fly, inline, so to speak.
> Something like, say,
>
> $ a \binop\overset{t}{+} b$.

$ a \mathbin{\overset{t}{+}} b $
but this shouldn't be necessary.

--
Change “LookInSig” to “tcalveu” to answer by mail.

corporal

unread,
Nov 2, 2011, 8:04:15 PM11/2/11
to
On Nov 3, 10:25 am, "porky_pig...@my-deja.com" <porky_pig...@my-
deja.com> wrote:
> Say, I'm writing something like this:
>
> $ a \overset{t}{+} b$,
>
> that is $a + b$ but with a little t above plus sign. When I typeset
> it, the spacing around the plus sign is no longer correct and so I
> have to insert some extra white space.

There is no difference. Try compiling the following:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\makebox[0pt]{$ a \overset{t}{+} b$}\makebox[0pt]{$a + b$}
%% puts both expressions in a zero width box
%% and overlays the second box on the first

\makebox[0pt]{$ a \overset{t}{+} b$}\,\makebox[0pt]{$a + b$}
%% puts both expressions in a zero width box
%% with a small space in between

\end{document}.

Enrico Gregorio

unread,
Nov 2, 2011, 8:37:17 PM11/2/11
to
It's indeed not necessary: \overset is able to know whether its
second argument is a relation or operation symbol (or a subformula
declared as such with \mathrel or \mathbin).

Ciao
Enrico

porky_...@my-deja.com

unread,
Nov 2, 2011, 9:20:58 PM11/2/11
to
On Nov 2, 8:37 pm, Enrico Gregorio <Facile.da.trov...@in.rete.it>
wrote:
> Philipp Stephani <LookIn...@arcor.de> wrote:
Well, it does *not*. I didn't just post this question without checking
it first, you know.

PPJ.

porky_...@my-deja.com

unread,
Nov 2, 2011, 9:28:06 PM11/2/11
to
On Nov 2, 7:46 pm, Philipp Stephani <LookIn...@arcor.de> wrote:
Well, it makes the difference for me, and unfortunately \mathbin
didn't fix the problem either. But thanks for the info anyway, I'll be
looking closer into it.
FYI, I'm runing a year-old version of portable MikTeX.

PPJ.

porky_...@my-deja.com

unread,
Nov 2, 2011, 9:22:05 PM11/2/11
to
Thanks, but inserting some extra white space around the plus is
simpler.

PPJ.

corporal

unread,
Nov 2, 2011, 11:18:17 PM11/2/11
to
> Well, it makes the difference for me, and unfortunately \mathbin
> didn't fix the problem either. But thanks for the info anyway, I'll be
> looking closer into it.
> FYI, I'm runing a year-old version of portable MikTeX.
>
> PPJ.

PPJ, I think it's a case of being "tricked" visually.

To see your expressions have the same overall width, the following
code draws two lines 0.4pt apart.
One has the height of of the expression $a + b$.
The other has height of the expression $a \overset{t}{+} b$.
The lines have the same height.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\newlength{\ab}
\settowidth{\ab}{$a + b$}

\newlength{\atb}
\settowidth{\atb}{$a \overset{t}{+} b$}

\rule{0.4pt}{\ab}\hspace{0.4pt}\rule{0.4pt}{\atb}

\end{document}

corporal

unread,
Nov 2, 2011, 11:23:46 PM11/2/11
to
PPJ, sorry the previous post should have said:

One has the height which is the width of the expression $a + b$.
The other has height which is the width of the expression $a
\overset{t}{+} b$.

Philipp Stephani

unread,
Nov 3, 2011, 3:41:21 AM11/3/11
to
Corporal's code is not a solution, but the proof that there is no extra
or missing white space when using \overset.

Please make an MWE that actually exhibits your problem.

Enrico Gregorio

unread,
Nov 3, 2011, 5:29:05 AM11/3/11
to
<"porky_...@my-deja.com"> wrote:

> On Nov 2, 8:37 pm, Enrico Gregorio <Facile.da.trov...@in.rete.it>
> wrote:
>
> > It's indeed not necessary: \overset is able to know whether its
> > second argument is a relation or operation symbol (or a subformula
> > declared as such with \mathrel or \mathbin).
>
> Well, it does *not*. I didn't just post this question without checking
> it first, you know.
>
> PPJ.

Sorry, but the following example shows that the spacing is correct:

\documentclass[a4paper]{article}
\usepackage{amsmath}
\begin{document}
$a+b$

$a\overset{t}{+}b$
\end{document}

Both + symbols are equally spaced in the two lines. Please,
show some code that doesn't behave as expected.

Ciao
Enrico

Dan Luecking

unread,
Nov 3, 2011, 1:38:42 PM11/3/11
to
Make a minimal document. Check versions of packages used.
The most obvious cause of your problem would be a package
other than amsmath being used to define \overset.

I copied your code into an article class document using
package amsmath, and put \listfiles at the top of the
file. It produced this:

article.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
amsmath.sty 2000/07/18 v2.13 AMS math features
amstext.sty 2000/06/29 v2.01
amsgen.sty 1999/11/30 v2.0
amsbsy.sty 1999/11/29 v1.2d
amsopn.sty 1999/12/14 v2.01 operator names

If yours contains anything else, or earlier versions you HAVE
to supply that information.

Also: any home-made macros might affect the situation.
Your later claim that \mathbin doesn't fix the problem
is hardly believable. It suggests that you are doing
something strange and makes it all the more important
that you supply a minimal file that exhibits your problem.


Dan
To reply by email, change LookInSig to luecking
0 new messages