Left \parbox with manual superscript (-> too much spacing in line before the superscript), right \parbox without (-> equal spacing).
How can I get rid of the extra spacing in the left \parbox. \raisebox can be replaced if there is a better way. It is ok if the superscript overlaps with the text in the previous line.

3 Answers
3

You need to use the (first) optional argument of \raisebox to compensate. It allows you to tell LaTeX how high the raised box officially is. So setting it to 0pt would ignore its height. There is also a second optional argument which determines the depth. The dimensions \height, \width, \depth and \totalheight can be used in all three arguments and hold the original dimensions of the content.

I normally use \raisebox{verticalshift}[0pt][0pt]{text}, but this will make the box have zero height/depth. What are the best values to supply for the two optional middle arguments to give the box exactly ordinary line height/depth? I would think that this is relevant if the line consists only of such material.
–
Lover of StructureJan 21 '13 at 22:43

2

@LoverofStructure: You can use the dimension macros mentioned in the answer: \raisebox{<shift>}[\height][\depth]{text} will typeset a raised (or lowered for negative shifts) "text" but with the original height and depth. You can also do calculations based on the original dimensions if you use the calc package or e-TeXs \dimenexpr .. \relax. Also, my adjustbox package provides similar modificators which all allow arithmetic expressions.
–
Martin Scharrer♦Jan 21 '13 at 22:57

Many thanks! The reason why I asked is that I wasn't sure whether the dimensions of \height, \depth, etc are those of the supplied text or those of any potential text around the \raisebox; it's the latter I am interested in. Could you very briefly confirm?
–
Lover of StructureJan 22 '13 at 1:03

@LoverofStructure: Yes, it is the height and depth of the content of \raisebox (see the last sentence of my answer again). Macros do not have knowledge about the potential text around them.
–
Martin Scharrer♦Jan 22 '13 at 6:51

1

@LoverofStructure: I don't understand why you need to do this with the text around the raised material. Simply use \raisebox{<shift>}[\height][\depth]{text} to make LaTeX take the original height and depth of the raised content. The height and depth of the line is always the maximum height and depth of any content, so as long the rest of the line isn't higher or deeper than the native height and depth of the raised text you will get a normal line.
–
Martin Scharrer♦Jan 22 '13 at 10:35