There might be a confusion here relating to PSTricks habits.
First of all, \coordinate (P) (0,0);
defines a coordinate at the origin with the name (P)
. This name is related to origin now. Then you add
\draw[rotate around={45:(P)}] (P) node {hello} ;
This command first does this bit;
\draw (P) node {hello} ;
which says that go to point (P)
, which is the origin now from the previous command, and put a node there with text hello
. Then, the option kicks in and says that you should also rotate this path, which is going to origin and putting a node, 45 degrees. But since the path is actually not moved, as we are still at the origin, no rotation is created. If you want to rotate the node then it should be supplied to the node options and not to the path options, hence
\begin{tikzpicture}
\coordinate (P) at (0,0);
\draw (P) node[rotate=45] (N) {hello}; % The node has the name N now!
\end{tikzpicture}
is the command that you have to enter. But since you are trying to put a node and not to draw anything you can directly use
\begin{tikzpicture}
\coordinate (P) at (0,0);
\node[rotate=45] (N) at (P) {hello}; % The node has the name N now and located at (P)
\end{tikzpicture}
you can clip the half of it and then force it to draw it again double the line width. The scope limits the clipping effect.
\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}
\begin{scope}
\clip[postaction={fill=white, draw=yellow, line width=6mm}] (0,0) rectangle +(2,2);
\end{scope}
\draw (0,0) rectangle (2,2);
\end{tikzpicture}
\end{document}
or using Mark Wibrow's further shortcut makes it a one-liner
\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[preaction={clip,postaction={fill=white, draw=yellow, line width=6mm}}]
(0,0) rectangle +(2,2);
\end{tikzpicture}
\end{document}
Best Answer
This can be easily done with
tcolorbox
, but also with aTiKZ
filled with a pattern and a centered label to whiten the text background. Here you have both solutions: