scaleboxed 테이블에 tikz 화살표 사용

scaleboxed 테이블에 tikz 화살표 사용

이에 따라 우편. 테이블에 화살표를 사용하고 싶습니다. 하지만 내 테이블이 너무 커서 scalebox. 하지만 ed 테이블 tikzmark의 a 위치를 사용했는데 scalebox위치가 잘못되었습니다. tikzmark테이블이 편집되기 전의 요점을 기억하는 것 같습니다 scalebox.

이 문제에 대한 해결책이 있습니까?

예는 다음과 같습니다.

\documentclass[pdf]{beamer}
\mode<presentation>{}
\usepackage[english]{babel}
\usepackage{color, colortbl}
\usepackage{tikz}
\usetikzlibrary{tikzmark, positioning, fit, shapes.misc}

\usetikzlibrary{decorations.pathreplacing, calc}

\tikzset{brace/.style={decorate, decoration={brace}},
  brace mirrored/.style={decorate, decoration={brace,mirror}},
}

\newcolumntype{g}{>{\columncolor{red}}c}

\begin{document}
  \begin{frame}
    \begin{tabular}{ | l | l |}
      \hline
      letter & number \\ \hline
      \tikzmark{x}A &  1\tikzmark{a} \\ \hline
      A &  2 \\ \hline
      \tikzmark{y}A &  1\tikzmark{b} \\ \hline
      \tikzmark{w}B &  1 \\ \hline
      \tikzmark{z}B &  2 \\ \hline
    \end{tabular}
    \begin{tikzpicture}[remember picture, overlay]
      \draw ($(pic cs:a) + (3.5em,0)$) edge[bend left=60,-stealth] ($(pic cs:b) + (3.5em,0)$) node [midway, right, xshift=5pt, yshift=5pt] {Duplicate};
      \draw[brace mirrored, thick] ($(pic cs:x) + (-8pt,1ex)$)--($(pic cs:y) + (-8pt,-1ex)$) node [midway, left] {A};
      \draw[brace mirrored, thick] ($(pic cs:w) + (-8pt,1ex)$)--($(pic cs:z) + (-8pt,-1ex)$) node [midway, left] {B};
    \end{tikzpicture}

    \tikzset{
      every picture/.style={remember picture,baseline},
      every node/.style={
        inner sep=0pt,
        anchor=base,
        minimum width=1.8cm,
        align=center,
        text depth=.25ex,
        outer sep=1.5pt},
      every path/.style={
        thick,
        rounded corners
      }
    }

    \begin{table}
\scalebox{0.7}{
     \centering

\begin{tabular}{|c|c|c|g|c|}
        \hline
        bla   &  bla  & bla   & $b_1$\tikzmark{c}\\
        bla   &  bla  & bla   & bla \\\hline
        bla   &  bla  & bla   & bla \\\hline
        bla   &  bla  & bla   & bla \\\hline
        bla   &  bla  & bla   & bla \\\hline
      \end{tabular}
}
    \end{table}

    \begin{tikzpicture}[remember picture,overlay]
      \node [right=2cm,above=2cm,minimum width=0pt] at ({pic cs:c}) (A) {A};
      \draw [<-,out=5,in=180] ([xshift=0pt]{pic cs:c}) to (A);
    \end{tikzpicture}

  \end{frame}

\end{document}

답변1

오래된 질문이지만 여기에 두 가지 잠재적인 해결 방법이 있습니다. 두 가지 모두 \scalebox.

  1. \tabcolsep. 대신 글꼴 크기 및/또는 를 줄여 테이블 크기를 줄입니다 \scalebox. 그러면 \tikzmark잘 작동합니다.

  2. 옵션을 사용하여 TikZ tabular에 배치 하고 노드 앵커를 기준으로 화살표를 그립니다. 하지만 화살표의 끝점을 수동으로 파악해야 하기 때문에 솔루션 만큼 편리하지는 않습니다 .nodescale=X\tikzmark

여기에 이미지 설명을 입력하세요

\documentclass[pdf]{beamer}
\mode<presentation>{}
\usepackage[english]{babel}
\usepackage{color, colortbl}
\usepackage{tikz}
\usetikzlibrary{tikzmark, positioning, fit, shapes.misc}

\usetikzlibrary{decorations.pathreplacing, calc}

\tikzset{brace/.style={decorate, decoration={brace}},
  brace mirrored/.style={decorate, decoration={brace,mirror}},
}

\newcolumntype{g}{>{\columncolor{red}}c}

\begin{document}
\begin{frame}
    \begin{tabular}{ | l | l |}
        \hline
        letter        & number        \\ \hline
        \tikzmark{x}A & 1\tikzmark{a} \\ \hline
        A             & 2             \\ \hline
        \tikzmark{y}A & 1\tikzmark{b} \\ \hline
        \tikzmark{w}B & 1             \\ \hline
        \tikzmark{z}B & 2             \\ \hline
    \end{tabular}
    \begin{tikzpicture}[remember picture, overlay]
        \draw ($(pic cs:a) + (3.5em,0)$) edge[bend left=60,-stealth] ($(pic cs:b) + (3.5em,0)$) node [midway, right, xshift=5pt, yshift=5pt] {Duplicate};
        \draw[brace mirrored, thick] ($(pic cs:x) + (-8pt,1ex)$)--($(pic cs:y) + (-8pt,-1ex)$) node [midway, left] {A};
        \draw[brace mirrored, thick] ($(pic cs:w) + (-8pt,1ex)$)--($(pic cs:z) + (-8pt,-1ex)$) node [midway, left] {B};
    \end{tikzpicture}

    \tikzset{
        every picture/.style={remember picture,baseline},
        every node/.style={
                inner sep=0pt,
                anchor=base,
                minimum width=1.8cm,
                align=center,
                text depth=.25ex,
                outer sep=1.5pt},
        every path/.style={
                thick,
                rounded corners
            }
    }

    \begin{table}
        \scriptsize % or \tiny or \footnotesize
        \setlength\tabcolsep{2pt}
        \centering

        \begin{tabular}{|c|c|c|g|c|}
            \hline
            bla & bla & bla & $b_1$\tikzmark{c} \\
            bla & bla & bla & bla               \\\hline
            bla & bla & bla & bla               \\\hline
            bla & bla & bla & bla               \\\hline
            bla & bla & bla & bla               \\\hline
        \end{tabular}
    \end{table}

    \begin{tikzpicture}[remember picture,overlay]
        \node [right=2cm,above=2cm,minimum width=0pt] at ({pic cs:c}) (A) {A};
        \draw [<-,out=5,in=180] ([xshift=0pt]{pic cs:c}) to (A);
    \end{tikzpicture}

\end{frame}

\begin{frame}
    \begin{tabular}{ | l | l |}
        \hline
        letter         & number         \\ \hline
        \tikzmark{x2}A & 1\tikzmark{a2} \\ \hline
        A              & 2              \\ \hline
        \tikzmark{y2}A & 1\tikzmark{b2} \\ \hline
        \tikzmark{w2}B & 1              \\ \hline
        \tikzmark{z2}B & 2              \\ \hline
    \end{tabular}
    \begin{tikzpicture}[remember picture, overlay]
        \draw ($(pic cs:a2) + (3.5em,0)$) edge[bend left=60,-stealth] ($(pic cs:b2) + (3.5em,0)$) node [midway, right, xshift=5pt, yshift=5pt] {Duplicate};
        \draw[brace mirrored, thick] ($(pic cs:x2) + (-8pt,1ex)$)--($(pic cs:y2) + (-8pt,-1ex)$) node [midway, left] {A};
        \draw[brace mirrored, thick] ($(pic cs:w2) + (-8pt,1ex)$)--($(pic cs:z2) + (-8pt,-1ex)$) node [midway, left] {B};
    \end{tikzpicture}

    \tikzset{
        every picture/.style={remember picture,baseline},
        every node/.style={
                inner sep=0pt,
                anchor=base,
                minimum width=1.8cm,
                align=center,
                text depth=.25ex,
                outer sep=1.5pt},
        every path/.style={
                thick,
                rounded corners
            }
    }

    \begin{table}
        \centering

        \begin{tikzpicture}
            \node [inner sep=0pt,scale=0.7] (table) {%
                \begin{tabular}{|c|c|c|g|c|}
                    \hline
                    bla & bla & bla & $b_1$ \\
                    bla & bla & bla & bla   \\\hline
                    bla & bla & bla & bla   \\\hline
                    bla & bla & bla & bla   \\\hline
                    bla & bla & bla & bla   \\\hline
                \end{tabular}};

            \begin{scope}[overlay]
                \node [right=2cm,above=2cm,minimum width=0pt] at (table.north east) (A) {A};
                \draw [<-,out=5,in=180] ([xshift=-5pt,yshift=-8pt]table.north east) to (A);
            \end{scope}
        \end{tikzpicture}
    \end{table}

\end{frame}

\end{document}

관련 정보