1

Consider the MWE for creating an image below using tikZ. But it fails. Any idea to do that?

\documentclass[statementpaper,11pt,twoside]{memoir}

\usepackage{tikz}

\begin{document}

\begin{center} \begin{tikzpicture}[digits/.style={inner xsep=0pt, inner ysep=2pt}]

\node[digits] (num) at (0,0) {\large $23 \times 55$};

\draw[<->,thick] ([xshift={width("$23$")+1ex/2}]num.north west) to [bend left=45] ([xshift={width("$23 \times 55$")-1ex/2}]num.north west);
\draw[<->,thick] ([xshift={width("$2$")+1ex/2}]num.north west) to [bend left=45] node[above] (label above) {\small Multiply} ([xshift={width("$23 \times 5$")-1ex/2}]num.north west);

\draw[<->,thick] ([xshift={width("$1$")-1ex/2}]num.south west) to [bend right=45] node[below] (label below) {\small Multiply} ([xshift={width("$114 \times 3$")-1ex/2}]num.south west);

\end{tikzpicture}

\end{center}

\end{document}

Desired output:

enter image description here

Note: The question is not an exact duplicate of this. Because, it actually deals with two numbers, not two mathematical expressions like the identified question.

mmr
  • 2,249
  • 5
  • 22

1 Answers1

5

As this is not really an exact duplicate, I answer to it, just to help you understand how a simple tikzmark implementation can help you in this kind of situation.

tikzmark rainbow over numbers

\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark}

\begin{document} \tikzset{ every node/.style={outer sep=2pt}, lab/.style={font=\tiny,inner sep=0pt}}

\Huge 
\[
\tikzmarknode{A}{2}\tikzmarknode{B}{3} \times \tikzmarknode{C}{5}\tikzmarknode{D}{5}
\]

\begin{tikzpicture}[remember picture,overlay,line width=1.5pt]
    \draw[blue] (A) to[out=90,in=90,looseness=1.4] node[lab,midway,above]{multiply} (D) ;
    \draw[red] (B) to[out=90,in=90] node[lab,midway,above]{multiply} (C) ;  
    \draw[cyan] (A) to[out=-70,in=-110] node[lab,midway,below left]{multiply} (C) ;
    \draw[cyan] (B) to[out=-70,in=-110] node[lab,midway,below right]{multiply} (D) ;        
\end{tikzpicture}

\end{document}

SebGlav
  • 19,186