2

I currently have, the following two commutative diagrams for the second and third ring isomorphism theorems:

Second Isomorphism

enter image description here enter image description here

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,fit}
\begin{document}
    \begin{tikzpicture}[x=1.75cm,y=1.75cm]
    \node (r) at (0,2) {$R$};
    \node (apb) at (0,1) {$A+B$};
    \node (a) at (-1,0) {$A$};
    \node (b) at (1,0) {$B$};
    \node(ab) at (0,-1) {$A\cap B$};
    \draw (r)--(apb)--(a)--(ab) (ab)--(b)--(apb);
    \node[rotate=45,ellipse,draw,dashed,inner xsep=-9mm,inner ysep=1mm,fit=(apb)(b)] {};
    \node[rotate=45,ellipse,draw,dashed,inner xsep=-9mm,inner ysep=1mm,fit=(ab)(a)] {};
    \node {$\cong$};
    \end{tikzpicture}
\end{document}

Third Isomorphism

enter image description here enter image description here

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,fit}
\begin{document}
    \begin{tikzpicture}[x=1.75cm,y=1.75cm]
    \node (r) at (-1,1) {$R$};
    \node (j) at (-1,0) {$J$};
    \node (i) at (-1,-1) {$I$};
    \node (ri) at (1,1) {$R/I$};
    \node (ji) at (1,0) {$J/I$};
    \node (o) at (1,-1) {$0$};
    \draw (r)--(j)--(i) (ri)--(ji)--(o);
    \node[rotate=0,ellipse,draw,dashed,inner xsep=1mm,inner ysep=-2mm,fit=(r)(j)] {};
    \node[rotate=0,ellipse,draw,dashed,inner xsep=1mm,inner ysep=-2mm,fit=(ri)(ji)] {};
    \end{tikzpicture}
\end{document}
  1. First off, is there anyway to make these using tikz-cd package include the encircling ellipses. For the first diagram, I had a tikzcd picture but I wasn't able to find a way to add the ellipses. (I prefer tikz-cd because it is much more straightforward when creating these diagrams).
  2. As you can see, I wasn't able to complete the diagram for the Third Isomorphism, because I'm trying to get it so the arrow between the two encircled ellipses at heigh between the first and second nodes, at the level of their connecting lines. Can someone help me with that? (I also want a "isomorphic" i.e $\cong$ symbol as the caption of the connecting arrow).

Thanks!

1 Answer 1

3

with use of the remember picture and overlay, directive, due to them are needed at lest two compilation:

\documentclass{article}
\usepackage{tikz-cd}
\usetikzlibrary{fit,
                shapes.geometric}

\begin{document}
\centering
    \begin{tikzcd}[arrows=dash,
every matrix/.append style = {name=m},
remember picture, overlay,
                    ]
    &  R \ar[d]              &           \\
    &  A+B \ar[dl]\ar[dr] 
                             &           \\ 
A   \ar[dr] 
    &  \cong                 & B \ar[dl] \\
    &  A\cap B               &           
    \end{tikzcd}
%
    \begin{tikzpicture}[
remember picture, overlay,
E/.style = {ellipse, draw=blue, dashed,
            inner xsep=-2mm,inner ysep=-4mm, rotate=-30, fit=#1}
                        ]
\node[E = (m-2-2) (m-3-3)] {};
\node[E = (m-3-1) (m-4-2)] {};
    \end{tikzpicture}
\end{document}

enter image description here

Addendum: Above solution has annoying flaw: if image is inserted between two paragraphs, regardless if it is in center or figure or displaymath environment, it overlap the text above and below image. This can be removed by adding vertical space above and below image by \vspace{<amount>}˙.

This can be avoided, if you instead of remember picture and overlay, use execute at end picture directive as it is proposed in the first solution from the CarLaTeX answer:

\documentclass{article}
\usepackage{tikz-cd}
\usetikzlibrary{fit,
                shapes.geometric}
\usepackage{lipsum}

\begin{document}
    \lipsum[65]
    \[
\tikzset{
F/.style = {ellipse, draw=blue, dashed,
            inner xsep=-2mm,inner ysep=-4mm, rotate=-30, 
            fit=#1}
        }
    \begin{tikzcd}[
                arrows = dash,
execute at end picture = {
    \node[F = (tikz@f@1-2-2) (tikz@f@1-3-3)] {};
    \node[F = (tikz@f@1-3-1) (tikz@f@1-4-2)] {};
                        }% end of execute at end picture
                    ]
    &  R \ar[d]             &           \\
    &  A+B \ar[dl]\ar[dr]
                            &           \\
A   \ar[dr]
    &                       & B \ar[dl] \\
    &  A\cap B              &
    \end{tikzcd}
\]
\lipsum[66]   
\end{document}

enter image description here

6
  • Thank you, that worked, and I did it for the second diagram as well
    – Hushus46
    Mar 7, 2021 at 12:06
  • 1
    @Hushus46, sorry , I didn't understand what is the problem of the second diagram (i.e. which image present its problem). However, I'm very glad that you solve its problem yourself! Happy TeXing!
    – Zarko
    Mar 7, 2021 at 13:00
  • The second solution gives error "Package pgf: No shape named tikz@f@1-3-3 is known." I copied your code exactly as it is. Any ideas on why this happens?
    – Castor
    Dec 30, 2021 at 2:29
  • @Castor I check my second example again. It works. No warnings, no errors. I use recent MiKTeX on W10 machine.
    – Zarko
    Dec 30, 2021 at 5:03
  • My .tex must be in conflict with some packages. I tested your code on a clean file and had no errors. Weird.
    – Castor
    Dec 30, 2021 at 19:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .