TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

How to get a box including some text in text mode, which depth 0pt?

share|improve this question
Can you give a more precise question to adapt my answer? What you want to do exactly with your text ? – Alain Matthes Apr 25 '11 at 6:53
@Altermundus I want the M.S.'s answer! Thanks you too! – Stufazi Hoqckt Apr 25 '11 at 8:30
@M.S. No problem! – Stufazi Hoqckt Apr 25 '11 at 8:31
"at" replies are only seen by the addressee if you use the first few characters of the username. So "@Martin" or "@MartinScharrer" will get noticed but not "@M.S." – Matthew Leingang Apr 25 '11 at 11:34
@ Matthew, I got it. – Stufazi Hoqckt Apr 25 '11 at 11:37
up vote 16 down vote accepted

You can use \raisebox to modify the official height and depth of some text:


This raises the text by 0pt (so not at all), keeps the official height identical to the original height and sets the depth to 0pt.

share|improve this answer
@M.S.That is exactly what I want! Thank you. – Stufazi Hoqckt Apr 25 '11 at 8:54
Just a note to clarify that the first optional parameter specifies the height (that is, x-height), and the second the depth (distance to lowest descender). And \height is a command to get the natural height of <text>. – John Peyton Jun 8 '15 at 16:11

\smash{great} is a box with zero height and no depth

share|improve this answer
@Herbert But if I use \smash{a} in text mode, the letter a turned a math italic shape. – Stufazi Hoqckt Apr 25 '11 at 8:53
no, that is not possible, only inside math you'll get an italic a. – Herbert Apr 25 '11 at 9:18
@Herbert: With amsmath you can also say \smash[b]{g} to get zero depth and unmodified height (there's also \smash[t]{...}. – egreg Apr 25 '11 at 10:03
@Herbert Ehh, I just put the \smash in \DeclareMathOperator, that is, \DeclareMathOperator*{\Sup}{su\smash{p}} and use $\Sup$. While \DeclareMathOperator*{\Sup}{su\raisebox[0pt]{\height][0pt]{p}} is good. – Stufazi Hoqckt Apr 25 '11 at 11:33
@egred: I know ... there is also a [bt]. But this is not the problem here ... – Herbert Apr 25 '11 at 13:20

I don't know exactly what you want to do but if you want a special box with special dim then you can try :

\ht\mybox=10mm \dp\mybox=0pt \wd\mybox=20mm

But If you put some text in your initial \hbox, you can have some strange results ! When you make a box with some contents, height, depth and width depend of the context.

share|improve this answer
You should not modifiy the height and width, unless you are looking for "strange results"!!! – unbonpetit Apr 25 '11 at 8:09
Thanks, I just want a box, inside it is some text, and the box is no depth. – Stufazi Hoqckt Apr 25 '11 at 8:32

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.