33

How do I pass two parameters to a tikz style? I would like to do something like this:

\begin{tikzpicture}[
    transformer/.style={draw, cylinder, gray!80, rotate=90, minimum height=#1, minimum width=#2},

And then, I want to use this style in a node:

\node [transformer{2.3cm}{1cm}] () at (0,0.6) {};
Neil G
  • 17,947

1 Answers1

39
\documentclass{article}
\usepackage{tikz} 
\usetikzlibrary{shapes}  
\begin{document}
 \thispagestyle{empty} 

 \begin{tikzpicture}[
    transformer/.style 2 args={draw, cylinder, gray!80, rotate=90, minimum height=#1, minimum width=#2}]

\node [transformer={2.3cm}{1cm}] () at (0,0.6) {};
\end{tikzpicture}  
\end{document} 
Alain Matthes
  • 95,075