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

\textrm in math in superscript

118 views
Skip to first unread message

Jan Van den Bussche

unread,
Jul 13, 1999, 3:00:00 AM7/13/99
to
The nice thing of using \textrm in math mode (as opposed to \mathrm) is
that it adapts automatically to the surrounding environment. For example,
if I define the following alternative to \cos:

\newcommand{\mycos}{\mathop{\textrm{cos}}}

and I write

\bfseries $\mycos x$

then the "cos" will be bold in accordance with the surrounding environment
(the x will not, but that's another story).

Now my problem is with using the same thing superscripted (or subscripted).
If I write

$\textrm{a}^\textrm{b}$

the b is as large as the a which is ugly. I can manually fix this
by writing

$\textrm{a}^\textrm{\scriptsize b}$

and this looks just fine. But now suppose I want to put this in a macro and
use it everywhere:

\newcommand{\mymacro}{\textrm{a}^\textrm{\scriptsize b}}

However, if I now write

\footnotesize $\mymacro$

then the b is again too large: it is still in \scriptsize, because I manually
told it to be so. This is ugly because superscripts in a surrounding
\footnotesize environment are supposed to be in \scriptscriptsize.

How can I solve this, i.e., how can I define \mymacro so that the b always has
the appropriate size?

Thanks,

--Jan Van den Bussche

Robin Fairbairns

unread,
Jul 13, 1999, 3:00:00 AM7/13/99
to
Jan Van den Bussche <vdb...@cs.indiana.edu> wrote:
>[...]

>Now my problem is with using the same thing superscripted (or subscripted).
>If I write
>
>$\textrm{a}^\textrm{b}$

\usepackage{amstext}
...

$\textrm{a}^{\text{\textrm{b}}}$
--
Robin Fairbairns, Cambridge

David Carlisle

unread,
Jul 13, 1999, 3:00:00 AM7/13/99
to
r...@betsy.cl.cam.ac.uk (Robin Fairbairns) writes:

simpler than that.

\usepackage{amstext}
....

$\textrm{a}^\textrm{b}$

Of course it is _wrong_ to abuse the system like this so that you get
bold in a nold environment. If you want a contect in which the text and
the math are both bold, go {\bfseries \boldmath ..... }


David

Volker Kuhlmann

unread,
Jul 13, 1999, 3:00:00 AM7/13/99
to
In article <yg4pv1x...@openmath.nag.co.uk>,

David Carlisle <dav...@nag.co.uk> writes:
> \usepackage{amstext}
> ....
>
> $\textrm{a}^\textrm{b}$
>
> Of course it is _wrong_ to abuse the system like this so that you get
> bold in a nold environment. If you want a contect in which the text and
> the math are both bold, go {\bfseries \boldmath ..... }

Something similar. I recently tried to typeset a few pages in sans serif,
including super/subscripts:

\sffamily\Large ... Na$^2+$ ...

There are a large number of chemical superscripts. What is the recommended
way of making the superscript also sans serif? Is there a package which
does that?

Volker

--
Volker Kuhlmann (v.kuh...@elec.canterbury.ac.nz)

Donald Arseneau

unread,
Jul 14, 1999, 3:00:00 AM7/14/99
to
In article <7mgjh9$4ln$1...@cantuc.canterbury.ac.nz>, v.kuh...@elec.canterbury.ac.nz writes...

>\sffamily\Large ... Na$^2+$ ...

.. Na\textsuperscript{2+}

(I would define a shorter alias.)

A more complete solution is to define a sans-serif "math version"
in analogy with boldmath... except that the sans versions of the
math italic fonts don't exist.

More practical is to employ \everymath{\fam\sffam}... but no \sffam in LaTeX.
So use this:

\newcommand\everymathfont[1]{\ensuremath{#1{\xdef\emfTemp
{\everymath{\fam\the\fam\relax}}}}\emfTemp
}

..

\large \sf \everymathfont{\mathsf}

Donald Arseneau as...@triumf.ca

0 new messages