Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

I am trying to write a math paper, and I need to write the following symbol:

$\overline{\underline{X}}$

Is there any package that already contains it?

share|improve this question

marked as duplicate by Speravir, Werner, Guido, Sean Allred, Gonzalo Medina Feb 28 at 2:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2  
I'm not sure whether a macro is defined by some package for that, but you can always define your own, e.g.: \newcommand\ovunderline[1]{\overline{\underline{#1}}}. –  Jubobs Feb 27 at 14:40
1  
Welcome to TeX.SX! What is the notation supposed to represent? –  Sean Allred Feb 27 at 14:43
1  
Do you mean an X with bars above and below close to it, like what is sometimes found for representing Roman numerals? –  egreg Feb 27 at 14:45
3  
Does this question help you? –  Keba Feb 27 at 14:51
    
We are doing sets and relations between them, and the professor usually writes a capital X with bars connecting the two upper extremities together, and the two lower ones as well. What I do not like about this one is the space between the lines and the letter, I would like to eliminate that –  ruben1691 Feb 27 at 17:31
show 4 more comments

2 Answers 2

The \overline{\underline{}} mentioned by Jubobs is easier, if you are happy with that look, unless you wanted to tweak the settings I mention below, or if you want rounded caps on your over/under rules. If you wanted this done on text, rather than math variables, then removing the $ from my definitions will accomplish that.

You can perform an over/understack, as shown here. The rule thickness is set to 0.33pt and can be changed. The offset above and below is set to 1pt and can be changed.

The commented out code includes a cute package located at Is there such a thing as a `\mathrule`? (rounded endcaps), which gives rules a round endcap, rather than a chopped off norm of \rule. The image I show includes both versions

\documentclass{article}
% http://tex.stackexchange.com/questions/161297/is-there-such-a-thing-as-a-mathrule-rounded-endcaps/161309#161309
%\usepackage{roundrule}
%\let\rrule\roundrule
\usepackage{stackengine}
\def\overunderline#1{%
\setbox0=\hbox{$#1$}%
  \stackon[1pt]{\stackunder[1pt]{$#1$}{\rule{\wd0}{.33pt}}}{\rule{\wd0}{.33pt}}%
}
%\def\roverunderline#1{%
%\setbox0=\hbox{$#1$}%
%  \stackon[1pt]{\stackunder[1pt]{$#1$}{\rrule{\wd0}{.33pt}}}{\rrule{\wd0}{.33pt}}%
%}
%\parskip 1ex
\begin{document}
$x\overunderline{x}\overunderline{f}\overunderline{G}y$\par
%$x\roverunderline{x}\roverunderline{f}\roverunderline{G}y$
\end{document}

enter image description here


EDIT: Seeing a comment of the OP, I offer this additional solution:

\documentclass{article}
\usepackage{stackengine}
\def\dbar#1{%
\setbox0=\hbox{#1}%
  \def\stackalignment{r}\stackon[-.25pt]{%
    \def\stackalignment{l}\stackunder[-.3pt]{%
      $#1$}{\rule{.95\wd0}{.33pt}}}{\rule{.95\wd0}{.33pt}}%
}
\begin{document}
\dbar X \dbar Y \dbar R
\end{document}

enter image description here

Here are non-italic versions:

\documentclass{article}
\usepackage{stackengine}
\def\dbar#1{%
\setbox0=\hbox{#1}%
  \stackon[-.25pt]{\stackunder[-.3pt]{#1}{\rule{.95\wd0}{.33pt}}}{\rule{.95\wd0}{.33pt}}%
}
\begin{document}
\dbar X \dbar Y \dbar R
\end{document}

enter image description here

share|improve this answer
add comment
up vote 1 down vote accepted

So, thanks to Keba I found the solution. You can use the romanbar package, which puts bars on top and bottom of a letter, without leaving a gap.

\documentclass[]{article}
\usepackage{romanbar}
\begin{document}
\Romanbar{X}
\end{document}

This generates:

Romanbar

Thanks to everyone for their help!!!

share|improve this answer
add comment

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