2

I need your help.

How to get a new custom shape of a node in a tikzcd diagramm which uses option cells={nodes={ellipse}}?

I've tried to use a trick with |[cells={nodes={draw=red, rectangular}}]|, but in vain.

MWE is from this discussion.

    \documentclass{article}
    \usepackage{tikz-cd}
    \usetikzlibrary{shapes}
    \begin{document}
        \begin{figure}
            \begin{tikzcd}[cells={nodes={draw=black, ellipse,anchor=center,minimum height=2em}}]
            0 \arrow[r] & 1 \arrow[r] & |[draw=none]|\dots \arrow[r] & n-1 \arrow[r] & |[cells={nodes={draw=red, rectangular}}]|n
            \end{tikzcd}
        \end{figure}
    \end{document}

Desired effect:

enter image description here

  • 1
    \begin{tikzcd}[cells={nodes={draw=black, ellipse,anchor=center,minimum height=2em}}] 0 \arrow[r] & 1 \arrow[r] & |[draw=none]|\dots \arrow[r] & n-1 \arrow[r] & |[shape=rectangle]|n \end{tikzcd} \begin{tikzcd}[cells={nodes={draw=black, ellipse,anchor=center,minimum height=2em}}] 0 \arrow[r] & 1 \arrow[r] & |[draw=none]|\dots \arrow[r] & n-1 \arrow[r] & |[shape=rectangle]|n \end{tikzcd} i.e. add shape=rectangle. – user121799 Jul 31 '19 at 15:18
4

You're overcomplicating a bit, you just need

|[draw=red, rectangle]| 

in the cell.

enter image description here

\documentclass{article}
\usepackage{tikz-cd}
\usetikzlibrary{shapes}
\begin{document}
    \begin{figure}
        \begin{tikzcd}[cells={nodes={draw=black, ellipse,anchor=center,minimum height=2em}}]
        0 \arrow[r] & 1 \arrow[r] & |[draw=none]|\dots \arrow[r] & n-1 \arrow[r] & |[draw=red, rectangle]|n
        \end{tikzcd}
    \end{figure}
\end{document}
  • 1
    thank you so much! Overcomplicating is almost everywhere in my life, unfortunatelly.. – Vladimir Parkhomenko Jul 31 '19 at 15:21
  • @VladimirParkhomenko Don't worry about the difficulties. Think about how much I have with the LaTeX :-) – Sebastiano Jul 31 '19 at 15:26
  • 1
    Thanks once again)) – Vladimir Parkhomenko Jul 31 '19 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.