I'd like to achieve something like in the picture below:

enter image description here

Another example:

enter image description here

Note that the text is not simply rotated! I know it could be achieved by boxing each character separately, measuring the height and then raising by the missing amount to reach e.g. 1em... But I'm sure there is a better way around.

I'd like a macro that works for a whole line for instance (a whole paragraph would be even better! :) ).

Edit: Ascenders should protrude (as descenders) unless they have some special feature, like 'striketrough' in a 't'. Capitals should not protrude.

  • Interesting question! Is this just for the novelty value, or do you have an actual application for this? – Jake Sep 19 '11 at 1:23
  • Something seems to be not quite right with your example picture: The ascender portion of the d becomes a descender after the rotation, but the t doesn't behave the same way (it should also protrude below the new baseline). How do you want the letters to behave? Should capitals protrude below the baseline? Should ascenders? – Jake Sep 19 '11 at 1:38
  • 1
    @Jake: This is an actual setting for Facebook's display text and I was curious how this would look like done in LaTeX. :) I think the guys from Facebook just wanted to turn the text upside-down, but there might be some bug in the way it finally is rotated. – Count Zero Sep 19 '11 at 1:53
  • 2
    For me the turned t does descend in Facebook. Probably depends on the font. – Caramdir Sep 19 '11 at 4:10
  • I don't see any way to solve this without scanning the input character by character and doing the rotation (and shifting in some cases). Probably easy in LuaTeX. :) – egreg Sep 19 '11 at 12:50

Thanks for all the answers! After doing some research myself and digging up some packages I never had used before, I also belive the input needs to be scanned charcter by character, as suggested by @egreg.

So here is a way of doing it in LaTeX:



This is what I want to get.

\rotraise{This is what I want to get.}

Below you can admire the result. :)

enter image description here

| improve this answer | |
  • Nice answer; I've taken the liberty of modifying it in order not to declare two new counters at each macro call. – egreg Sep 19 '11 at 14:04
  • @egreg: Thanks for your addition, much appreciated! – Count Zero Sep 19 '11 at 14:10

Here are a couple of possibilities, using the facilities of the graphicx package:




Upside down\\
\rotatebox{180}{Upside down} Upside down \\
\rotatebox{180}{\reflectbox{Upside down}} Upside down and mirrored \\
\raisebox{\depth}{\rotatebox{180}{Upside down}} Upside down and raised to fit in line


Or you could possibly vary the {\depth} with a number.. say 0.5em to align the text with other non-rotated texts

output of example code

| improve this answer | |

Facebook doesn't actually turn the letters around, it just (ab)uses various characters Unicode provides (e.g. IPA characters). With XeLaTeX or LuaLaTeX and a suitable font, you can do the same:

uʍop əpısdՈ

(Compile with xelatex or lualatex.)

The actual characters used here are:

u   latin small letter u
ʍ   latin small letter turned w
o   latin small letter o
p   latin small letter p
ə   latin small letter schwa
ı   latin small letter dotless i
s   latin small letter s
d   latin small letter d
Ո   armenian capital letter vo

The quality of the output is of course disputable.

| improve this answer | |
  • Is there no way to do it in plain LaTeX? – Count Zero Sep 19 '11 at 9:26
  • This is plain LaTeX, just rendered using XeLaTeX or LuaLaTeX. – ℝaphink Sep 19 '11 at 15:51

I was a bit surprised to learn that this isn't catered for in TikZ's text decorations. However, a judicious insertion of a \rotatebox in to the code at the correct point (I hope) led to:

upside down text

The code for that would be:



\useasboundingbox (-1,1) -- (5,-1);
\path[decorate,decoration={transformed text along path,text={upside down}, text rotation=180}] (0,0) -- (5,0);

if there was a PGF library pgflibrarydecorations.transformedtext.code.tex. The actual code for that is an extremely minor modification of pgflibrarydecorations.text.code.tex, but in order to make it an actual library it would need a little stress testing. For example, rotating the text only 90 degrees results in:

rotated text

which is missing the space (maybe the box containing a space has width but not height?), and could do with a little more separation between the characters.

Incidentally, although this looks neat, it is working in exactly the manner said: walking along the text, measuring each character, and typsetting it in the correct place. It's just that this code (almost) already exists, and can be used to do:

The Mouse's Tale

which, I'm sure, is what Lewis Carroll would have written had he known about TeX and TikZ.

| improve this answer | |
  • 8
    If you can also progressively reduce the font size it would be better. – egreg Sep 20 '11 at 11:21
  • @Andrew Stacey: How can you work out the "walking along the text"? What TeX did you set up? – NasuSama Sep 5 '13 at 1:03
  • @NasuSama I'm afraid I don't understand the question. As I said in my answer, this involves a small modification of one of the TikZ libraries. The "walking along the text" is done by the text decorations library, the modification is to allow for a transformation of said text. – Andrew Stacey Sep 5 '13 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.