TransWikia.com

Display problems with a tikz-cd diagram

TeX - LaTeX Asked by cos_dm_math21 on February 21, 2021

I use tikz-cd package to construct a math diagram. Here is the code:

documentclass[12pt, a4 paper]{article}

usepackage[utf8]{inputenc}
usepackage{tikz-cd}
usepackage{amsmath}
usepackage{mathdots}

begin{document}

begin{tikzcd}[column sep = tiny, row sep = small]
& & & & & &M   arrow[hookleftarrow]{dr} & & & & &
& & & & &M_{n-1} arrow[hookrightarrow]{ur} arrow[hookleftarrow]{dr} &  &N_{p-1} arrow[hookleftarrow]{dr} & & & & 
& & & &M_{n-2} arrow[hookrightarrow]{ur} arrow[hookleftarrow]{dr} & &M'_{n-1}  arrow[hookrightarrow]{ur} & &N_{p-2} arrow[hookleftarrow]{dr} & & & 
& & & iddots  arrow[hookrightarrow]{ur} & &M'_{n-2} arrow[hookrightarrow]{ur} & & & & ddots arrow[hookleftarrow]{dr} & & 
& &M_1 arrow[hookrightarrow]{ur} arrow[hookleftarrow]{dr} & & iddots arrow[hookrightarrow]{ur} & & & & & & N_1 arrow[hookleftarrow]{dr} & 
& M_0 arrow[hookrightarrow]{ur} arrow[equal]{dr} & & M'_1 arrow[hookrightarrow]{ur} & & & & & & & & N_0 
& &M'_0 arrow[hookrightarrow]{ur} & & & & & & & & &
end{tikzcd} 

end{document}

I get this diagram:
Diagram

It doesn’t look so good. I tried so many things to make the picture look better, but I get no relevant results. The big problem is with that diagonal dots. Can someone help me to improve my code? Thank you!
Also, a want to label this diagram such that under it would be "Fig.1". I mention that this diagram has to appear in the middle of a proof (in the proof enviroment).

One Answer

The problem are the cells with different widths. You can use between origins to fix the issue.

I also changed the dots to be “rotated cdots”. The commands updots and downdots have an optional argument to fine tune the angle for different situations (default 45).

documentclass[12pt, a4paper]{article}

usepackage{tikz-cd}
usepackage{amsmath}
usepackage{graphicx}

newcommandupdots[1][45]{%
  makebox[1em]{smash{rotatebox[origin=c]{#1}{$cdots!$}}vphantom{$|$}}%
}
newcommanddowndots[1][45]{%
  makebox[1em]{smash{rotatebox[origin=c]{-#1}{$cdots!$}}vphantom{$|$}}%
}

begin{document}

begin{tikzcd}[column sep ={2.75em,between origins}, row sep = {2.75em,between origins}]
& & & & & &M   arrow[hookleftarrow]{dr} & & & & &
& & & & &M_{n-1} arrow[hookrightarrow]{ur} arrow[hookleftarrow]{dr} &  &N_{p-1} arrow[hookleftarrow]{dr} & & & & 
& & & &M_{n-2} arrow[hookrightarrow]{ur} arrow[hookleftarrow]{dr} & &M'_{n-1}  arrow[hookrightarrow]{ur} & &N_{p-2} arrow[hookleftarrow]{dr} & & & 
& & & updots  arrow[hookrightarrow]{ur} & &M'_{n-2} arrow[hookrightarrow]{ur} & & & & downdots arrow[hookleftarrow]{dr} & & 
& &M_1 arrow[hookrightarrow]{ur} arrow[hookleftarrow]{dr} & & updots arrow[hookrightarrow]{ur} & & & & & & N_1 arrow[hookleftarrow]{dr} & 
& M_0 arrow[hookrightarrow]{ur} arrow[equal]{dr} & & M'_1 arrow[hookrightarrow]{ur} & & & & & & & & N_0 
& &M'_0 arrow[hookrightarrow]{ur} & & & & & & & & &
end{tikzcd} 

end{document}

enter image description here

Correct answer by egreg on February 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP