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

Like \overset or \underset, but the same size?

2,157 views
Skip to first unread message

Eze

unread,
Jan 19, 2008, 2:42:07 PM1/19/08
to
Hello!

Is there a way to put a symbol of top of another, like \overset or
\underset, but which typesets both operands in the same size?

Thanks a lot.

Regards,

Ezequiel

vvvv

unread,
Jan 19, 2008, 4:50:35 PM1/19/08
to
I think one of these will be close to what you want. I just lost
electricity at my house, so I'm on batter power!!

Here is an entire test document:

\documentclass{article}
\def\ontop#1#2{\setbox0\hbox{#2}\copy0\llap{\raise\ht0\hbox{#1}}}
\begin{document}

here is some text to see what happens to the line above asdf asdf asdf
asdf asdf asdf asdf asdf asdf assdf
O above X: \ontop{O}{X} here is some more text to see what happens
below asdf adsf asdf asdf asdf.

Note that the vertical space produced above will be affected by the
setting for lineskiplimit---if the two lines are within that amount of
space (vertically), then \LaTeX{} will insert some extra space so that
the lines are lineskip apart from each other vertically.

O over X: X\llap{O} hello% the \llap macro is a "left overlap", there
is also an \rlap

O over X with a horizontal adjustment X\llap{O\hskip-3pt} hello
O over X with a vertical adjustment X\llap{\raise.5ex\hbox{O}} hello

O over X with another vertical adjustment X\llap{\lower.5ex\hbox{O}}
hello
\end{document}

Enrico Gregorio

unread,
Jan 19, 2008, 5:28:50 PM1/19/08
to
Eze <garzon...@gmail.com> wrote:

> Hello!
>
> Is there a way to put a symbol of top of another, like \overset or
> \underset, but which typesets both operands in the same size?

\begin{tabular}[b]{@{}c@{}}O\\X\end{tabular}

Use [t] if you prefer top alignment. Without the optional argument the
thing is vertically centered. Probably something like

\newcommand{\ontoptext}[3][0pt]{%
\begin{tabular}[b]{@{}c@{}}
#2\\[#1]
#3
\end{tabular}}

with an optional argument to control the separation: maybe

\ontoptext[-4pt]{O}{X}

If the thing has to appear in math mode, then use array instead
of tabular, but don't forget to properly qualify the new symbol:
if it's a relation, then say

\mathrel{\ontopmath{+}{=}}

(say that ontopmath is the array version of \ontoptext).

Ciao
Enrico

Eze

unread,
Jan 21, 2008, 8:42:47 AM1/21/08
to
Many thanks to both!

Eze

Dan

unread,
Jan 21, 2008, 4:34:52 PM1/21/08
to

While you got some answers, you never did
explain what you want this for. There are some
standard mathematical objects like your describe.
For example, the binomial coefficients.
There is a standard command (in the amsmath
package), \binom{x}{y} to produce it. There may
well be a speciallized math package with a
command designed for what you want, if you
would only say what it is.

With the amsmath package, the \genfrac command
allows you to substitute other delimiters (or none at all)
for the parentheses. Example:
\genfrac{}{}{0pt}{}{x}{y}
the first two arguments give the delimiters (here none)
and the 4th (here empty) can be used to force a
particular style (0=display, 1=text, 2=script or 3=scriptscript).

One can also use any of several amsmath alignments
of two rows and one column, for example
\begin{gathered} x\\ y\end{gathered}
or the basic latex array:
\begin{array}{c} x\\y\end{array}


Dan

0 new messages