Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vertical placement of math symbol in LaTeX

Tags:

I'm using the symbol \otimes as a unary operator and it's vertical alignment doesn't seem right to me. It wants to sit a bit below the baseline. For example, if I define \newcommand{\myop}{\ensuremath \otimes}, then $\myop I$ becomes

Operator below the baseline

and $F_{\myop I}$ becomes

Operator misaligned in subscript

I tried using \raisebox to fix this, e.g.,

\newcommand{\myop}{\ensuremath \raisebox{1pt}{$\otimes$}} 

This fixes $\myop I$:

Operator near baseline

But \raisebox doesn't seem to be sensitive to subscripts. The operator stays the same size while everything around it shrinks:

Operator too big in subscript

The problem, I think, is that \raisebox creates its own LR box, which doesn't inherit the settings in the surrounding math environment. Is there a version of \raisebox that "respects math"?

like image 649
Chris Conway Avatar asked May 19 '10 14:05

Chris Conway


People also ask

How do I insert mathematical symbols in LaTeX?

The inline mode uses one of the delimiters: \ ( \), $ $ or \begin{math} \end{math} and the display mode has two versions: numbered and unnumbered. To print equations in display mode one these delimiters are used: \[ \], $$ $$, \begin{displaymath} \end{displaymath} or \begin{equation} \end{equation}.

How do you align symbols in LaTeX?

To do this, put ampersand "&" signs around the text you want LaTeX to align, e.g. Each equation can be labelled separately, just put the label command after the relevant equation.

How do I make vertical bars in LaTeX?

In LaTeX text mode, the vertical bar produces an em dash (—). The \textbar command can be used to produce a vertical bar.

How do you type a long vertical line in LaTeX?

The “%” character is used to specify a line tag within it and create a vertical line using the “\vert” tag. Add the “$” sign before and after the “\vert” command to specify a single line.


1 Answers

Try \mathchoice (or \mathpalette):

\newcommand{\myop}{%   \mathchoice{\raisebox{1pt}{$\displaystyle\otimes$}}              {\raisebox{1pt}{$\otimes$}}              {\raisebox{0.5pt}{$\scriptstyle\otimes$}}              {\raisebox{0.2pt}{$\scriptscriptstyle\otimes$}}} 

The amsopn documentation says:

... the vertical spacing may not be optimal in script and scriptscript sizes. Unfortunately TeX provides no easy way to do math mode vertical spacing that varies with current math style like mu units.

like image 52
Jouni K. Seppänen Avatar answered Sep 24 '22 01:09

Jouni K. Seppänen