I want to N squared inside overline.
The superscript in $\overline{N^2}$ is too low. How to raise superscript higher?
Thanks
- 12,567
- 71
-
Welcome to TeX.SX! A tip: You can use backticks ``` to mark your inline code as I did in my edit. – Adam Liter Nov 22 '14 at 05:05
2 Answers
This is done on purpose, in order to avoid excessive height when not really needed. Inside \overline, the current math style changes into the “cramped” variant. You can revert to the uncramped one by explicitly selecting it or using a command that does it for you.
\documentclass{article}
\newcommand{\roverline}[1]{\mathpalette\doroverline{#1}}
\newcommand{\doroverline}[2]{\overline{#1#2}}
\begin{document}
\begin{tabular}{lll}
display: & $\displaystyle\overline{N^2}N^2$ & $\displaystyle\roverline{N^2}N^2$\\
text: & $\textstyle\overline{N^2}N^2$ & $\textstyle\roverline{N^2}N^2$ \\
script: & $\scriptstyle\overline{N^2}N^2$ & $\scriptstyle\roverline{N^2}N^2$ \\
scriptscript: & $\scriptscriptstyle\overline{N^2}N^2$ & $\scriptscriptstyle\roverline{N^2}N^2$\\
\end{tabular}
\end{document}
The center column has \overline, the right column has \roverline.

- 1,121,712
-
Can you explain why you define
\doroverlineand why it gets two arguments? – Nathanael Skrepek Apr 13 '23 at 09:12 -
@NathanaelSkrepek It's described in https://tex.stackexchange.com/a/34412/4427 – egreg Apr 13 '23 at 09:26
Is this what you are looking for?

The example you gave does what it says, it puts a line over N^2. If you tell it to square \overline{N}, you get the result I think you want.
\documentclass[border=2pt]{standalone}
\begin{document}
$\overline{N}^2$
\end{document}
If you actually want the 2 to appear above the line, you'd want to use a custom command:

This goes beyond my skill level so this is just a mockup, I used TikZ for it only because I don't know the proper way to do this using LaTeX/TeX, it's not the best tool for this.
Purely for illustrative purposes, no warranty expressed or implied, probably guaranteed to mess up spacing and alignment:
\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\newcommand{\supersuperscript}{
\hspace{-6.6pt}
\begin{tikzpicture}
\draw (0,0) (0,11.8pt) node {\scriptsize 2};
\end{tikzpicture}
}
\begin{document}
$\overline{N\ }\supersuperscript$
\end{document}
(It would be cool if someone came along and actually showed how the custom superscript should be done...)
- 2,914
-
I want "2" under the overline but higher than the normal position from
$\overline{N^2}$. thanks – user66672 Nov 22 '14 at 07:58