I usually write macros when I need to draw many times a kind of figure. In the final document, I call the macro and then I always apply two transformations : a scale transformation to fit in the space I've left, and a rotation so that my students are not facing exactly the same situation. Unfortunately, labels won't be well positioned after a rotation.
Here is what I get using the anchor below left
and midway,below
after different rotations.
Here is what I would like to have.
Here is what I would like to avoid if I'm scaling the draw.
Here is the code I'm using to try to solve my problem:
\documentclass[margin=.5cm]{standalone}
\usepackage{tikz}
\newcommand{\myDraw}[2]{% \myDraw{rotation angle}{scale factor}
\begin{minipage}[t]{2.5cm}
\centering \footnotesize $\theta=#1^{\circ}$, $k=#2$ \medskip\\
\begin{tikzpicture}[rotate=#1,scale=#2]
\draw (0,1) -- (0,0) node[below left] {$O$} -- (1,0) node[midway,below] {$1$};
\end{tikzpicture}
\end{minipage}}
\begin{document}
\myDraw{0}{0.5}
\myDraw{45}{0.7}
\myDraw{90}{1}
\myDraw{135}{1.3}
\myDraw{180}{1.5}
\end{document}
I thought of manually positioning my label, but then the distance between the label and the point would be affected by a scale transformation and I lose the ability of using convenient keywords like midway
and pos=
.
I could also use the key transform shape
as a node
option, but then the text would be rotated and scaled.
If you think my question doesn't reflect my issue, you are very welcome to edit it (I had a hard time to figure out how to explain my problem).
scale
butx=2cm, y=2cm
you can use thetransform shape
option on theO
node. — What would be a “pleasant position”?