I would like to put a subscript after a character with multiple underlines in the math mode but ignoring the underlines. How can I do it?

Consider this picture: vertical subscript positions I would like the subscript to have the vertical position of the element with respect to the character. Here is the code the produced the picture:


Edit: Would be superb if the underline was limited to the width of the character.

  • 2
    What about the horizontal position? For the vertical position the easiest thing here is to use an empty group, e.g. \underline{\bm{C}}{}_{\text{c}}.
    – campa
    Jul 28 '17 at 15:00
  • Thank you, @campa! I am so stupid :). I updated the post about to reflect on my preference about horizontal position. Jul 28 '17 at 15:04
  • \smash{\underline{\underline{\bm{C}}}}_{\text{c}} as a partially satisfying way
    – user4686
    Jul 28 '17 at 16:15
  • Thanks, @jfbu, but I fail to see how it is different from the empty group solution, proposed above. Jul 28 '17 at 16:24
  • @campa, if adjusting the length of the underline is too much work, could you please submit your comment as an answer? Jul 28 '17 at 16:31

Thanks to this answer, the following satisfied my requirements, including additional:

\newcommand{\ubar}[1]{\mkern 1.5mu\underline{\mkern-1.5mu#1\mkern-1.5mu}\mkern 1.5mu}

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.