2

I was wondering if there is something that similar to a \widebar when I want to put the bar below a character. I am working in the math mode and here is the relevant preamnle

\documentclass[12pt,letterpaper]{article}
\usepackage[margin=1in]{geometry}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{xfrac}
\usepackage{nicefrac}
\usepackage{accents}
\newcommand\munderbar[1]{%
    \underaccent{\bar}{#1}}

\newcommand*\widebar[1]{%
    \begingroup
    \def\mathaccent##1##2{%
        \rel@kern{0.8}%
        \overline{\rel@kern{-0.8}\macc@nucleus\rel@kern{0.2}}%
        \rel@kern{-0.2}%
    }%
    \macc@depth\@ne
    \let\math@bgroup\@empty \let\math@egroup\macc@set@skewchar
    \mathsurround\z@ \frozen@everymath{\mathgroup\macc@group\relax}%
    \macc@set@skewchar\relax
    \let\mathaccentV\macc@nested@a
    \macc@nested@a\relax111{#1}%
    \endgroup
}

I am using the accent package to put the bar below the character of M_c.

enter image description here

Here is the line of codes I am using \munderbar{M}_{c} < M_{c}^{1} < M_{c}^{0} < \widebar{M_{c}}$

I was wondering how make the bar below the last character, that is, M_c, wider like that of M_c with widebar appearing last.

3
2

The comment suggestion of \underline was rejected because of the size of the undergap in the presence of subscripts. Here, I offer \qunderline as an alternative. The stacking value of -1pt can be tuned to suit.

This 1st version only works in text and display styles.

\documentclass{article}
\usepackage{graphicx,amsmath,stackengine}
\newcommand\qunderline[1]{%
  \ensurestackMath{\stackengine{-1pt}{#1}{\underline{\hphantom{#1}}}
   {U}{c}{F}{F}{S}}%
}
\begin{document}
\[
  M
\underline{M_c} \text{\,vs\,}
\qunderline{M_c}
\qunderline{M_q}
\qunderline{M_j^2}
\]
\end{document}

enter image description here

Here's a version that also works in smaller math styles:

\documentclass{article}
\usepackage{graphicx,amsmath,stackengine,scalerel}
\newcommand\qunderline[1]{\ThisStyle{%
  \ensurestackMath{\stackengine{-1pt}{\SavedStyle#1}
  {\SavedStyle\underline{\hphantom{#1}}}{U}{c}{F}{F}{S}}}%
}
\begin{document}
\[
  M
\underline{M_c} \text{\,vs\,}
\qunderline{M_c}
\qunderline{M_q}
\qunderline{M_j^2}
\scriptstyle\qunderline{M_j^2}
\]
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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