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.

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 represent a matrix in bold form throughout my paper, as $\bm B$. I need to add an overline to indicate a subtle transformation to this matrix. However the command $\overline{\bm{B}}$ does not seem to work. Dito with using $\bar$.

How to achieve a line on top of a bold matrix?

share|improve this question
    
Maybe embrace it: $\bar{\bm B}$ or $\overline{\bm B}$ – Steven B. Segletes Mar 21 at 13:08
    
\bar is too short, \overline too long, in my point of view – Christian Hupfer Mar 21 at 13:09
    
Please show us a full working example that generates the problem behavior. For what it's worth, \documentclass{article} \usepackage{bm} \begin{document} $\overline{\bm{B}}$ \end{document} would appear to generate a line above a bold B without any problems. – Mico Mar 21 at 13:10
    
@Mico: Does not work for me. I shall attach the example soon. – Bravo Mar 21 at 13:13
1  
@Bravo - An expression such as "Does not work for me" is not at all helpful. Please be more specific. – Mico Mar 21 at 13:48
up vote 4 down vote accepted

After showing how \bar and \overline can be made to work by embracing the argument, I then introduce \overlinebold that scales with math style and perhaps looks better. It uses the width of the upright version of the letter, and offsets the overstoke by 3mu to account for the italics.

\documentclass{article}
\usepackage{bm}
\usepackage{scalerel}
\def\overlinebold#1{\ThisStyle{\ooalign{%
  $\SavedStyle\mkern3mu\overline{\phantom{\mathrm{#1}}}$\cr $\SavedStyle\bm #1$}}}
\begin{document}
$\overline{\bm B}\quad \bar{\bm  B} \quad\overlinebold{B}$

$\scriptstyle \overline{\bm J}\quad \bar{\bm  J} \quad\overlinebold{J}$

$\scriptscriptstyle \overline{\bm M}\quad \bar{\bm  M} \quad\overlinebold{M}$
\end{document}

enter image description here

share|improve this answer

I suggest to use some markup command, say \mymatrix and the \closure command (by E. Gregorio (egreg), see the comprehensive symbol table) to provide a rule over the symbol which isn't to small or too wide.

\documentclass{article}

\usepackage{bm}

\newcommand{\closure}[2][3]{%
{}\mkern#1mu\overline{\mkern-#1mu#2}}

\newcommand{\mymatrix}[2][3]{%
  \closure[#1]{\bm{#2}}%
}


\begin{document}
$\mymatrix{B}$
\end{document}
share|improve this answer

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.