9

I'm trying to create a diagram like this with Latex. (I'm trying to learn to write in Latex by myself.)

The best code I can do is this:

\documentclass{article}
\begin{document}
\usepackage[all]{xy}
$$
\xymatrix{
\overset{\supset ker(f)}{ker(w)\subset E} \ar[d]_f \ar[dr]_{\pi_f} \ar[r]^w &\mathbb{K} \\
F & E/ker(f) \simeq Im(f) \ar[u]_{w'} }
$$
\end{document}

That produces:

But it isn't the same, because the arrows must start at "E" and not in the middle of ker(w) \subset E and its obvious that \overset{} isn't the appropiate command to write \subset ker(f) as I want.

Thank you for your attention, and sorry for my english.

  • Welcome to TrX.SE! Off-topic: packages used in document had to be loaded in preamble, i.e. before \begin{document}. – Zarko Nov 12 '16 at 1:40
  • Don't use $$ ... $$ in LaTeX - it is 20+ years obsolete. Try \[ ... \] instead. – cfr Nov 12 '16 at 3:18
8

Since it seems a commutative diagram, what about using tikz-cd?

\documentclass{article}
\usepackage{tikz-cd}
\usepackage{amsmath, amssymb}
\begin{document}
    \begin{tikzcd}% 
        &[-30pt] \ker(f) \arrow[dl, phantom, sloped, "\supset"] \arrow[dr, phantom, sloped, "\subset"]&[-30pt] & &[-75pt] \\[-4pt]
        \ker(w) \arrow[rr, phantom, "\subset"]& & E \arrow[rr, "w"] \arrow[rd, end anchor={[xshift=.5em]north west}, "\pi_f"] \arrow[dd, swap, "f"] & & \mathbb{K}\\
        & & & E/\ker(f) \simeq Im(f) \arrow[ru, dashrightarrow, start anchor={[xshift=1.1em]north west}, swap, "w'"]& \\
        & & F & & 
    \end{tikzcd}%
\end{document}

enter image description here

13

A somewhat more concise tikz alternative:

\documentclass[tikz, border=3mm]{standalone}
\usepackage{amsmath, amssymb}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}[inner sep=5pt, >=latex, 
   label/.style={auto, inner sep=1pt, circle}
   ]
\path (0,0) node (E) {$E$}
  (120:1.5) node (kerf) {$\ker(f)$}
  (180:1.5) node (kerw) {$\ker(w)$}
  (4,0) node (K) {$\mathbb{K}$}
  (0,-3) node (F) {$F$}
  (2,-2) node (EE) {\phantom{$E$}}
  (EE.west) node[anchor=west] {$E/\ker(f) \simeq Im(f)$};

\path (E) -- node[sloped] {$\subset$} (kerf);
\path (kerw) -- node[sloped] {$\supset$} (kerf);
\path (kerw) -- node {$\subset$} (E);
\draw[->] (E) -- node[label] {$w$} (K);
\draw[->] (E) -- node[label] {$f$} (F);
\draw[->] (E) -- node[label] {$\pi_f$} (EE);
\draw[->, dashed] (EE) -- node[label] {$w'$} (K);
\end{tikzpicture}
\end{document}

enter image description here

5

A TikZ alternative (it is not so concise as it is pstricks:

\documentclass[tikz, border=3mm]{standalone}
\usetikzlibrary{arrows.meta, positioning, quotes, shapes.multipart}
\usepackage{amsmath, amssymb}
\DeclareMathOperator{\ar}{ar}
\usepackage{graphicx}

\begin{document}
\begin{tikzpicture}[
     node distance = 22mm and 24mm,
every label/.style = {label distance=0mm, inner sep=0mm, 
                      xshift=1em, align=center},
RS/.style = {%Rectangle Split 
    rectangle split, rectangle split horizontal, rectangle split parts=2,
    inner ysep=1mm, inner xsep=0mm}
                    ]
\node (n1) [RS,label={$\ker(f)$\\ 
                       \rotatebox[origin=c]{240}{$\subset$} 
                       \qquad
                       \rotatebox[origin=c]{300}{$\subset$}}]
    {\nodepart{one} $\ker(w)\quad\subset\quad$
     \nodepart{two} $E$
     }; 
\node (n2) [right=of n1] {$\mathbb{K}$};
\node (n3) [below=of n1.two south] {$F$};
\node (n4) [RS,right=of n3] 
    {\nodepart{one} $E/$
     \nodepart{two} $\ker(f) \simeq Im(f) \ar[u]_{w'}$
     };
\draw[-Latex]   (n1) edge ["$w$"] (n2)
                (n1.two south) edge ["$f$"] (n3)
                (n1.south east) edge ["$\pi_f$"] (n4.north west)
                (n4.one north) to ["$w'$"] (n2);
\end{tikzpicture}
\end{document}

enter image description here

4

Here is a simple way to do it with pstricks:

\documentclass[11pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}%
\usepackage{lmodern, amssymb}
\usepackage{mathtools}
\usepackage{pst-node, auto-pst-pdf}
\DeclareMathOperator{\Img}{Im}

\newpsobject{ncemptyline}{ncline}{linestyle=none, arrows=-}
\newcommand*\ncsubset[2]{\ncemptyline{#1}{#2}\ncput[nrot=:U]{\subset}}

\begin{document}

\psset{shortput=tab,  arrows=->, linewidth=0.6pt,  nodesep=3pt}
\def\pscolhookiv{\hskip0.5cm}
\everypsbox{\scriptstyle}
$ \begin{psmatrix}[rowsep=0.6, colsep=0.4]
& [name = Kf] \ker f \\
[name = Kom] \kerω& & [name = E] E & & [name =K] K\\
& & & [name = Cok] E/\ker f\mathrlap{\,  ≃  \Img f} \\
& & [name = F] F%
%\nput{0}{Cok}{\!\!\!{}  ≃  {}\Img f}
\ncline{E}{K}^{ω}     \ncline{E}{F}_{f}%
\ncline{E}{Cok}\naput[labelsep=0pt]{\pi_f}%
\ncline[linestyle=dashed]{Cok}{K}\nbput[npos=0.6,labelsep=0pt]{\omega'}
\ncsubset{Kf}{Kom}\ncsubset{Kf}{E}
\end{psmatrix}  $

\end{document} 

enter image description here

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.