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

In XeTeX, if I have a line with two font sizes, how can I arrange to have the smaller font aligned to either the center or top of the line?


\newfontinstance\biggoth[Color=000000,Scale=5.0]{Cloister Black}
\newfontinstance\smallgoth[Color=000000,Scale=2.0]{Cloister Black}

\biggoth Hello \smallgoth World

The "Hello" aligns to the bottom of the line.

I'm grateful for any thoughts and input.

share|improve this question
up vote 9 down vote accepted

In general, TeX keeps the baselines of all characters (and boxes) at the same height. For a single word, you can do what chl suggested and raise the text using \raisebox. Rather than guessing at how much to raise it, you can put the word in a box (perhaps with a strut), measure its height, and then raise it appropriately.

        \setbox0\hbox{\tiny\strut #1}%
        \raise\dimexpr \ht\strutbox - \ht0\box0
Here's some text. Here's a raised \raiseup{word}.

alt text

share|improve this answer
You may want to crop your image. – Hendrik Vogt Dec 31 '10 at 16:04
@Hendrik: Yeah, I just used Troy Henderson's LaTeX Previewer to generate it before going to bed. – TH. Dec 31 '10 at 21:19
@TH (+1) Great! I wondered how easy it should be to get box height. Here it is... – chl Dec 31 '10 at 22:57
@chl: TeX has \ht for height, \dp for depth, and \wd for width. Width is obvious. Height is the height above the baseline, depth is the distance below the baseline. All are (normally) nonnegative numbers. You can also set any of them: \wd0=3in for example, sets the width of box 0 to 3 inches. – TH. Jan 1 '11 at 0:07
@TH Thanks for the added clarifications. – chl Jan 1 '11 at 9:12

Maybe you can just play with \raisebox, e.g.

\biggoth Hello \raisebox{.5ex}{\smallgoth World}

alt text

share|improve this answer

Here is another possibility, very similar to TH.'s suggestion:

\newfontinstance\biggoth[Color=000000,Scale=5.0]{Cloister Black}
\newfontinstance\smallgoth[Color=000000,Scale=2.0]{Cloister Black}
\tlap{\biggoth Hello}
\tlap{\smallgoth World}

\mlap{\biggoth Hello}
\mlap{\smallgoth World}

alt text

share|improve this answer

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.