32

I'd like to rotate a letter such as, say B, to show its reflection or inversion symmetry, or even at an arbitrary angle clockwise or counter-clockwise. Is this possible using commands without drawing a picture? Can I use \usepackage{rotating} out of a table? I used the code \begin{rotate}{180}B\end{rotate}. That puts B rotated as a subscript to the line. Any idea how to make it in-line aligned with other charcters?

1
  • 1
    Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count. This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). The same applies to your question tex.stackexchange.com/questions/30925/….
    – doncherry
    Commented Oct 22, 2011 at 12:47

3 Answers 3

43

With the graphicx package, you can do it as follows: \rotatebox[origin=c]{180}{B}

This rotates around the center of the letter. You can also rotate around other points: \rotatebox[origin=tr]{180}{B} will rotate around the top right of the box. See page 8 of this document for all the relevant options.

Following from what egreg pointed out, you may need a \raisebox to have the resulting this sit on the baseline:

\documentclass{scrartcl}
\usepackage{graphicx}
\newcommand\testletter[1]{
  \begin{tabular}{rl}
    Rotate: & #1\rotatebox{180}{#1}\hspace{-1em}\rule{1em}{0.5pt}\\
    Rotate and raise: & #1\raisebox{\depth}{\rotatebox{180}{#1}}\hspace{-1em}\rule{1em}{0.5pt} \\
    Rotate around centre: & #1\rotatebox[origin=c]{180}{#1}\hspace{-1em}\rule{1em}{0.5pt} \\
    Rotate around centre and raise: & #1\raisebox{\depth}{\rotatebox[origin=c]{180}{#1}}\hspace{-1em}\rule{1em}{0.5pt} \\
    Rotate (120): & #1\rotatebox{120}{#1}\hspace{-1em}\rule{1em}{0.5pt} \\
    Rotate (120) around centre: & #1\rotatebox[origin=c]{120}{#1}\hspace{-1em}\rule{1em}{0.5pt} \\
    Rotate (120) and raise: & #1\raisebox{\depth}{\rotatebox{120}{#1}}\hspace{-1em}\rule{1em}{0.5pt} \\
    Rotate (120) around centre and raise: & #1\raisebox{\depth}{\rotatebox[origin=c]{120}{#1}}\hspace{-1em}\rule{1em}{0.5pt}
  \end{tabular}
}
\begin{document}
\testletter{B}

\testletter{g}

\testletter{f}
\end{document}

The rule is just to show where the baseline is.

differences again

As you can see, the raisebox only makes a difference for letters with descenders (g,y,j etc). And which one you prefer is a matter of taste. (Also, doing both rotate about centre and raise seems otiose. Doing one or the other suffices, depending on which result you want...

15

If you need also a reflection, use \reflectbox{B}; you might need also \raisebox when rotating the letter with \rotatebox, for example

\raisebox{\depth}{\rotatebox[origin=c]{120}{B}}

will make the rotated "B" sit on the baseline. There are differences between the three calls

B\rotatebox{120}{B}B
B\rotatebox[origin=c]{120}{B}B
B\raisebox{\depth}{\rotatebox[origin=c]{120}{B}}B

Choose the one that suits you better. The \depth can be multiplied by a factor; you can use also \height and \totalheight as is customary for LaTeX boxes.

5
  • 3
    There is also \reflectbox{...} which is short for \scalebox{-1}[1]{...}. Commented May 13, 2011 at 14:33
  • Your raisebox does nothing. However, using your raisebox and not specifying an origin gives you identical output to my answer
    – Seamus
    Commented May 13, 2011 at 14:45
  • I take it back, there is a slight difference for letters with descenders. It's not obvious with capitals...
    – Seamus
    Commented May 13, 2011 at 14:48
  • Rotating around centre inside a raisebox seems to be exactly the same as rotating inside a raisebox without specifying an origin...
    – Seamus
    Commented May 13, 2011 at 15:10
  • 1
    Martin, I appreciate if in citing code always mentioning the related usepackage for clarity. I found the linked Warwick document helpful. Thank you. Commented May 15, 2011 at 7:13
7

with package rotating or graphicx

B\rotatebox[origin=c]{180}{B}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .