2

I would like to use Tikz to draw something like this:

enter image description here

\tikzstyle{every picture}+=[remember picture]
\everymath{\displaystyle}\begin{equation*}
{\huge
    \tikz[baseline]{
        \node[fill=blue!10] (n171)
        {$0,000$};
    }
    \tikz[baseline]{
        \node[fill=blue!20] (n172)
        {$7$};
    }
    \tikz[baseline]{
        \node[fill=blue!30] (n173)
        {$82$};
            }
    \tikz[baseline]{
        \node[fill=blue!40] (n174)
        {$0 $};
    } \quad \Longrightarrow \quad
    \tikz[baseline]{
        \node[fill=blue!10,anchor=base] (t172)
        {$7$};
    },
    \tikz[baseline]{
        \node[fill=blue!20,anchor=base] (t173)
        {$82$};
    } \cdot
    \tikz[baseline]{
        \node[fill=blue!30,anchor=base] (t174)
        {$\num{e-4}$};
}
}
\end{equation*}\begin{tikzpicture}[overlay]
    \path[->] (n172) edge [out=90, in=90] (t172);
    \path[->] (n173) edge [out=-90, in=-90] (t173);
\end{tikzpicture}

enter image description here

Is there any way to do this better? Thanks

  • You are pretty close. Some minor tips: (1) you are filling nodes by fill=blue!40, which results in rectangles of variant sizes. Instead, draw a separate rectangle and color it so you can control its size. (2) rounded corners. (3) tune the angles in out=90, in=90 and use fancy arrow tips -latex. (4) for text like zati osoa, you can attach a node to an edge by \draw(A)edge node{zati}(B);. (5) for idazkera..., search for Decoration brace. – Symbol 1 Jul 22 '19 at 3:30
  • @Symbol1. I have tested your indications but I do not know how to reduce the space between the nodes. Thanks again. – Paco Robledo Jul 22 '19 at 7:47
  • something like outer sep=-2pt should help. – Symbol 1 Jul 22 '19 at 15:06
1

I have tried the indications given by @Symbol 1 and this is what I have achieved. Thanks again.

\tikzstyle{every picture}+=[remember picture]
\everymath{\displaystyle}
\begin{minipage}[b]{0.8\textwidth}
\hfill\begin{tikzpicture}
\draw[decorate,decoration=brace,very thick] (3,0) -- (10,0)node [midway, above=2pt] {\Large {Idazkera zientifikoa}};
\end{tikzpicture}

\begin{equation*}
{\huge
        \tikz[baseline,outer sep=-2pt]{
%        \draw[rounded corners] (0,0) rectangle (1.6,0.8);
        \draw (0,0.4) node(n171)
            {$0,000$};
        }
        \hspace{-.3cm}\tikz[baseline,outer sep=-2pt]{
        \draw[dashed, red, rounded corners] (0,0) rectangle (0.6,0.8);
        \draw (0.3,0.4) node(n172)
            {$7$};
        }
        \hspace{-.2cm}\tikz[baseline,outer sep=-2pt]{
        \draw[dashed, blue, rounded corners] (0,0) rectangle (0.8,0.8);
        \draw (0.4,0.4) node(n173)
            {$82$};
                }
        \hspace{-.3cm}\tikz[baseline,outer sep=-2pt]{
        \draw (0,0.4) node(n174)
            {$0 $};
        }
        \tikz[baseline]{
        \draw (0.2,0.4) node(n176)
            {$\Longrightarrow$};
        }% \quad \Longrightarrow \quad
        \tikz[baseline,outer sep=-2pt]{
        \draw[red, rounded corners] (0,0) rectangle (0.6,0.8);
        \draw (0.3,0.4) node(t172)
            {$7$};
        \node [red,above](osoa) at (t172.north) {\Large osoa};
        \node [red,above] at (osoa.north){\Large Zati};
        }
        \hspace{-.8cm}\tikz[baseline]{
        \draw (0,0) node(n176)
            {$,$};
        }
        \hspace{-1.4cm}\tikz[baseline,outer sep=-2pt]{
        \draw[blue,rounded corners] (0,0) rectangle (0.8,0.8);
        \draw (0.4,0.4) node(t173)
            {$82$};
        \node [blue,below](zati) at (t173.south) {\Large Zati};
        \node [blue,below] at (zati.south){\Large hamartarra};
        }
        \hspace{-1.4cm}\tikz[baseline]{
        \draw (0,0.4) node(n176)
            {$\times$};
        }
        \hspace{-.4cm}\tikz[baseline,outer sep=-2pt]{
        \draw[green, rounded corners] (0,0) rectangle (1.4,0.8);
        \draw (0.7,0.4) node(t174)
            {$\num{e-4}$};
        \node [green,above right] at (100:0.9) {\Large 10en berretura};
                }
 }
 \end{equation*}


\begin{tikzpicture}[overlay]
        \path[-latex,red,very thick] (n172) edge [out=45, in=135] (t172);
        \path[-latex,blue,very thick] (n173) edge [out=-45, in=-135] (t173);
\end{tikzpicture}
\end{minipage}

enter image description here

| improve this answer | |

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.