在以下示例中,如何在不影响其他属性的情况下重新定义环境block
中预定义样式的一个属性:tikzpicture
\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}
答案1
您可以使用处理程序.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}