
Acabei de atualizar do fedora versão 32 para a versão 33. O Tikz foi atualizado (de 3.1.4b para 3.1.5b). Desde essa mudança, esta figura não é mais compilada (eu uso Lualatex):
\documentclass{minimal}
\usepackage[french]{babel}
\usepackage{xcolor}
\definecolor{RdBu-9-1}{RGB}{178,24,43}
\definecolor{RdBu-9-2}{RGB}{214,96,77}
\definecolor{RdBu-9-8}{RGB}{67,147,195}
\definecolor{RdBu-9-9}{RGB}{33,102,172}
\usepackage{tikz}
\usetikzlibrary{patterns}
\usetikzlibrary{fadings}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows}
\usetikzlibrary{matrix}
\usetikzlibrary{decorations.pathreplacing}
\tikzset{%
ffa/.style={%
pattern=north west lines,
pattern color=RdBu-9-2,
draw=none
},
ffc/.style={%
draw=RdBu-9-1,
line width=1}
}
\usepackage[babel, autostyle]{csquotes}
\begin{document}
\begin{tikzpicture}
\matrix [matrix of nodes,
anchor=west,
nodes={minimum size=.75cm}
] (zla0) at (0,0)
{
\draw[ffa,ffc] (0,0) circle (.3cm);&
\draw[ffa,ffc] (0,0) circle (.3cm);\\
};
\matrix [matrix of nodes,
anchor=north,
nodes={minimum size=.75cm},
below=2cm of zla0] (zlb0)
{
\draw[ffa,ffc] (0,0) circle (.3cm);\\
};
\foreach \m in {0} {
\draw (zla\m.south west) |- ($(zla\m.south west)!0.5!(zla\m.south
east) + (0,-.1)$) -| (zla\m.south east) node[pos=0, yshift=.2]
(zla\m-g) {};
%
\draw (zlb\m.north west) |- ($(zlb\m.north west)!0.5!(zlb\m.north
east) + (0,.1)$) -| (zlb\m.north east) node[pos=0, yshift=.2]
(zlb\m-g) {};
%
\draw[->>, black,] ([yshift=-.2cm]zla\m.south) -- ([yshift=.2cm]zlb\m.north);
}
\draw[|-, black] ([yshift=1.25cm]zla0-1-2.north) -- (zla0-1-2.north)
node[pos=.6,fill=white, minimum size=.75cm]{};
\node[above=0cm of zla0-1-1.north, anchor=south, align=center,
font=\tiny, text width=1.75cm]{\enquote{Je suis proche du \emph{Pic
Jean Ray}}};
\node[above=1.25cm of zla0-1-2.north, anchor=south, align=center,
font=\tiny, text width=1.75cm]{\enquote{Je suis sous une \emph{crête}}};
\node[below=0cm of zlb0.south, anchor=north, align=center,
font=\tiny, text width=4cm]{\enquote{Je suis proche du \emph{Pic
Jean Ray} et sous une crête}};
\node[fill=white,align=center, font=\large\sffamily] at ($(zla0.south east)!0.5!(zlb0.north
west)$){\emph{Fusion} des \emph{indices de localisation}};
\end{tikzpicture}
\end{document}
Na compilação, recebo erros como:
ERROR: Package pgf Error: No shape named `zla0-1-2' is known.
Pesquisando no repositório tikz identifiquei o problema: as células de a matrix of nodes
que contém uma \path
derivada (like \draw
) são tratadas diretamente e não adicionadas a a node
(fonte). Mas não descobri porque esse código, que funcionava no ferora 32, não funciona mais (não encontrei nenhuma informação no tikzregistro de alteraçõesou qualquer outra coisa).
Qual é a melhor solução para fazer esse número funcionar novamente? Sabendo que tenho diversas figuras que são construídas nesse esquema (esta é a mais simples, por exemplo) e que tenho pouco tempo para fazer essas modificações.
O melhor seria se houvesse a opção de mudar para a forma antiga de trabalhar, mas não encontrei nada semelhante na documentação.
Ps: eu fiz a mesma pergunta em francêsaqui, se eu tiver uma resposta aí eu postaria aqui e vice-versa.
Responder1
As células nas matrizes TikZ que não são apenas um nó não têm nome. (Mesmo os nós colocados em células matrix of nodes
with \node
não têm um nome, a menos que você forneça um.)
Além de usar nós reais como esse
\matrix [
matrix of nodes,
anchor=west,
nodes in empty cells,
nodes={ffa, ffc, circle, minimum size=.6cm}
] (zla0) at (0,0) { & \\};
o que colocaria o mesmo círculo na célula que você \draw
pode deixar o TikZ instalar um nó retangular estreito ao redor da caixa delimitadora de cada célula. Você ainda não conseguirá fazer referência aos elementos reais dentro da célula, é claro. (A menos que sejam nós e você dê nomes a eles.)
A install fitted node at end cell
chave instalará o necessário \node
no final de cada célula. A \path[every node/.code]
parte garante que não herdaremos nenhum estilo da every node
chave. Esses nós são nomeados <matrix name>-<row>-<column>'
(observe o '
) para que não haja conflito com os nós reais em um matrix of node
.
Também tentei fornecer um current bounding box
alias ou instalar um local bounding box
para cada célula, mas tudo isso precisa de mais trabalho porque os nós reais (que serão usados mais tarde) precisam ser instalados em um gancho de matriz especial para que sua posição seja conhecida após a matriz - e mesmo assim a largura da linha não foi considerada.
Código
\documentclass[tikz]{standalone}
\usepackage[french]{babel}
\definecolor{RdBu-9-1}{RGB}{178,24,43}
\definecolor{RdBu-9-2}{RGB}{214,96,77}
\definecolor{RdBu-9-8}{RGB}{67,147,195}
\definecolor{RdBu-9-9}{RGB}{33,102,172}
\usetikzlibrary{patterns, calc, positioning, arrows, matrix, fit}
\tikzset{% This is the new key.
install fitted node at end cell/.style={
execute at end cell={%
\path[every node/.code=] node[shape=rectangle, fit=(current bounding box),
inner sep=+0pt, minimum size=+0pt, outer sep=+0pt, name=\tikzmatrixname-%
\the\pgfmatrixcurrentrow-\the\pgfmatrixcurrentcolumn']{};}}}
\tikzset{
ffa/.style={pattern=north west lines, pattern color=RdBu-9-2, draw=none},
ffc/.style={draw=RdBu-9-1, line width=1}}
\usepackage[babel, autostyle]{csquotes}
\begin{document}
\begin{tikzpicture}[radius=.3cm]
\matrix [
install fitted node at end cell, % ← Here's the new key used.
anchor=west] (zla0) at (0,0) {
\draw[ffa,ffc] (0,0) circle []; &
\draw[ffa,ffc] (0,0) circle []; \\};
\matrix [below=2cm of zla0] (zlb0) {\draw[ffa,ffc] (0,0) circle [];\\};
\foreach \m in {0} {
\draw (zla\m.south west)
|- ($(zla\m.south west)!0.5!(zla\m.south east) + (0,-.1)$)
-| (zla\m.south east) node[pos=0, yshift=.2] (zla\m-g) {};
\draw (zlb\m.north west)
|- ($(zlb\m.north west)!0.5!(zlb\m.north east) + (0,.1)$)
-| (zlb\m.north east) node[pos=0, yshift=.2] (zlb\m-g) {};
\draw[->>, black,] ([yshift=-.2cm]zla\m.south) -- ([yshift=.2cm]zlb\m.north);
}
\draw[|-, black] ([yshift=1.25cm]zla0-1-2'.north) -- (zla0-1-2')
node[pos=.6,fill=white, minimum size=.75cm]{};
\node[above=0cm of zla0-1-1'.north, anchor=south, align=center, font=\tiny,
text width=1.75cm]{\enquote{Je suis proche du \emph{Pic Jean Ray}}};
\node[above=1.25cm of zla0-1-2'.north, anchor=south, align=center, font=\tiny,
text width=1.75cm]{\enquote{Je suis sous une \emph{crête}}};
\node[below=0cm of zlb0.south, anchor=north, align=center, font=\tiny,
text width=4cm]{
\enquote{Je suis proche du \emph{Pic Jean Ray} et sous une crête}};
\node[fill=white, align=center, font=\large\sffamily]
at ($(zla0.south east)!0.5!(zlb0.north west)$)
{\emph{Fusion} des \emph{indices de localisation}};
\end{tikzpicture}
\end{document}