需要帮助格式化 tikz-cd 图表

需要帮助格式化 tikz-cd 图表

我需要帮助格式化 tikz-cd。它应该看起来像这张图片:在此处输入图片描述但是我写了这样的代码:

\documentclass[11pt]{standalone} 
\usepackage{tikz-cd}
\begin{document}
    \begin{tikzcd}
        m^3 \arrow[rrr, "\cdot 1000", bend left] \arrow[rdd, "\cdot 10", bend left] \arrow[dd, no head, Rightarrow, bend right] &                                                                                                    &  & dm^3 \arrow[rrr, "\cdot 1000", bend left] \arrow[lll, "\div 1000", bend left] \arrow[dd, no head, Rightarrow] &                                                                                                &                                                                                                & cm^3 \arrow[lll, "\div 1000", bend left] \arrow[dd, no head, Rightarrow] \\
        &                                                                                                    &  &                                                                                                               &                                                                                                &                                                                                                &                                                                          \\
        \text{kubík} \arrow[d, no head, dotted]                                                                                 & hl \arrow[luu, "\div 10", bend left] \arrow[rr, "\cdot 100", bend left] \arrow[d, no head, dotted] &  & l \arrow[ll, "\div 100", bend left] \arrow[r, "\cdot 10", bend left] \arrow[d, no head, dotted]               & dl \arrow[r, "\cdot 10", bend left] \arrow[l, "\div 10", bend left] \arrow[d, no head, dotted] & cl \arrow[r, "\cdot 10", bend left] \arrow[l, "\div 10", bend left] \arrow[d, no head, dotted] & ml \arrow[l, "\div 10", bend left] \arrow[d, no head, dotted]            \\
        \text{proud řeky}                                                                                                       & \text{bazén}                                                                                       &  & \text{krabice mléka}                                                                                          & \text{sklenice vína}                                                                           & \text{panák}                                                                                   & \text{injekce}                                                          
    \end{tikzcd}
\end{document}
% Adapted from https://tex.stackexchange.com/questions/47905/how-to-globally-tikzset-styles

但我得到了这个“扭曲”的图像在此处输入图片描述

  • 问题 1:如何获得更好的格式(分离)?
  • 问题 2:如何获得非斜体字体?
  • 问题 3:将右侧箭头设为红色、将左侧箭头设为蓝色的最快方法是什么?
  • 问题 4:管理员可以修复我的代码,使页面更易读吗?
  • 问题 5:如何从“长等号”中删除箭头状末端

谢谢。

答案1

这是一个可能的方法:

\documentclass{article}
\usepackage{amsmath,tikz-cd,siunitx}

\DeclareSIUnit\litre{l}
\newcommand{\exmpl}[1]{%
  \makebox[0pt]{%
    \begin{tabular}[t]{@{}c@{}}#1\end{tabular}%
  }%
}

\begin{document}

\begin{tikzcd}[sep=3.2em]
\unit{\meter\cubed}
  \arrow[d,equal,bend right]
  \arrow[dr,bend left=20,"\cdot 10"]
  \arrow[rrr,bend left=20,"\cdot 1000"]
&&&
\unit{\deci\meter\cubed}
  \arrow[d,equal]
  \arrow[rrr,bend left=20,"\cdot 1000"]
  \arrow[lll,bend left=20,"\div 1000"]
&&&
\unit{\centi\meter\cubed}
  \arrow[d,equal]
  \arrow[lll,bend left=20,"\div 1000"]
\\[8ex]
\text{kubík}
  \arrow[d,dotted,no head]
&
\unit{\hecto\liter}
  \arrow[ul,bend left=20,"\div 10"]
  \arrow[rr,bend left=20,"\cdot 100"]
  \arrow[d,dotted,no head]
&&
\unit{\liter}
  \arrow[ll,bend left=20,"\div 100"]
  \arrow[r,bend left=20,"\cdot 10"]
  \arrow[d,dotted,no head]
&
\unit{\deci\liter}
  \arrow[l,bend left=20,"\div 10"]
  \arrow[r,bend left=20,"\cdot 10"]
  \arrow[d,dotted,no head]
&
\unit{\centi\liter}
  \arrow[l,bend left=20,"\div 10"]
  \arrow[r,bend left=20,"\cdot 10"]
  \arrow[d,dotted,no head]
&
\unit{\milli\liter}
  \arrow[l,bend left=20,"\div 10"]
  \arrow[d,dotted,no head]
\\
\exmpl{proud \\ řeky} & \exmpl{bazén} &&
\exmpl{krabice \\ mléka} & \exmpl{sklenice \\ vína} &
\exmpl{panák} & \exmpl{injekce}
\end{tikzcd}

\end{document}

在此处输入图片描述

带有颜色:

\documentclass{article}
\usepackage{amsmath,tikz-cd,siunitx}

\DeclareSIUnit\litre{l}
\newcommand{\exmpl}[1]{%
  \makebox[0pt]{%
    \begin{tabular}[t]{@{}c@{}}#1\end{tabular}%
  }%
}

\begin{document}

\begin{tikzcd}[sep=3.2em]
\unit{\meter\cubed}
  \arrow[d,equal,bend right]
  \arrow[dr,red,bend left=20,"\cdot 10"]
  \arrow[rrr,red,bend left=20,"\cdot 1000"]
&&&
\unit{\deci\meter\cubed}
  \arrow[d,equal]
  \arrow[rrr,red,bend left=20,"\cdot 1000"]
  \arrow[lll,blue,bend left=20,"\div 1000"]
&&&
\unit{\centi\meter\cubed}
  \arrow[d,equal]
  \arrow[lll,blue,bend left=20,"\div 1000"]
\\[8ex]
\text{kubík}
  \arrow[d,dotted,no head]
&
\unit{\hecto\liter}
  \arrow[ul,blue,bend left=20,"\div 10"]
  \arrow[rr,red,bend left=20,"\cdot 100"]
  \arrow[d,dotted,no head]
&&
\unit{\liter}
  \arrow[ll,blue,bend left=20,"\div 100"]
  \arrow[r,red,bend left=20,"\cdot 10"]
  \arrow[d,dotted,no head]
&
\unit{\deci\liter}
  \arrow[l,blue,bend left=20,"\div 10"]
  \arrow[r,red,bend left=20,"\cdot 10"]
  \arrow[d,dotted,no head]
&
\unit{\centi\liter}
  \arrow[l,blue,bend left=20,"\div 10"]
  \arrow[r,red,bend left=20,"\cdot 10"]
  \arrow[d,dotted,no head]
&
\unit{\milli\liter}
  \arrow[l,blue,bend left=20,"\div 10"]
  \arrow[d,dotted,no head]
\\
\exmpl{proud \\ řeky} & \exmpl{bazén} &&
\exmpl{krabice \\ mléka} & \exmpl{sklenice \\ vína} &
\exmpl{panák} & \exmpl{injekce}
\end{tikzcd}

\end{document}

在此处输入图片描述

相关内容