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

Is there a horizontal equivalent to \raisebox? I'd like to shift some content horizontally without altering the layout of surrounding content.


I feel bad because my question wasn't precise enough. David Carlisle's answer is the best if you're looking for the true horizontal analogue to \raisebox (moves content horizontally instead of vertically, operates in vertical mode instead of LR mode). However, what I really want is something that works in LR mode.

share|improve this question
@RichardHansen: You could do \hspace*{<length>}\mbox{<content>}\hspace{-<length>} – Martin Scharrer Apr 7 '12 at 20:28
BTW, LaTeX is the default here, so you don't have to mentioned it. For other things like plainTeX there is a special tag. – Martin Scharrer Apr 7 '12 at 20:30
@MartinScharrer: Feel free to add that as an answer. :) How does it compare to Werner's answer? – Richard Hansen Apr 7 '12 at 21:08
up vote 12 down vote accepted

Here is a macro \shifttext{<len>}{<stuff>} that shifts <stuff> by <len> (negative for left, positive for right):

enter image description here

\setlength{\parindent}{0pt}% Just for this example
Here is some text. \par
Here is \shifttext{20pt}{some} text. \par
Here is \shifttext{-20pt}{some} text. \par

Note that, in its current form, the shifted content shouldn't contain any \label or counter content. However, that can be fixed if needed, by boxing the content first.

share|improve this answer
I accepted this answer because it seems like the simplest, it works in LR mode, and it contains an illustration. But the other answers are excellent too. Too bad I can't accept more than one answer. – Richard Hansen Apr 7 '12 at 22:37

If you are in a vertical context you can use the primitive moveright

\moveright  2in  \hbox{.....}
share|improve this answer
Never heard about \moveright. You never stop learning! – Martin Scharrer Apr 7 '12 at 20:26
@MartinScharrer: It's very rarely used. LaTeX2e uses it in one place (outputting the page headers); L3 nowhere yet. Even ConTeXt doesn't use it. – Martin Schröder Apr 7 '12 at 21:00
Is there something like this that works in horizontal mode and is already defined in TeX/LaTeX? Or do I have to make my own macro/use a 3rd party package to do it? – Richard Hansen Apr 7 '12 at 21:05
@RichardHansen in horizontal mode you can just go \hspace{1in}\mbox{hello}\hspace{-1in} \moveright is the natural analogue of \raisebox which is defined in terns of \raise which works exactly the same way (with the same syntax) as \moveright but in hmode rather than vmode. – David Carlisle Apr 7 '12 at 21:18
@DavidCarlisle Is using \hspace is definitely preferred over using \hspace* for this purpose? – Lover of Structure Oct 21 '12 at 2:12

My adjustbox package provides \lapbox[<width>]{<amount>}{<content>} which is a generalization of \rlap{<content>} and \llap{<content>}, but can also be used as horizontal equivalent of \raisebox. The <amount> can be positive or negative and will move the content to the right or left, respectively. The original width can be accessed as \width. The official width can be set manually, otherwise it is reduced by the lap amount.

As always there is also a key aquivilent for \adjustbox{<key=value>}{<content>} called lap in this case.

Except from the adjustbox manual about \lapbox:

This macro is a generalisation of the LaTeX core macros \rlap{<content>} and \llap{<content>} which lap the text to the right or left without taking any official space. The \lapbox macro can be used to only partially lap the content to the right (positive amount) or left (negative amount). As with all macros of this package the original width can be references using \width. The resulting official width of the box is normally the original width minus the absolute lap amount. However, it can also be set explicitly using the option argument. It is also possible to use lap amount which absolute values are larger than the original width. In this case the resulting official width will be zero by default and the content will padded with the required white space. Note that the lap amount always states the distance between the right side of the official box and the right side of the actual content for positive amounts or the distance between the left side of the official box and the left side of the actual content for negative values.

See the manual for graphical examples.


If you want to move some content 1em to the right without changing its official width use:

% ...
\lapbox[\width]{1em}{Some text}
% or
\adjustbox{lap={\width}{1em}}{Some text}

The \adjustbox version can also be combined with other keys, like raise which is the equivalent of \raisebox.

share|improve this answer

I figured out just another simple alternative, that consists of two boxes, one aligned left and the other right.




Shifts 'text' to the right.

share|improve this answer
Very nice, and much easier to get working than the other answers. Thank you – Thomas Aug 22 '15 at 8:33

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.