From 52ecf8c9796dad87ee9ad261da67119ae0f4e127 Mon Sep 17 00:00:00 2001 From: muzimuzhi Date: Sat, 23 Sep 2023 00:18:49 +0800 Subject: [PATCH] docs: simplify the stripe-pattern matrix example Signed-off-by: muzimuzhi --- .../pgf/pgfmanual-en-tikz-matrices.tex | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/doc/generic/pgf/pgfmanual-en-tikz-matrices.tex b/doc/generic/pgf/pgfmanual-en-tikz-matrices.tex index f46ad79b7..4391792ec 100644 --- a/doc/generic/pgf/pgfmanual-en-tikz-matrices.tex +++ b/doc/generic/pgf/pgfmanual-en-tikz-matrices.tex @@ -486,24 +486,28 @@ \subsubsection{Cell Styles and Options} \begin{codeexample}[preamble={\usetikzlibrary{matrix,fit}}] \begin{tikzpicture}[ font=\sffamily, - striped col/.style={column #1/.append style={ - every even row/.style={nodes={fill=olive!50}}}}, - head color/.style args={#1/#2}{column #1/.append style={ - row 1/.append style={nodes={fill=#2}}}} + head color/.style args={#1/#2}{ + row 1 column #1/.append style={nodes={fill=#2}}}, + % swap order of row and column styles + matrix/inner style order={ + every cell, + row, even odd row, + column, even odd column, + cell + } ] \matrix [ matrix of nodes, nodes in empty cells, nodes={text width=2cm, align=center, minimum height=1.5em, anchor=center}, - striped col/.list={1,...,5}, % add striped col style to all cols - column 1/.style={ % Override stripes and modify the feature column - row 1 column 1/.style={nodes={fill=none, draw=none}}, - nodes={fill=olive, inner ysep=0}, - }, - % modify headers first via common styles and then specific colors - row 1/.style={nodes={text depth=0.2ex, text width=2cm, text=white}}, - head color/.list={2/orange,3/teal,4/cyan,5/magenta} + % add striped row style + every even row/.style={nodes={fill=olive!50}}, + % modify the feature column and header row + column 1/.style= {nodes={fill=olive, inner ysep=0}}, + row 1/.style= {nodes={text depth=0.2ex, text=white}}, + row 1 column 1/.style={nodes={fill=none, draw=none}}, + head color/.list={2/orange,3/teal,4/cyan,5/magenta} % specify header colors ] (m) { & Basic & Standard & Professional & Enterprise \\ @@ -515,7 +519,7 @@ \subsubsection{Cell Styles and Options} }; % Add emphasis on selection by the use of "fit" library \node[fit={(m-1-4.north west) (m-6-4.south east)}, - ultra thick, inner sep=0, rounded corners=1mm, + ultra thick, inner sep=0pt, rounded corners=1mm, draw=cyan, label={[cyan,align=center]270:Popular\\Choice!}]{}; \end{tikzpicture} \end{codeexample}