Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am quite new to LaTeX and I was curious if anyone knew how to make these sorts of diagrams. I saw one other picture on here but it was a three node diagram and I wasn't sure how to make LaTeX recognize to make a square when I inserted another node. Any ideas?

Edit: Specifically, this works:

\begin{tikzpicture}[every node/.style={midway}]
\matrix[column sep={4em,between origins},
        row sep={2em}] at (0,0)
{ \node(R)   {$R$}  ; & \node(S) {$S$}; \\
  \node(R/I) {$R/I$};                   \\};
\draw[<-] (R/I) -- (R) node[anchor=east]  {$\chi$};
\draw[->] (R/I) -- (S) node[anchor=north]  {$\psi$};
\draw[->] (R)   -- (S) node[anchor=south] {$\phi$};
\end{tikzpicture}

But I need to change the starting points and destinations of arrows to allow for four nodes.

share|improve this question
    
Welcome to TeX.SX! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Kevin C Jul 6 '13 at 16:00
    
Is this answer (tex.stackexchange.com/a/45747/12571) useful? –  JLDiaz Jul 6 '13 at 16:01
1  
Also, there is a TikZ-based package specifically for commutative diagrams: tikz-cd –  Kevin C Jul 6 '13 at 16:01
    
Yes JLDiaz, but for some reason even though I have the tikz package up and running when I paste that into my code it won't compile. –  user33311 Jul 6 '13 at 16:02
1  
@user33311 What you put inside the \matrix has the structure of a latex table, so you use & to make "cells" in each column, and \` to start a new row. So you can guess that you need to add the fourth node by adding & \node{...}` in the code your posted, in the white space below node S. –  JLDiaz Jul 6 '13 at 16:21

2 Answers 2

It's really easy with tikz-cd:

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}

\[
\begin{tikzcd}
R \arrow{r}{\phi} \arrow[swap]{d}{\chi} & S \arrow{d}{\Psi} \\
R/I \arrow{ur}{\psi} \arrow{r}{\Phi} & T
\end{tikzcd}
\]

\end{document}

enter image description here

share|improve this answer

As JLDiaz informed you, we can make a forth node by adding an & \node ...;

\documentclass[convert = false, tikz]{standalone}
\begin{document}
\begin{tikzpicture}[every node/.style={midway}]
  \matrix[column sep={4em,between origins}, row sep={2em}] at (0,0) {
    \node(R) {$R$}  ; & \node(S) {$S$}; \\
    \node(R/I) {$R/I$}; & \node (T) {$T$};\\
  };
  \draw[<-] (R/I) -- (R) node[anchor=east]  {$\chi$};
  \draw[->] (R/I) -- (S) node[anchor=north]  {$\psi$};
  \draw[->] (R) -- (S) node[anchor=south] {$\phi$};
  \draw[->] (S) -- (T) node[anchor=west] {$\Psi$};
  \draw[->] (R/I) -- (T) node[anchor=north] {$\Phi$};
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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