TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to produce a particular symbol represented by a capital letter with an uppercase index and an overline bar between small parenthesis. By looking on the web I found

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath,amssymb}
\usepackage{mathtools}

\begin{document}
\newcommand\brabar{\scalebox{.3}{(}\raisebox{-1.7pt}{$-$}\scalebox{.3}{)}}
\[
\overset{\brabar}{D}\phantom{}^{0}
\]
\end{document}

which produce something close to what I am looking for (not in a very elegant way). I would simply like to have the (-) overset symbol closer to the D capital letter. Is it possible to do that? Thank you very much in advance.

share|improve this question
1  
Is this supposed to appear in math mode or text mode? – Alenanno Jan 5 at 15:48
    
Actually, both... – Wellow Jan 5 at 15:54
up vote 11 down vote accepted

You can use the stackengine package. Ignore all the commands in the example, I only used those to typeset a compact example.

The commands that are important for you are

% PREAMBLE
\newcommand\brabar{\scalebox{.3}{(}\raisebox{-1.7pt}{--}\scalebox{.3}{)}} 

% DOCUMENT
\stackon[.1pt]{<letter>}{\brabar}

enter image description here

\documentclass{article}
\usepackage{geometry}
\usepackage{stackengine}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{pgffor}

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

\begin{document}
\newgeometry{textwidth=3.5cm}
\foreach \lett in {A,B,C,...,Z}{
\noindent\stackon[.1pt]{\lett}{\brabar}
}
\restoregeometry
\end{document}
share|improve this answer
1  
By using $ \stackon[.1pt]{D}{\brabar}\phantom{}^0$ I get what I wanted. Thank you. – Wellow Jan 5 at 15:57
1  
Out of curiosity, how well does this scale in text mode? Math mode sub/superscripts? – Sean Allred Jan 5 at 21:06
    
@SeanAllred Sorry for the late reply. As in using \Huge? Not really. I'm trying to find a solution to that, maybe group the \brabar components so they scale together, but I'm not sure how to approach it. – Alenanno Jan 6 at 11:40

With this code?

\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{accents}
\newcommand\brabar{\scalebox{.3}{(}\raisebox{-1.7pt}{$-$}\scalebox{.3}{)}}
\newcommand\brobor{\smash[b]{\raisebox{0.6\height}{\scalebox{0.5}{\tiny(}}{\mkern-1.5mu\scriptstyle-\mkern-1.5mu}\raisebox{0.6\height}{\scalebox{0.5}{\tiny)}}}}

\begin{document}

\[
\overset{\brabar}{D}\phantom{}^{0}
\]


\[
\accentset{\brobor}{D}\phantom{}^{0}
\]

\end{document} 

enter image description here

share|improve this answer

The main problem is that -- is asymmetrical and $-$ is contained in a very large box. One can demonstrate this using \fbox with \fboxsep=0pt.

\documentclass{standalone}
\usepackage{mathtools}
\newcommand\brabar{\scalebox{.3}{(}\raisebox{-1.7pt}{$-$}\scalebox{.3}{)}}

\newcommand\brabarb{\scalebox{.3}{(}\raisebox{-1.7pt}[0pt][0pt]{$-$}\scalebox{.3}{)}}

\begin{document}
$
\overset{\brabar}{D}\phantom{}^{0}  
\overset{\brabarb}{D}\vphantom{D}^{0}
$
\end{document}

overset

share|improve this answer

A version using TikZ (also not elegant but working, edited to make it appear "naturally" when used within a formula):

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath,amssymb}
\usepackage{mathtools}
\usepackage{tikz}

\begin{document}
\newcommand{\brabar}[2]{\tikz[baseline]{\node at (0,0.1) {#1};\node at (0,0.28) {\scalebox{.3}{(}\raisebox{-1.7pt}{$-$}\scalebox{.3}{)}};\node at (0.3,0.3) {\scriptsize #2};}}
\[
\brabar{D}{0}
\]
\end{document}

The output looks as follows: enter image description here

You can customize the positioning by adjusting the coordinates.

share|improve this answer
    
Thanks! Nice solution! Anyway if I use it in math mode instead of displaymath I get a vertical shift (example: $B^\pm \to K^\pm \brabar{D}{0}$). How can I fix that? – Wellow Jan 5 at 15:45
    
@MVal I also noticed this and changed my code. Please try again. – cryingshadow Jan 5 at 15:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.