TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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 want a digit inside around other digits could centered vertically in height, without affecting by normal font size setting, as image show:

enter image description here

(The enlarged six is {\Large6}) but I couldn't get the result by using the \raisebox command and the ex length unit to raise. Please help!

share|improve this question
up vote 10 down vote accepted

Using \raisebox is the right way. You can use \height to refer to the height of the content i.e. the height above the baseline. The \depth should be zero for normal numbers. You then need to subtract the \height from the normal height and divide it by 2. The normal height from an uppercase letter is about 1.6ex or 80% of the \strut height given by \ht\strutbox. You can use e-TeX's \dimexpr to do the calculation.




0000\vcentered{\Large 6}00000\vcentered{\small 9}00000

0000\vcentered{\Huge 6}00000\vcentered{\tiny 9}00000




You could do it even more accurate if you would provide a reference for the normal height. In addition you could also take the depths in account.




\setvref{0}0000\vcentered{\Large 6}00000\vcentered{\small 9}00000

\setvref{0}0000\vcentered{\Huge 6}00000\vcentered{\tiny 9}00000

share|improve this answer
tikz is redundancy? – Leo Liu Apr 21 '11 at 15:04
@Leo: tikz would be overkill. – Martin Scharrer Apr 21 '11 at 15:05
@Martin So why is it in the preamble? :-) (Which was Leo's question.) – Alan Munn Apr 21 '11 at 16:58
@Alan: Ups. It's in my default preamble and I forgot to delete it in one of the code examples. Sorry, I didn't really understood what Leo meant. – Martin Scharrer Apr 21 '11 at 17:36
@M.S. That is exactly what I want! Thanks! – Stufazi Hoqckt Apr 22 '11 at 13:24

I would use:


instead of Martin's definition. Although it gets a little different centered text, it is originally designed for vertical alignment in TeX.

The key is usage:

\vcentered{\tiny 9}\vcentered{00000}

enter image description here

share|improve this answer
This gives my i.imgur.com/zfNA2.png. Especially the smaller 9 isn't correctly centered. AFAIK \vcenter centers to the baseline. The OP needs to have it centered towards the middle of the surrounding 0s. – Martin Scharrer Apr 21 '11 at 15:08
@Martin: See the usage. – Leo Liu Apr 21 '11 at 15:10
@Martin: \vcenter centers with respect to the axis of formulas; it's the imaginary line where the fraction lines are set. – egreg Apr 21 '11 at 15:43
Thanks all above – Stufazi Hoqckt Apr 22 '11 at 13:23

Your Answer


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.