Math & Scienceamsmath | Unnecessary vertical Space with '\overset'

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
koffer
Posts: 3
Joined: Thu Jan 12, 2012 8:09 pm

amsmath | Unnecessary vertical Space with '\overset'

Post by koffer »

Hi everyone,

I have a weird problem when I use \overset from the amsmath package within squared brackets. For some reason it produces some extra space below the symbol as if it would expect that there is also something below the symbol.

Here is a minimal example:

Code: Select all

\documentclass{article}
\usepackage{amsmath}

\begin{document}
  \[
    \left[ \overset{*}{A} \right]_{i,j}
  \]
\end{document}
Does anyone know how to get rid of that space?


Thanks in advance,
Koffer

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
o3hq
Posts: 3
Joined: Sun Nov 14, 2010 6:51 pm

Re: amsmath | Unnecessary vertical Space with '\overset'

Post by o3hq »

I'm not sure whether it'll work, but that's what I do when I have the problem with \figure:

\vspace{-1in}

for example. Notice the number is negative, since you want to get rid of space. Hope it works!
koffer
Posts: 3
Joined: Thu Jan 12, 2012 8:09 pm

amsmath | Unnecessary vertical Space with '\overset'

Post by koffer »

I tried it, but it unfortunately doesn't work.

Here's the code for this:

Code: Select all

\documentclass{article}
\usepackage{amsmath}

\begin{document}
	\[
		\left[ \vspace{-1in}\overset{*}{A} \right]_{i,j}
	\]
\end{document}
It still shows the same space below the A.
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

amsmath | Unnecessary vertical Space with '\overset'

Post by localghost »

Defining a new command might be the better alternative. The code for this command is borrowed from the \dddot command provided by the amsmath package. For a better fit it has been modified a bit.

Code: Select all

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\oset}[2]{%
  {\mathop{#2}\limits^{\vbox to -.5\ex@{\kern-\tw@\ex@
   \hbox{\scriptsize #1}\vss}}}}
\makeatother

\begin{document}
  \[
    \left[\oset{*}{A}\right]_{i,j} \ne \left[\overset{*}{A}\right]_{i,j}
  \]
\end{document}

Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
koffer
Posts: 3
Joined: Thu Jan 12, 2012 8:09 pm

Re: amsmath | Unnecessary vertical Space with '\overset'

Post by koffer »

Great! Thank you very much, Thorsten! That works and looks really good. Though, I don't quite understand the tex code...
Post Reply