How to put bar on top of fields
Assuming the same \mathbb{F}^*_{p^k}
from your previous question:
There are three bars I know of: \bar
, \overline
, and \widebar
. Personally, I like the appearance of the \widebar
, but it changes the height of the *
. Your choice :)
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{widebar}% From here: https://tex.stackexchange.com/a/60253/134574
\begin{document}
\(\mathbb{\bar{F}}^{*}_{p^k}\)
\(\mathbb{\overline{F}}^{*}_{p^k}\)
\(\mathbb{\widebar{F}}^{*}_{p^k}\)
\end{document}
As \bar
looks petty with capital letters, I propose two variants: one based on \overline
, and another one gives a code to use the extensible \widebar
command from mathabx
without loading the package. Compare:
\documentclass[12pt,a4paper]{article}
\usepackage{mathtools, amsfonts}
\DeclareFontFamily{U}{mathx}{\hyphenchar\font45}
\DeclareFontShape{U}{mathx}{m}{n}{
<5><6><7><8><9><10>
<10.95><12><14.4><17.28><20.74><24.88>
mathx10
}{}
\DeclareSymbolFont{mathx}{U}{mathx}{m}{n}
\DeclareFontSubstitution{U}{mathx}{m}{n}
\DeclareMathAccent{\widebar}{0}{mathx}{"73}
\begin{document}
\begin{gather*}
\bar{\mathbb{F}}^{*}_{p^{k}} \\
\widebar{\mathbb{F}}^{*}_{p^{k}} \\
\mkern 0.54mu\overline{\mkern-0.4mu\mathbb{F}\mkern-0.4mu}\mkern0.5mu\vphantom{\mathbb{F}}^{*}_{p^{k}}
\end{gather*}
\end{document}
There are three such combining accents in Unicode, which are available in unicode-math
as \bar
, \overbar
and \overline
.
Some of these accents will combine into a single bar if you put them over consecutive symbols, and you probably do not want that. (If you do, you want to put a single \overline
on both, since the two symbols might have slightly-different heights.) I’ve illustrated the examples with two consecutive bar accents.
I defined a new \widebar
that adds some spacing in between (as a log-like operator). This is wider than the \widebar
in the other examples. The conventional name for a non-extensible version of \overline
was \closure
, but that’s already defined to mean something else.
\documentclass[varwidth, preview]{standalone}
\usepackage{unicode-math}
\DeclareRobustCommand\widebar[1]{\mathop{\overline{#1}}}
\begin{document}
\( \bar{\mathbb{A}}\bar{\mathbb{F}}^{*}_{p^k} \)
\( \overbar{\mathbb{A}}\overbar{\mathbb{F}}^{*}_{p^k} \)
\( \overline{\mathbb{A}}\overline{\mathbb{F}}^{*}_{p^k} \)
\( \widebar{\mathbb{A}}\widebar{\mathbb{F}}^{*}_{p^k} \)
\end{document}
In the default font (Latin Modern Math), you will notice that \bar
is very similar to \overbar
. This is not true in many other fonts. For example, here is the same sample set in the font Stix Two Math:
Much of this code (but not \overbar
) will still work without unicode-math
.