2

In the following example, how can I redefine one property of the predefined block style in the tikzpicture environment without affecting the others:

\documentclass{article}
    \usepackage{pgfplots}
        \pgfplotsset{compat=1.12}
        \tikzstyle{block} = [rectangle, draw,minimum width=3em,]
\begin{document}
 \begin{tikzpicture} % This works ok
   \node[block, minimum width=3em,] (b1) {B1};
  \end{tikzpicture}
 \begin{tikzpicture}[block/.style={minimum width=3em,}] % This reset all styles
   \node[block] (b1) {B1};
  \end{tikzpicture}
\end{document}

enter image description here

jak123
  • 4,252
  • 5
  • 26
  • 49

1 Answers1

3

You can use the handler .append style:

\documentclass{article}
    \usepackage{pgfplots}
        \pgfplotsset{compat=1.12}
        \tikzstyle{block} = [rectangle, draw,minimum width=3em,]
\begin{document}
 \begin{tikzpicture} % This works ok
   \node[block, minimum width=3em,] (b1) {B1};
  \end{tikzpicture}
 \begin{tikzpicture}[block/.append style={minimum width=10em,}] %
   \node[block] (b1) {B1};
  \end{tikzpicture}
\end{document}

enter image description here

Ulrike Fischer
  • 327,261