4

I want to draw a diagram with rightarrow and downarrow.

So first I tried:

\begin{alignat*}{3}
M_n&(D) \overset{\alpha'}&\longrightarrow M_n&(R)\\
\det &\downarrow & &\downarrow \det\\
&D \overset{\alpha}&\longrightarrow &R
\end{alignat*}

Then it gives me:

Enter image description here

But the rightarrow with alpha aligned at the left.

The next thing I did:

\begin{equation*}
\arraycolsep=1pt\def\arraystretch{1}
\begin{array}{cccccc}
& &M_n(D)\quad &\overset{\alpha'}\longrightarrow\quad &M_n(R) &\\
&\det &\downarrow &\quad &\downarrow &\det\\
& &D &\overset{\alpha}\longrightarrow &R &
\end{array}
\end{equation*}

This gives me:

Enter image description here

It looks better, but what I really want is that first downarrow looks the same as the second downarrow, that is, it starts from between 'n' and '('. Also the rightarrows do not look like aligned at all.

What should I do?

  • Your second code works perfectly. Everything is perfectly aligned. Except under Overleaf which has a real problem since there has already been a case where the compilation result with Overleaf is not the same as on his own computer: tex.stackexchange.com/q/498353/138900 you should report this malfunction to the Overleaf team. – AndréC Jul 6 at 12:34
7

Welcome to TeX-SE! I recommend tikz-cd for that.

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[column sep=3em,row sep=3em]
M_n(D) \arrow[r,"\alpha'"] \arrow[d,"\det"]  & M_n(R)\arrow[d,"\det"]\\
D \arrow[r,"\alpha"] &R 
\end{tikzcd}
\end{document}

enter image description here

If needed, you can make det larger. (The font sizes of the \alphas can be increased in the same way.)

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[column sep=3em,row sep=3em]
M_n(D) \arrow[r,"\alpha'"] \arrow[d,"\displaystyle\det"]  & M_n(R)\arrow[d,"\displaystyle\det"]\\
D \arrow[r,"\alpha"] &R 
\end{tikzcd}
\end{document}

enter image description here

  • 1
    Thanks a lot! It looks great! – Xaviere Jul 6 at 7:23
  • 1
    @Xaviere You're welcome! – user121799 Jul 6 at 7:24
3

Considering that I absolutely agree with the very good user @marmot, I add another code using xy package. Look closely at the almost similar comparison between tikz-cd and xy, except for the tips of the arrows.

enter image description here

\documentclass{book}
\usepackage[all]{xy}
\begin{document}
\xymatrix@R=3pc@C=3pc{
M_n(D) \ar[r]^{\alpha'} \ar[d]^{\det} & M_n(R) \ar[d]^{\det}\\
D \ar[r]^{\alpha} & R\\
}
\end{document}

If you add only cmtip, you can obtain the same tips of tikz-cd.

enter image description here

\documentclass{book}
\usepackage[all,cmtip]{xy}%%%%%%%% <---------add only cmtip
\begin{document}
\xymatrix@R=3pc@C=3pc{
M_n(D) \ar[r]^{\alpha'} \ar[d]^{\det} & M_n(R) \ar[d]^{\det}\\
D\ar[r]^{\alpha} & R\\
}
\end{document}
1

Naturally, I still like drawing with pure TikZ, without using packages as tikzcd, xy, even without using TikZ's library positioning.

\documentclass[tikz,border=5mm]{standalone}
\begin{document}

\begin{tikzpicture}
\path
(0,0) node (MD) {$M_n(D)$}
+(0:3) node (MR) {$M_n(R)$}
++(-90:2) node (D) {$D$}
+(0:3) node (R) {$R$};

\draw[->] (MD)--(MR) node[midway,above]{$\alpha'$};
\draw[->] (D)--(R) node[midway,above]{$\alpha$};
\draw[->] (MD)--(D) node[midway,right]{$\rm det$};
\draw[->] (MR)--(R) node[midway,right]{$\rm det$};
\end{tikzpicture}
\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.