1

I have put the tikZ picture between \begin{figure} and \end{figure}. I need to make it bigger. The thing is that when I scale it, it does not look good at all. This is the code:

\begin{figure}[H]
\centering
\begin{tabular}{rc}
& Movies \\
Users &
\begin{tabular}{ l | c | r }
    &      A    &   B  \\ \hline
    1 & $\tikzmarknode{a11}{r_{1A}}$~ & ~$\tikzmarknode{a12}{r_{1B}}$ \\ \hline
    2 & $\tikzmarknode{a21}{r_{2A}}$~  & ~$\tikzmarknode{a22}{r_{BA}}$ \\ \hline  
\end{tabular}  
\end{tabular}

\begin{tikzpicture}[overlay,remember picture]
 \draw[stealth-stealth,blue] (a11.north east) --  (a12.north west)
node[midway,above,scale=0.4,black] (dAB)    {\contour{white}{$d_{AB}$}};
\draw[-stealth,blue] (a21.south east) -- (a22.south   west);
\draw[-stealth,blue] (dAB.south) to[out=0,in=80] (dAB.south|-a22);
\draw[stealth-stealth] (a11.east) -- (a21.east)
node[pos=0.5,right,scale=0.4,black] (d12) {\contour{white}{$d_{12}$}};
\draw[-stealth] (d12.north) to[out=0,in=180] ([yshift=-1ex]a12.west);
\end{tikzpicture}
\end{figure}

Any help? Thank you!

  • 2
    I'm not with a compiler which can compile \tikzmarknode right now, but I think resizing the table (not the TikZ picture) would do the trick. – user156344 Apr 14 at 5:02
  • Note: you can confuse [remember picture] by playing with scale or rotate. – John Kormylo Apr 14 at 17:54
3

As Joule V is mentioning, you can play make the table bigger. One way of doing this is to play with \arraystretch. The problem is that I may misunderstand what you want.

\documentclass{article}
\usepackage{tikz}
\usepackage{array}
\usepackage{contour}
\contourlength{1pt}
\usetikzlibrary{tikzmark}
\begin{document}
\begin{figure}[htb]
\centering\renewcommand{\arraystretch}{2}
\begin{tabular}{rc}
& Movies \\
Users &\centering%\renewcommand{\arraystretch}{3}
\begin{tabular}{ l |>{\centering}p{1cm}| r }
    &      A    &   B  \\ \hline
    1 & $\tikzmarknode{a11}{r_{1A}}$~ & ~$\tikzmarknode{a12}{r_{1B}}$ \\ \hline
    2 & $\tikzmarknode{a21}{r_{2A}}$~  & ~$\tikzmarknode{a22}{r_{BA}}$ \\ \hline  
\end{tabular}  
\end{tabular}

\begin{tikzpicture}[overlay,remember picture]
 \draw[stealth-stealth,blue] (a11.north east) --  (a12.north west)
node[midway,above,scale=0.7,black] (dAB)    {\contour{white}{$d_{AB}$}};
\draw[-stealth,blue] (a21.south east) -- (a22.south   west);
\draw[-stealth,blue] (dAB.south) to[out=0,in=80] (dAB.south|-a22);
\draw[stealth-stealth] (a11.east) -- (a21.east)
node[pos=0.5,right,scale=0.7,black] (d12) {\contour{white}{$d_{12}$}};
\draw[-stealth] (d12.north) to[out=0,in=180] ([yshift=-1ex]a12.west);
\end{tikzpicture}
\end{figure}
\end{document}

enter image description here

  • Thank you! I will try your way. The thing is I don't want to compile it separated from the whole TeX document, meaning, compile it in a different file and then cut the pdf generated and use it as an image. I want to compile the whole thing! – NaveganTeX Apr 14 at 5:09

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.