2

I need help with formating tikz-cd. It should look like this picture: enter image description here however i wrote this code:

\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

But I got this "warped" imageenter image description here

  • Question 1: How can I get better formatting (separating)?
  • Question 2: How can I get non-italic font?
  • Question 3: Fastest way to color rigth arrows as red and left arrows as blue?
  • Question 4: Can admin repair my code to be more readable on page?
  • Question 5: How to delete arrow-like end from "long equality sign"

Thank you.

1 Answer 1

1

Here's a possible way:

\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}

enter image description here

With colors:

\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}

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.