Math & Scienceoverbar in parentheses

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
stbeale
Posts: 7
Joined: Sat Nov 07, 2009 7:54 pm

overbar in parentheses

Post by stbeale »

I would like to have an overbar in parentheses to imply particles and antiparticles (ie p or \bar{p}). I've seen this notation used in PRL so I presume it can be done in latex.
Does anyone know how?

Cheers,
Steve

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: overbar in parentheses

Post by frabjous »

I'm not entirely sure exactly what look you're after -- perhaps I'd need to know more about particle physics -- but does the \overline{ ... } command do what you want? There's also \bar{...} but you seem to know about that one already...
stbeale
Posts: 7
Joined: Sat Nov 07, 2009 7:54 pm

Re: overbar in parentheses

Post by stbeale »

sorry I should have been more clear. I would like the parentheses included in the 'overness.' That is, parenthesis around the line, all over the 'p'
Kinda like this:
(-)
p
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

overbar in parentheses

Post by gmedina »

Hi,

perhaps you are looking for something like the following?

Code: Select all

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\[ \overset{(-)}{p} \]

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
stbeale
Posts: 7
Joined: Sat Nov 07, 2009 7:54 pm

Re: overbar in parentheses

Post by stbeale »

\overset is a step in the right direction, but it can't seem to get the size of parentheses right. The standard font size is way to big, the parenthesis should not be significantly wider than the bar. I can make them bigger using \Big etc... but \small,\tiny etc doesn't seem to do anything.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

overbar in parentheses

Post by gmedina »

Try this:

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\usepackage{relsize}

\begin{document}

\[ \overset{\text{\relsize{-1}(}-\text{\relsize{-1})}}{p} \]

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
stbeale
Posts: 7
Joined: Sat Nov 07, 2009 7:54 pm

Re: overbar in parentheses

Post by stbeale »

I can only get down to 6pt font. This is still too big. Even if I define a new size command as 1pt, latex complains and returns me to 6pt. I think I need an actual smaller '(' character that does not need to be scaled. I'll look around and post back.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

overbar in parentheses

Post by gmedina »

Another option, using some of the features provided by the graphicx package (now you can control the parentheses size at will):

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}

\newcommand\mysymb{\scalebox{.3}{(}\raisebox{-1.7pt}{$-$}\scalebox{.3}{)}}

\begin{document}

\[ \overset{\mysymb}{p} \]

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

overbar in parentheses

Post by phi »

The problem with arbitrary scaling is that quality is substantially degraded because the stroke widths don't match any more. The quality is a bit better if you use the smallest boldface font:

Code: Select all

\documentclass{article}
\usepackage{lmodern}
\usepackage{amsmath}

\begin{document}

\[ \overset{\textbf{\fontsize{3pt}{3pt}\selectfont(---)}}{p} \]

\end{document}
stbeale
Posts: 7
Joined: Sat Nov 07, 2009 7:54 pm

overbar in parentheses

Post by stbeale »

The smallest font that I can use is 5pt. If I request anything smaller than that, latex complains and makes it 5pt anyways.
I've managed to get approximately what I was after using a combination of \raisebox and \scalebox. it doesn't look the best (it doesn't render properly in the dvi file either), but it's most functional for basic things like pbars. More exotic particle names that involve superscripts don't look so good.

The command I'm using is this;

Code: Select all

\newcommand\brabar{\raisebox{-4.0pt}{\scalebox{.2}{
\textbf{(}}}\raisebox{-4.0pt}{{\_}}\raisebox{-4.0pt}{\scalebox{.2}{\textbf{)
}}}}
Then apply it like this;

Code: Select all

$\overset{\brabar}{p}$
Example results (with a regular pbar for reference)
Image

If i could get the superscript 0 to sit properly as though the bar wasn't there, it would be a bit nicer. Also the right bracket is a bit to close to the bar.
Post Reply