3

I want to draw the following picture:

enter image description here

But I got stuck where to start? What should I use normal TikZ node (\node) or TikZmark Node (\tikzmarknode)? I am not expert in tikz-pgf package. Your help is expected.

Added:

I tried:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{tikzmark}

\begin{document}

\large 
\[
    \tikzmarknode{v1}{1}\tikzmarknode{v2}{4}\newline
    \tikzmarknode{A}{3}\tikzmarknode{B}{\raisebox{1em}{2}}\tikzmarknode{C}{4}\tikzmarknode{D}{5}\tikzmarknode{E}{6}\tikzmarknode{F}{3}
\]

\begin{tikzpicture}[remember picture,overlay]
    \tikzset{
        every node/.style={outer sep=2pt},
        lab/.style={font=\tiny,inner sep=0pt}}
        
        \draw[red] (B) to[out=90,in=90] node[lab,midway,above]{} (v2) ;  

\end{tikzpicture}
\end{document}
6
  • Answering your question depends on the method you will use to create your picture in the first place (without the arrows, I mean). What did you do? Please share a compilable MWE of what you already wrote, then we could help you decide what better method to use.
    – SebGlav
    Commented Dec 5, 2021 at 18:05
  • @SebGlav I actually could not decided which things should I use. I need to draw it with less hustle and easy to draw. I have added my code.
    – mmr
    Commented Dec 5, 2021 at 19:09
  • Your approach is probably easiest. A regular \tikzmark puts a coordinate at the baseline, from which you would have to estimate the distance and direction to start the arrow. Here you can use the bounding box in which the letter was inserted. Commented Dec 5, 2021 at 20:03
  • One last question before trying anything: what exactly is this picture supposed to illustrate? Could you elaborate a bit? I'm not familiar with this kind of figures disposition. And is it a one shot drawing or is it supposed to be reproduced with different figures elsewhere?
    – SebGlav
    Commented Dec 5, 2021 at 22:49
  • 1
    This question my be related: Help writing a simple long division problem with LaTex
    – Roland
    Commented Dec 6, 2021 at 0:00

1 Answer 1

4

Using \tikzmarknode is a good idea. But first you need to draw the division problem without the arrows. An array works well for this. The syntax {*{12}{c@{\,}}} center-justifies each column but reduces the column spacing to 0, then adds a small thin space (\,) between each column. *{12} means repeat that 12 times. (You only have 7 columns at the moment, but maybe you'll add more.)

enter image description here

Placing the minus signs inside \mathllap prevents them from adding space to their columns.

Once the division problem is drawn, put the numbers that you want to be nodes inside \tikzmarknode. Then in a tikzpicture with options remember picture, overlay, draw the arrows from node to node using any tikz options you want such as looseness=, in=, out=, etc. You can place a node (I called it M) in the middle of one of those arrows.

\documentclass{article}

\usepackage{mathtools} % needed for \mathllap
\usepackage{tikz}
\usetikzlibrary{tikzmark}

\begin{document}

\[
\begin{array}{*{12}{c@{\,}}}
& & &1&\tikzmarknode{B}{4}& & &\\ \cline{3-8}
3&\tikzmarknode{A}{2}&\raisebox{.6pt}{\kern-.56pt)}&4&5&\tikzmarknode{C}{6}&3\\
&&&\smash{\vdots}&\\ \cline{4-8}
&&&1&3\\
&&&\mathllap{-}1&2\\ \cline{4-8}
&&&&1&\tikzmarknode{D}{6}\\
&&&&&\mathllap{-}\tikzmarknode{E}{8}\\ \cline{4-8}
&&&&&8
\end{array}
\]

\begin{tikzpicture}[remember picture, overlay, >=latex, shorten >=2pt, shorten <=2pt]
\draw[->](C)--(D);
\draw[<->, looseness=2.5](A.north)to[out=90, in=90]node[pos=.7](M){}(B);
\draw[->, looseness=1.5](M.center)to[out=60, in=0](E.east);
\end{tikzpicture}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .