I would like to rotate an element inside of a picture
environment about a specified point. I tried using \rotatebox{}
for this. This webpage describes what \rotatebox{}
does:
- Rotate the element about the start-of-baseline (
graphics
) or specified point (grahpicx
). - Translate the element horizontally so that the left edge of the new bounding box coincides with the left edge of the bounding box before rotation.
It is the second step that is causing trouble, as I only want to rotate the element, not translate it horizontally afterwards. Consider the following example:
\documentclass{article}
\usepackage{xcolor}
\usepackage{graphicx}
\begin{document}
\setlength{\unitlength}{1cm}
\begin{picture}(3,3)
\put(1,1){{\color{red}\circle*{0.1}}}
\put(1,1){\parbox[t]{2cm}{\raggedright{text that is wrapped}}}
\put(2,2){{\color{blue}\circle*{0.1}}}
\put(2,2){\rotatebox[origin=lB]{60}{\parbox[t]{2cm}{text that is wrapped and rotated}}}
\end{picture}
\end{document}
It can be seen that the blue dot is no longer aligned with the start-of-baseline position of the rotated text. This is due to the translation in step #2 (which results in the element being shifted to the right). How can I rotate the element so that the start-of-baseline (or the specified point of rotation more generally) does not move?
EDIT: I would like to be able to specify the point of rotation to be any point, not just the start-of-baseline position. The graphicx
version of \rotatebox{}
allows this:
\rotatebox[x=TeX dimension,y=TeX dimension]{...}
Best Answer
In response to the edit, here is another option that might work. It is
\rotbox[pole1,pole2]<x-offset,y-offset>{angle}{content}
Where the content is rotated and placed at the specified offset from the point of intersection of
pole1
andpole2
. See p.2 of the xcoffins documentation for a list of predefined poles (and coffins in general, I've just made a wrapper for pre-existing functionality). Both poles and offsets are optional and have defaults (which you can change) left edge and baseline of typeset material for the poles, and zeros for the offsets. This is my first crack at coffins so I've likely muddled something somewhere.(Old answer) I think that this might be what you're after: