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

If one wants to raise some text one uses something like

\raisebox{0.5 em}{some text}

However this doesn't respect line breaks and may cause some nasty overflows.

Is there a way to have \raisebox respect line breaks? Or an alternative that provides the same functionality?

Edit: Here's an example for clarification:



Lorem ipsum dolor sit amet,
\raisebox{0.5 em}{consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}


I need the raised text to line break like it would if it wasn't raised.

Edit2: Apparently my clarification wasn't to helpful. I want to raise an entire sentence, if I use \raisebox the sentence will overflow to the right (as seen in the example).

If this was HTML I would use <sup>some text</sup> which is able to handle line breaks.

share|improve this question
What do you need this for? It's not really possible with TeX do that (it is with LuaTeX). – egreg Mar 23 '12 at 22:33
Doing this in TeX requires a special "raised" font. I seem to recall a paper on TUGboat that describes how to do something similar with LuaTeX, but I can't find it. – egreg Mar 24 '12 at 10:59
Since various answers have been given, would you please state clearly in your question that the raised text should begin in mid paragraph? Also some background would be useful: what are you trying to achieve? – egreg Mar 24 '12 at 11:31
OK. What's the purpose? Long superscripted text is unreadable and destroys the page uniformity. – egreg Mar 24 '12 at 14:12
@egreg: It's supposed to mark a handwritten addition to a manuscript. For this purpose I find it to be typographically appropriate. – Emerson Mar 24 '12 at 14:34
up vote 11 down vote accepted

As @egreg said this is not fully automatically possible with TeX for a simple reason: TeX offers no way to automatically determine the hyhenation points in a word and use them other than in the default manner.

But if you are prepared to mark up hyphenations yourself there are ways to get the rest automatically done. Below is a trivial implementation:






Lorem ipsum dolor sit amet, consectetur 
\Y{adipisic-}{ing}{adipisicing} \X{elit,} \X{sed} do eiusmod tempor incididunt ut
 labore et dolore magna aliqua.


This results in

enter image description here

which is what I think you are looking for as the output. Of course this is not the way you would want to code it. With some small coding improvements you could use a syntax like

Lorem ipsum dolor sit amet, consectetur 
  adipisic\-ing elit, sed
do eiusmod tempor incididunt ut labore et dolore magna aliqua.


  • possible hyphenation points are maked up by \-
  • a - would automatically be allowed as hyphenation point

Basically you would need to parse the text until the end of the environment looking for - or \- or "spaces" and construct stuff like \Y and \X from above accordingly (not doing that tonight :-)

Upate: a simple parser

okay so here is a simple parser that takes care of \- and explicit -. Not really cleanly written, sorry for that.



% we need space, -, and newline active and set to some commands
\gdef\setraisedtextactivedef#1#2{\let =#1\let^^M=#1\let-=#2}}


% main action is to collect material into a box

% and if we want we can use a special style

% at a space end collection, typeset and restart

% at \- end colloection, typeset, add discretionary and restart
% at - (explicit hyphen) more or less the same

% several active spaces (or newlines) would do harm ...

% putting all together
% at end environment, end collection and typeset (if not empty). 
% Otherwise remove space already inserted before that collection
       \ifdim\wd\raisedtextbox>0pt  % weak prove that this is not empty


Lorem ipsum dolor sit amet, consectetur 
      adipisic-ing       elit,      sed
 do eiusmod tempor incididunt ut
 \begin{raisedtext}[1.5ex] la-bore-et do-lore
\end{raisedtext}  magna aliqua.


doing that gives us (with a style definition of \small\itshape)

enter image description here

share|improve this answer
Indeed, this is what I was looking for! It'd be great if you could write such an environment. – Emerson Mar 25 '12 at 12:35
added a definition for this. Could certainly be done in a cleaner fashion but ... – Frank Mittelbach Mar 25 '12 at 20:55

You need to use a box which allows the building of paragraphs first, like \parbox or the minipage environment. Both require the to be used line width as an argument, which might be an issue. There is also the varwidth environment based on minipage by the varwidth package, which takes the width argument only as maximal width.

You can try:

% ..
\raisebox{<amount>}{\begin{varwidth}{<max width>} multi \\ line \\ text\end{varwidth}}

An alternative is my adjustbox package, which provides raise, minipage and varwidth keys. It's basically the same as above but with a nicer interface:

% ..
\adjustbox{varwidth=<max width>,raise=<amount>}{ multi \\ line \\ text }
% or:
\adjustbox{varwidth=<max width>,raise=<amount>}\bgroup multi \\ line \\ text \egroup
% or:
\begin{adjustbox}{varwidth=<max width>,raise=<amount>}
     multi \\ line \\ text

Note that \parbox, minipage and varwidth have optional arguments which determine the baseline of the produced box. These influence the placement of the text relative to other text outside the box but still on the same line.

share|improve this answer
I'm not sure that this answers the question (but it is admittedly not very clear). – egreg Mar 23 '12 at 23:01
@egreg: That's the way I understand the question. – Martin Scharrer Mar 23 '12 at 23:04
Thanks, but that isn't what I was looking for. – Emerson Mar 24 '12 at 10:53

You can simply raise a block of text by writing:


Adjust the (-5pt) in the MWE example to see how it works.

First paragraph

share|improve this answer

Like a \raise (in horizontal mode) with a \vbox? (plain-tex)

\hsize=24pc % just to make it break into lines

Lorem ipsum dolor sit amet,

  consectetur adipisicing elit, sed do
  eiusmod tempor incididunt ut labore et dolore magna aliqua.}

Lorem ipsum dolor sit amet.
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.