调整 tikZ 图片大小

调整 tikZ 图片大小

我已将 tikZ 图片放在 之间\begin{figure} and \end{figure}。我需要将其放大。问题是,当我缩放它时,它看起来一点也不好看。这是代码:

\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}

有什么帮助吗?谢谢!

答案1

正如 Joule V 提到的,你可以玩把桌子弄大一点的游戏。其中一种方法是玩\arraystretch。问题是我可能误解了你想要什么。

\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}

在此处输入图片描述

相关内容