展示以下图片的最佳方式是什么?

展示以下图片的最佳方式是什么?

我正在寻找展示下图的最佳实践。我想显示等价分数,并需要显示分子和分母的运算。我必须对坐标进行硬编码,例如 (1,0),但我认为有更好的方法。也许用tikz matrix?这是我的代码:

    \documentclass[11pt,fleqn]{examdesign}
\usepackage{savesym}
\usepackage{amsmath}
\SectionFont{\large\sffamily}
%%\usepackage[shortlabels,inline]{enumitem}  %%shortlabels here for matchign
%%\usepackage{cancel}
\usepackage{tkz-euclide} %%%%%%%%%%%for marking angles
%%\usetkzobj{all}  %%%%%%%%%%%because Overleaf uses old Tex
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,calc,matrix}

\class{needed for examdesign}
\begin{document}
\begin{tikzpicture}[]
    \node(A) at (0,0){$\cfrac{1}{2}$};
     \node(B) at (3,0){$\cfrac{5}{10}$};   
     \node(C) at (1.5,0){=};
 \path[every node/.style={font=\sffamily\small},->,>=latex]
  (A.south) edge[bend right] node [below,blue]{$\times5$}(B.south)
  (A.north) edge[bend left] node [above,blue]{$\times5$}(B.north);
\end{tikzpicture}

\begin{tikzpicture}[roundnode/.style={circle, draw=blue, fill=white, very thick, minimum size=10mm}]
    \node(A) at (0,0){$\cfrac{1}{2}$};
     \node(B) at (3,0){$\cfrac{5}{10}$};   
     \node(C) at (1.5,0){=};
 \path[every node/.style={font=\sffamily\small},->,>=latex]
  (A.south) edge[bend right] node [roundnode]{$\times5$}(B.south)
  (A.north) edge[bend left] node [roundnode]{$\times5$}(B.north);
\end{tikzpicture}

\end{document}

这些是我得到的照片。

分数的图片

我想我现在所拥有的方法可行,但是这是matrix更好的方法吗?

答案1

除了你提到的之外还有tikz-cd(当然,是一个矩阵)。

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

\begin{document}
\begin{tikzcd}
\dfrac{1}{2} \arrow[rr,-latex,bend left,shift left=1ex,"\times 5" blue]
\arrow[rr,-latex,bend right,shift right=1ex,"\times 5"' blue]
& = & \dfrac{5}{10}
\end{tikzcd}
\medskip

\begin{tikzcd}
\dfrac{1}{2} 
\arrow[rr,-latex,bend left,shift left=1ex,"\times 5" {marking,circle,draw=blue,fill=white}]
\arrow[rr,-latex,bend right,shift right=1ex,"\times 5"' {marking,circle,draw=blue,fill=white}]
& = & \dfrac{5}{10}
\end{tikzcd}

\end{document}

在此处输入图片描述

相关内容