Here is a command \xoverline[width percent]{symb} that will do it. Note that it will not scale inside sub or superscripts. If you need that, everthing has to go through a \mathchoice resulting in a lot more complex code.

\documentclass{article}
\usepackage{amsmath,amssymb}
\makeatletter
\newsavebox\myboxA
\newsavebox\myboxB
\newlength\mylenA

\newcommand*\xoverline[2][0.75]{%
    \sbox{\myboxA}{$\m@th#2$}%
    \setbox\myboxB\null% Phantom box
    \ht\myboxB=\ht\myboxA%
    \dp\myboxB=\dp\myboxA%
    \wd\myboxB=#1\wd\myboxA% Scale phantom
    \sbox\myboxB{$\m@th\overline{\copy\myboxB}$}%  Overlined phantom
    \setlength\mylenA{\the\wd\myboxA}%   calc width diff
    \addtolength\mylenA{-\the\wd\myboxB}%
    \ifdim\wd\myboxB<\wd\myboxA%
       \rlap{\hskip 0.5\mylenA\usebox\myboxB}{\usebox\myboxA}%
    \else
        \hskip -0.5\mylenA\rlap{\usebox\myboxA}{\hskip 0.5\mylenA\usebox\myboxB}%
    \fi}
\makeatother
\begin{document}

$|\xoverline{W}|~~
 |\xoverline{i}|~~
 |\xoverline[3.0]{i}|$

\bigskip

$\bar{\mathbb{R}}~~\overline{\mathbb{R}}~~\xoverline{\mathbb{R}}$

\end{document}

Answer from Danie Els on Stack Exchange
🌐
Wikipedia
en.wikipedia.org › wiki › Pbar
Pbar - Wikipedia
December 29, 2019 - antiproton, a fundamental particle, its symbol is · p · ¯ · {\displaystyle {\bar {p}}} , "p-bar" Category: Disambiguation pages · Search · Pbar ·
🌐
Wiktionary
en.wiktionary.org › wiki › pbar
pbar - Wiktionary, the free dictionary
(physics) antiproton (pronunciation spelling of the symbol )
Discussions

How do you type an overbar over the letter "P" to signify after? - Google Docs Editors Community
Skip to main content · Google Docs Editors Help · Sign in · Google Help · Help Center · Community · Google Docs Editors · Terms of Service · Submit feedback · Send feedback on More on support.google.com
🌐 support.google.com
June 26, 2023
stacking symbols - The \bar and \overline commands - TeX - LaTeX Stack Exchange
\documentclass{article} ...ge=cal,StylisticSet=1] % \varbar: 4 parameter auxiliary macro for forming a wide bar accent % #1: linear offset from the right of the entire post-accent symbol (morally intended to compensate for total horizontal space lost or gained due to ... More on tex.stackexchange.com
🌐 tex.stackexchange.com
July 2, 2011
What do the symbols p with hat on top, x with bar on top, and s represent? Defined variables Variables of interest Sample statistics Population parameters
On Studocu you find all the lecture notes, summaries and study guides you need to pass your exams with better grades. More on studocu.com
🌐 studocu.com
1
September 1, 2023
[Q] Why do we use x̄ as the symbol for sample mean?
bar is generally used to denote means, but why because someone did it that way, presumably because it seemed like a good idea at the time, and then other people followed suit, as with almost any notational convention. m was often used for means of both distributions and of samples across a wide range of time; it's "re-invented" regularly. I always assumed the bar came from physics. The use of a bar over small x is discussed here: https://mathshistory.st-andrews.ac.uk/Miller/mathsym/stat/ (or see the older version of the page here http://www.math.hawaii.edu/~tom/history/stat.html ) ... scroll about 3/4 of the way down, to the section headed SYMBOLS IN STATISTICS and look at paragraph 2. It looks like it did indeed come from physics. Why are there competing conventions, anyways? Because people keep ignoring existing conventions in favor of ones they like for one reason or another (sometimes out of ignorance, sometimes with a pedagogical motive, sometimes to avoid a clash with some other convention, etc). Standards always multiply. Just recently (i.e. in the last few decades) it happened when ML people started adopting a lot of statistical methods and redefined all the terms and symbols (sometimes to match their own pre-existing terms, sometimes out of ignorance that there was already a good term/notation, sometimes for other reasons). Sadly, some of those conventions cause serious issues (like calling a regression coefficient a weight, leading to a serious clash when you need to talk about weighted regression). More on reddit.com
🌐 r/statistics
5
4
April 7, 2022
🌐
Qualityandinnovation
qualityandinnovation.com › 2014 › 11 › 22 › typing-x-bar-y-bar-p-hat-q-hat-and-all-that-2
Typing x-bar, y-bar, p-hat, q-hat, and all that! In Microsoft Word (& Excel) – Quality and Innovation
November 22, 2014 - But turns out, it DOES have this very useful capability called “combining diacritics” — and here’s how you can use it to type characters with their own hats and bars on them. ... First, type in a letter that you want to adorn with a hat. Say, for example, p. Next, go to Insert -> Symbol, drop down to “More Symbols”, and in the window that pops up, make sure you have selected “Arial Unicode MS” as the font.
🌐
Wumbo
wumbo.net › symbols › p-hat
P Hat Symbol (p̂)
In statistics, the p-hat symbol (written as p̂, with a “hat” or “caret” over the letter p) is used to represent the proportion of a sample with a particular characteristic or outcome.
🌐
Google Support
support.google.com › docs › thread › 222793683 › how-do-you-type-an-overbar-over-the-letter-p-to-signify-after
How do you type an overbar over the letter "P" to signify after? - Google Docs Editors Community
June 26, 2023 - Skip to main content · Google Docs Editors Help · Sign in · Google Help · Help Center · Community · Google Docs Editors · Terms of Service · Submit feedback · Send feedback on
Find elsewhere
🌐
Pi Symbol
pisymbol.net
Pi Symbol π Copy and Paste
List of mathematical pi symbols, copy and paste pi symbol or use code.
🌐
Brands of the World
brandsoftheworld.com › logo › p-bar-symbol
P. Bar. Symbol | Brands of the World™ | Download vector logos and logotypes
January 25, 2004 - Download the vector logo of the P. Bar. Symbol brand designed by in Encapsulated PostScript (EPS) format.
🌐
Wikipedia
en.wikipedia.org › wiki › Overline
Overline - Wikipedia
1 month ago - An overline, overscore, or overbar, is a typographical feature of a horizontal line drawn immediately above the text. In old mathematical notation, an overline was called a vinculum, a notation for grouping symbols which is expressed in modern notation by parentheses, though it persists for symbols under a radical sign.
🌐
Wolfram MathWorld
mathworld.wolfram.com › Bar.html
Bar -- from Wolfram MathWorld
December 30, 1999 - Common uses of the bar symbol include the following. ... In conventional typography, "bar" refers to a vertical (instead a horizontal) single bar such as those used to denote absolute value () (Bringhurst 1997, p.
🌐
Pinterest
in.pinterest.com › explore › design
P Bar Symbol
March 30, 2023 - Pop Culture · Bar · Embroidery · ? Logo · Logos ·
🌐
Worldvectorlogo
worldvectorlogo.com › logo › p-bar-symbol
P Bar Symbol Vector Logo - Download Free SVG Icon | Worldvectorlogo
Download P Bar Symbol logo vector in SVG format. This logo is compatible with EPS, AI, PSD and Adobe PDF formats.
🌐
The Physics Hypertextbook
physics.info › symbols
Special Symbols – The Physics Hypertextbook
Opus in profectus · [close] These are the conventions used in this book. Vector quantities (F, g, v) are written in a bold, serif font — including vector quantities written with Greek symbols (α, τ, ω). Scalar quantities (m, K, t) and the magnitudes of vector quantities (F, g, v) are written in an italic, serif font — except for Greek symbols (α, τ, ω), which use a roman serif font.
🌐
SVGmix
svgmix.com › item › 4Mx5KA › p-bar-symbol
P Bar Symbol SVG Logo | Free SVG logos & icons download | SVGmix
Download the P Bar Symbol Logo for free in native SVG vector format, ensuring seamless compatibility with popular image editing programs and apps such as Figma, Sketch, Corel, Illustrator, Adobe XD, and InDesign.
🌐
Spreadsheet Daddy
spreadsheetdaddy.com › home › excel › how to☝️ type x-bar, y-bar, p-hat, and other statistical symbols in microsoft excel
How To☝️ Type X-bar, Y-bar, P-hat, and Other Statistical Symbols in Excel
September 12, 2025 - A quick rule to remember: bars are averages while hats are estimates. But actually typing any of these statistical symbols in Excel can be a bit tricky. Fortunately, there are multiple ways to work around the issue. First, for those looking to copy the symbol they’re looking for and take off, here’s the list of them to save you up some time: ... 1. Type “p” into any empty cells, for an x-hat, type “x” letter instead – now you catch the drift, right?
🌐
BrownMath
brownmath.com › swt › symbol.htm
Symbol Sheet / SWT
In geometric and binomial probability distributions, p is the probability of “success” (defined here in Chapter 6) on any one trial and q = (1−p) is the probability of “failure” (the only other possibility) on any one trial.
🌐
BYJUS
byjus.com › maths › math-symbols
The basic mathematical symbols used in Maths help ...
May 4, 2023 - To understand this in an easier way, the list of mathematical symbols are noted here with definition and examples. There are numerous signs and symbols, ranging from the simple addition concept sign to the complex integration concept sign. Here, the list of mathematical symbols is provided in a tabular form, and those notations are categorized according to the concept.
🌐
Reddit
reddit.com › r/statistics › [q] why do we use x̄ as the symbol for sample mean?
r/statistics on Reddit: [Q] Why do we use x̄ as the symbol for sample mean?
April 7, 2022 -

Perhaps more of a meta-statistics question than a statistics question, but I've been trying to understand the origins of the conventional symbols used in statistics and can't find any good sources. The two most common ways to distinguish a parameter from an estimator seem to be either using roughly equivalent Greek and Latin characters or hat. I've seen both 'π' and 'p' used to represent population proportions (though 'p' is definitely more common in introductory courses) and I've seen 'π' used often as a function in Bayesian statistics. Hat seems to be the preferred method of denoting an estimator for any new methods/unestablished/'non-canonical' statistics. Both 's' and 'σ' make a lot of sense, and 'μ' makes sense for population means, so where on earth did 'x̄' come from? Was 'm' already being used elsewhere? Did it come about before these conventions were established? I'm aware the 'X' is the goto for random variables and bar is generally used to denote means, but why? Why are there competing conventions, anyways?

Top answer
1 of 2
7
bar is generally used to denote means, but why because someone did it that way, presumably because it seemed like a good idea at the time, and then other people followed suit, as with almost any notational convention. m was often used for means of both distributions and of samples across a wide range of time; it's "re-invented" regularly. I always assumed the bar came from physics. The use of a bar over small x is discussed here: https://mathshistory.st-andrews.ac.uk/Miller/mathsym/stat/ (or see the older version of the page here http://www.math.hawaii.edu/~tom/history/stat.html ) ... scroll about 3/4 of the way down, to the section headed SYMBOLS IN STATISTICS and look at paragraph 2. It looks like it did indeed come from physics. Why are there competing conventions, anyways? Because people keep ignoring existing conventions in favor of ones they like for one reason or another (sometimes out of ignorance, sometimes with a pedagogical motive, sometimes to avoid a clash with some other convention, etc). Standards always multiply. Just recently (i.e. in the last few decades) it happened when ML people started adopting a lot of statistical methods and redefined all the terms and symbols (sometimes to match their own pre-existing terms, sometimes out of ignorance that there was already a good term/notation, sometimes for other reasons). Sadly, some of those conventions cause serious issues (like calling a regression coefficient a weight, leading to a serious clash when you need to talk about weighted regression).
2 of 2
2
I don't have many answers in terms of why notation differs, but X is often written as a vector of random variables (in mathematical statistics at least). I think it makes sense then that x_bar is a commonly used notation to denote the mean of that vector because μ is already used to describe the population mean e.g. X_1...X_n Where X_i ~ N(μ, σ). edit: rereading your post again, I guess my question is: "what would be a more readable notation than x̄ is the mean of X?" I suppose you could use μ_X or something but then it's not explicit that this mean should differ from the population μ.