I'm making a beamer template for the laboratory I work on. Since I couldn't find an SVG or PDF version of the logo I decided to draw it with tikz (I drew over the original PNG that's why the code is very fixed). I thought that maybe it would be a nice idea to have the template define a pic
with the logo for future use, so I tried just copy/paste the picture code to a pic
but the part which makes use of transform canvas
is not being drawn even though I'm using explicit bounding box...
MWE
\documentclass[tikz]{standalone}
\usetikzlibrary{calc}
\tikzset{%
pics/polo/.style={%
code={%
\useasboundingbox (-108.12047pt,-54.0623pt) rectangle (108.12047pt,54.0623pt);
\begin{scope}[even odd rule,xslant=0.6]
\fill (-1.5mm-81.65935pt,11mm-45.16873pt) coordinate (P) -- ++(20pt,0) -- ++(0,13pt) coordinate (tmp) -- ++(20pt,0) to[out=5,in=0, looseness=2.6] ++(0,20pt) -| cycle
(tmp) ++(1pt,6pt) -- ++(6pt,0) to[out=5,in=0, looseness=4] ++(1pt,7.75pt) -| cycle;
\fill[looseness=3.4] (P) ++(29.5mm,0) coordinate (Po) to[out=3, in=0] ++(-2pt,22pt) to[out=185, in=180] cycle [looseness=2.5] (Po) ++(-.5pt,5pt) to[out=3, in=0] ++(0pt,12pt) to[out=185, in=180] cycle;
\fill (P) ++(39.25mm,0) coordinate (Pol) -- ++(32pt,0) -- ++(0,6pt) -- ++(-19pt,0) -- ++(0pt,15pt) -| cycle;
\fill[looseness=3.4] (P) ++(59.5mm,0mm) coordinate (Polo) to[out=3, in=0] ++(-2pt,22pt) to[out=185, in=180] cycle [looseness=2.5] (Polo) ++(-.5pt,5pt) to[out=3, in=0] ++(0pt,12pt) to[out=185, in=180] cycle;
\end{scope}
\fill (P) ++(-4.5mm,9mm) coordinate (vertex) to[out=50, in=180, looseness=0.75] ++(38mm,10.75mm) coordinate (top) -- ++(-115:11.5pt) to[out=180, in=30, looseness=0.95] cycle;
\fill[#1] (top) ++(4pt,0) coordinate (a) ++(-115:11.5pt) coordinate (b) (a) to[out=0,in=175] ++(27pt,-1.5pt) -- ++(-115:11.5pt) to[out=175, in=0] (b) -- cycle;
\path (vertex) -- coordinate (rot) ++(75.25mm,11.75mm-20mm);
\begin{scope}[transform canvas={rotate around={-180:(rot)}}]
\fill (P) ++(-4.5mm,9mm) to[out=50, in=180, looseness=0.75] ++(38mm,10.75mm) coordinate (tmp) -- ++(-115:11.5pt) to[out=180, in=30, looseness=0.95] cycle;
\fill[#1] (tmp) ++(4pt,0) coordinate (a) ++(-115:11.5pt) coordinate (b) (a) to[out=0,in=175] ++(27pt,-1.5pt) -- ++(-115:11.5pt) to[out=175, in=0] (b) -- cycle;
\end{scope}
}}}
\begin{document}
\begin{tikzpicture}
\pic[blue]{polo=orange};
\begin{scope}[yshift=4cm,blue]
\useasboundingbox (-108.12047pt,-54.0623pt) rectangle (108.12047pt,54.0623pt);
\begin{scope}[even odd rule,xslant=0.6]
\fill (-1.5mm-81.65935pt,11mm-45.16873pt) coordinate (P) -- ++(20pt,0) -- ++(0,13pt) coordinate (tmp) -- ++(20pt,0) to[out=5,in=0, looseness=2.6] ++(0,20pt) -| cycle
(tmp) ++(1pt,6pt) -- ++(6pt,0) to[out=5,in=0, looseness=4] ++(1pt,7.75pt) -| cycle;
\fill[looseness=3.4] (P) ++(29.5mm,0) coordinate (Po) to[out=3, in=0] ++(-2pt,22pt) to[out=185, in=180] cycle [looseness=2.5] (Po) ++(-.5pt,5pt) to[out=3, in=0] ++(0pt,12pt) to[out=185, in=180] cycle;
\fill (P) ++(39.25mm,0) coordinate (Pol) -- ++(32pt,0) -- ++(0,6pt) -- ++(-19pt,0) -- ++(0pt,15pt) -| cycle;
\fill[looseness=3.4] (P) ++(59.5mm,0mm) coordinate (Polo) to[out=3, in=0] ++(-2pt,22pt) to[out=185, in=180] cycle [looseness=2.5] (Polo) ++(-.5pt,5pt) to[out=3, in=0] ++(0pt,12pt) to[out=185, in=180] cycle;
\end{scope}
\fill (P) ++(-4.5mm,9mm) coordinate (vertex) to[out=50, in=180, looseness=0.75] ++(38mm,10.75mm) coordinate (top) -- ++(-115:11.5pt) to[out=180, in=30, looseness=0.95] cycle;
\fill[orange] (top) ++(4pt,0) coordinate (a) ++(-115:11.5pt) coordinate (b) (a) to[out=0,in=175] ++(27pt,-1.5pt) -- ++(-115:11.5pt) to[out=175, in=0] (b) -- cycle;
\path (vertex) -- coordinate (rot) ++(75.25mm,11.75mm-20mm);
\begin{scope}[transform canvas={rotate around={-180:(rot)}}]
\fill (P) ++(-4.5mm,9mm) to[out=50, in=180, looseness=0.75] ++(38mm,10.75mm) coordinate (tmp) -- ++(-115:11.5pt) to[out=180, in=30, looseness=0.95] cycle;
\fill[orange] (tmp) ++(4pt,0) coordinate (a) ++(-115:11.5pt) coordinate (b) (a) to[out=0,in=175] ++(27pt,-1.5pt) -- ++(-115:11.5pt) to[out=175, in=0] (b) -- cycle;
\end{scope}
\end{scope}
\end{tikzpicture}
\end{document}
The first logo uses the pic
code
directly and the second uses \pic
command. As it can be seen, the bottom part of the logo is missing, but the bounding box is actually there.
pic
picks up the earlier transformations and rotates it beyond the page border. Check for small values of rotation angles like -2, -5, -10 – percusse Dec 20 '16 at 19:40transform canvas
+rotate around
, too bad. I will usexscale
andyscale
andtransform canvas
+shift
ing. Just need to find the values, again... If you convert your comment to an answer I'll gladly upvote and accept it (and please state that it's not a bug) :) – Guilherme Zanotelli Dec 20 '16 at 20:04rotate around
, just pass it like([rotate around={180:(rot)}]P)
and use ``scale=-1`. No need to specify the bounding box then. Perfect... – Guilherme Zanotelli Dec 20 '16 at 20:19