So I have a rule pointing at the middle of the following text. I have achieved this with the following code:





The height 1ex is the height of an x in current font. This raises my rule higher than the centre of an open bracket that follows. This looks awkward especially for curly brackets. My question is: What height above the baseline do I need to achieve the following effect: "-(x" or "-{x" where the - is supposed to represent my rule and the x is present to show the discrepancy between the height 1ex and that of the - character.

  • Just in case you didn't know, you can measure the height of the bracket with \settoheight\height, where \height is a length variable. You can then write 0.5\height to get half the height.
    – user10274
    Aug 8 '12 at 7:31
  • I should have known that. Aug 8 '12 at 7:58
  • 1
    @MarcvanDongen -- just the height of the bracket doesn't give the needed value. brackets also have depth, so the actual vertical span of the bracket is height plus depth. but heiko has the more direct answer: the middle of all "fences" in tex math is the math axis, which also happens to be the vertical center of the equals sign and plus. however, in fonts that were designed to be used mainly (or only) for text, the brackets, parntheses, etc., may not have sufficient depth to be visually vertically centered for tex math. Aug 8 '12 at 12:23
  • @barbarabeeton Thanks for that. I should have pointed that out. Heiko's solution is much better, which is why I gave him credit for it.
    – user10274
    Aug 8 '12 at 12:33

The middle of the brackets is the math axis. Command \vcenter centers its contents at the math axis.

$\vcenter{\hrule width \Fbaselength height \Flinewidth}$

This is syntax of plain TeX that also works in LaTeX. But it can also be expressed in "pure LaTeX":

  • I appreciate getting both the plain TeX and pure LaTeX in the answer. Aug 8 '12 at 7:59

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.