# Tikz /.style with two parameters

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) {};

• Use style 2 args, see page 493 of the manual (sorry, I'm currently to lazy to write and test a complete answer). Jun 22, 2011 at 19:02
• @Caramdir: Thanks for the link. Much appreciated — absolutely no need to apologize. Jun 22, 2011 at 19:04
• I think you have to use something like [transformer={2.3cm}{1cm}] Jun 22, 2011 at 19:04

\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}

• Indeed, there is also .style n args={<number of args>}{<style>} for more arguments and .style args={<parameter text>}{<style>} which allows to define the arguments using a parameter text like \def does. Jun 22, 2011 at 21:04
• how can I achieve this with using \tikzstyle ? Feb 25, 2016 at 16:59
• You can't, I think Aug 15, 2016 at 19:30
• Where is this documented? I tried 1 args and 1 arg and arg and it doesn't seem to work. Aug 20, 2021 at 22:14