2

Say that I want to use the "pants" shape in a diagram, like so

my diagram

The TikZ code generated is

\begin{tikzpicture}
    \begin{pgfonlayer}{nodelayer}
        \node [style=pants] (0) at (0, 0) {};
        \node [style=none] (1) at (1, -1) {};
        \node [style=none] (2) at (-1, -1) {};
        \node [style=none] (3) at (0, 1) {};
    \end{pgfonlayer}
    \begin{pgfonlayer}{edgelayer}
        \draw [bend right, looseness=4.75] (2.center) to (0);
        \draw [bend right, looseness=0.75] (1.center) to (0);
        \draw (3.center) to (0);
    \end{pgfonlayer}
\end{tikzpicture}

Where my pants node is simply invocated with style=pants. This isn't going to fly, so I need to have this style in the preamble of my document. TikZiT provides a preamble, but when I click Insert node styles to selected preamble, no declaration of the pants style appears.

There is, however, a generated definition of the pants style as a tikzpicture:

\begin{tikzpicture}
    \path [use as bounding box] (-2,-2) rectangle (2,2);
    \begin{pgfonlayer}{nodelayer}
        \node [style=none] (0) at (-0.5, 1) {};
        \node [style=none] (1) at (0.5, 1) {};
        \node [style=none] (2) at (-1.5, -1) {};
        \node [style=none] (3) at (-0.5, -1) {};
        \node [style=none] (4) at (0.5, -1) {};
        \node [style=none] (5) at (1.5, -1) {};
    \end{pgfonlayer}
    \begin{pgfonlayer}{edgelayer}
        \draw [in=90, out=90, looseness=1.75] (4.center) to (3.center);
        \draw [in=-90, out=90, looseness=0.75] (2.center) to (0.center);
        \draw [in=-90, out=-90, looseness=0.75] (0.center) to (1.center);
        \draw [in=90, out=-90, looseness=0.75] (1.center) to (5.center);
        \draw [in=90, out=90, looseness=0.75] (5.center) to (4.center);
        \draw [in=90, out=90, looseness=0.75] (3.center) to (2.center);
    \end{pgfonlayer}
\end{tikzpicture}

What I would want, ideally, is that TikZiT itself would insert the correct definitions into my preamble. But this doesn't seem to happen. Can I still use the code available to get this diagram working?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.