Placer manuellement les cellules dans tikzcd

Aug 22 2020

J'ai essayé de faire fonctionner le déplacement manuel des cellules dans un diagramme tikz-cd dans mon cas, mais je rencontre des problèmes lorsque mon diagramme devient trop grand.

Mon diagramme souhaité est quelque chose comme

\documentclass[a41empaperpt]{article}
\usepackage{tikz-cd}
\usepackage{amsmath}
\usepackage{tikz}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
            \node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
\begin{document}
\begin{equation}
    \begin{tikzcd}
    & S(F) \arrow[ddddl, "\operatorname{id}"']\arrow[dd, "\operatorname{pr}^*"] \arrow{rr} & &  F \arrow[dd, "\operatorname{pr}^*"]\rar{R} & Z(F) \arrow[ddddddl, bend left = 75, dotted, "\beta"]\arrow[dd, "\operatorname{pr}^*"] \\
    & & \circled{2} & & \\
    & IS(F) \arrow[ddl, "\partial_0^*", "\simeq"' ] \arrow[dddd, bend left = 90, "0", "\circled{3}"'] \arrow[dd, "\operatorname{id}"]\arrow[rr] & & I(F) \arrow[dddd, bend left = 30, "\partial_1^*-\partial_0^*"] \rar{R} & IZ(F) \arrow[ddddl, bend left = 45, dotted, "\alpha"]\\
    \\
    S(F) \arrow[ddr,  "0"']\arrow[r, "\operatorname{pr}^*", "\simeq"'] &[-10pt] IS(F) \arrow[dd, "\operatorname{\partial_1^*-\partial_0^*}"] &  & \circled{1} \\
    \\
    & S(F)\arrow[rr]  & & F
    \end{tikzcd}
\end{equation}
\end{document}

Mais la flèche courbée passe à travers \circled{3}, que je voudrais déplacer manuellement vers la gauche pour éviter une collision avec la flèche. EDIT: Maintenant, la flèche courbée ne heurte pas, mais \circled{3}est plus petite que les autres.

En utilisant la question liée, je peux faire quelque chose comme

\begin{equation}
\begin{tikzcd}
    & IS(F) \arrow[rrr] \arrow[d, "\operatorname{id}"]\arrow[dd, bend left = 75, "0"]&[-30pt] & & I(F)\\
    S(F) & IS(F) \arrow[d, "\partial_1^*-\partial_0^*"]&\circled{3}& \circled{1}& \\
    & S(F) &&& F \\
    \end{tikzcd} 
\end{equtation}

Ce qui semble fonctionner, sauf lorsque j'ajoute une ligne du haut, cela se brise:

\begin{equation}
\begin{tikzcd}
    & S(F) & F \\
    & IS(F) \arrow[rrr] \arrow[d, "\operatorname{id}"]\arrow[dd, bend left = 75, "0"]&[-30pt] & & I(F)\\
    S(F) & IS(F) \arrow[d, "\partial_1^*-\partial_0^*"]&\circled{3}& \circled{1}& \\
    & S(F) &&& F \\
    \end{tikzcd}
\end{equation}

Toute aide est appréciée!

Réponses

3 AndréC Aug 22 2020 at 00:27

Comme expliqué dans les commentaires, le problème est qu'il \circled{3}est placé dans une cellule et ne peut donc pas être déplacé. Placez simplement un deuxième nœud sur la flèche pour le placer 3à l'emplacement souhaité. Pour ce faire, un style circled 2est créé.

J'ai coloré en bleu pour que vous puissiez voir les changements. J'ai créé un style appelé circled 2. Le code est commenté avec%<--

\documentclass[a41empaperpt]{article}
\usepackage{tikz-cd}
\usepackage{amsmath}
\usepackage{tikz}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
            \node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
\tikzset{circled 2/.style={draw,circle,font=\normalsize,inner sep=2pt}}     %<-- new style circled 2
            
\begin{document}
\begin{equation}
    \begin{tikzcd}
    & S(F) \arrow[ddddl, "\operatorname{id}"']\arrow[dd, "\operatorname{pr}^*"] \arrow{rr} & &  F \arrow[dd, "\operatorname{pr}^*"]\rar{R} & Z(F) \arrow[ddddddl, bend left = 75, dotted, "\beta"]\arrow[dd, "\operatorname{pr}^*"] \\
    & & \circled{2} & & \\
    & IS(F) \arrow[ddl, "\partial_0^*", "\simeq"' ] \arrow[dddd,blue, bend left = 90, "0", "3"{circled 2,swap,xshift=-2pt}] \arrow[dd, "\operatorname{id}"]\arrow[rr] & & I(F) \arrow[dddd, bend left = 30, "\partial_1^*-\partial_0^*"] \rar{R} & IZ(F) \arrow[ddddl, bend left = 45, dotted, "\alpha"]\\
    \\
    S(F) \arrow[ddr,  "0"']\arrow[r, "\operatorname{pr}^*", "\simeq"'] &[-10pt] IS(F) \arrow[dd, "\operatorname{\partial_1^*-\partial_0^*}"] &  & \circled{1} \\
    \\
    & S(F)\arrow[rr]  & & F
    \end{tikzcd}
\end{equation}

\end{document}
3 LuisTurcio Aug 22 2020 at 00:57

Je crois que les erreurs viennent d'un extra '. Je les ai supprimés et ai fait quelques petits changements dans votre code, vous pouvez facilement trouver les changements: certains {name=...}, un |[alias=is]|. J'ai placé les nombres encerclés à l'aide de la touche phantom, vous pouvez voir son utilisation avec la nouvelle flèche de S(F)à I(F)et les deux flèches à la fin.

\documentclass[a41empaperpt]{article}
\usepackage{tikz-cd}
\usepackage{amsmath}
\usepackage{tikz}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
            \node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
            
\begin{document}
\begin{equation}
\begin{tikzcd}[row sep=5em]
  & S(F)\arrow[rr] \arrow[d,"\operatorname{pr}^*"]
             \arrow[ddl,"\operatorname{id}"swap]
             \arrow[rrd,phantom,"\circled{2}"]
  && F\arrow[r,"R"]\arrow[d,"\operatorname{pr}^*"] 
  & Z(F)\arrow[d,"\operatorname{pr}^*"]
            \arrow[dddl, bend left = 75, dotted, "\beta"] \\ 
  &IS(F)\arrow[rr] \arrow[d,"\operatorname{id}"] 
             \arrow[dl,"\partial_0^*", "\simeq"swap]
             \arrow[dd,bend left = 90, "0"{name=0},""{name=o,left}]
  && I(F)\arrow[r,"R"]
       \arrow[dd,bend left = 30, "\partial_1^*-\partial_0^*",""{name=p,left}]
  & IZ(F)\arrow[ddl, bend left = 45, dotted, "\alpha"]\\
  S(F)\arrow[r,"\operatorname{pr}^*", "\simeq"swap] \arrow[dr,"0"swap]
  & |[alias=is]| IS(F)\arrow[d,"\operatorname{\partial_1^*-\partial_0^*}"]\\
  & S(F)\arrow[rr]
  && F
  \arrow[Rightarrow,from=0,to=p,phantom,"\circled{1}"]
  \arrow[Rightarrow,from=is,to=o,phantom,"\circled{3}"]
\end{tikzcd}
\end{equation}
\end{document}

Les nombres encerclés apparaissent toujours centrés entre les étiquettes correspondantes. Notez que vous n'avez pas besoin des lignes supplémentaires pour les placer. J'ai également ajouté swapaux flèches les plus à gauche, je pense que c'est mieux si les flèches idet 0sont placées à l'extérieur des triangles.