节点和箭头的位置

节点和箭头的位置

我正在尝试重现这张幻灯片。我编写了一些代码来生成类似的东西,但节点的位置和箭头的类型很难获得。这就是我的目标

幻灯片显示所需箭头

这就是我所拥有的

当前幻灯片

这是我的代码:

\documentclass{beamer}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{xparse}%  For \NewDocumentCommand
\usepackage{calc}%    For the \widthof macro
\newcommand{\Text}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
    Sed accumsan nulla ac ipsum elementum interdum. }
\newcommand{\mytikzmark}[1]{\tikz[overlay,remember picture] \node[baseline] (#1) {};}
\usepackage{graphicx} % Allows including images
\usepackage[skins,raster]{tcolorbox}


\begin{document}
\begin{frame}{Line and Marker Options}
\begin{itemize}
\item Everything on a line can be customized
\end{itemize}
\begin{figure}[h]

\begin{tikzpicture}[remember picture,]

%\draw[help lines] (0,0) grid (2,3);

\coordinate  (origin) at (0,0);

%\node at (origin) {*};

\coordinate  (text1) at (3.5,3);


\node  [text width=8.0cm,]at (text1) {\scriptsize{\fontseries{b}\texttt{\textcolor{blue}{ 
{>>  plot(x,y,\lq --s', \lq LineWidth',2,\dots\\
\mytikzmark{block1a}{\lq}\mytikzmark{block1b}{C}olor',[1 0 0],\dots\\
\mytikzmark{block2a}{\lq Marker} \mytikzmark{block2b}{Edge}Color',\lq k',\dots\\
\lq MarkerFaceColor',\lq g',\dots \\
\lq MarkerSize',10)
}}}}};

\node [text width=4.5cm, anchor=west] at (-4, 1) (blocka1) {You can set colors by using a vector [RGB] values or a predefined color character like \lq g',\lq k',etc.};

\draw[black,-stealth, thick, shorten >= 0.5ex, shorten <= -0.5ex] (blocka1) -- ($(block1a)!0.5!(block1b)$);
\draw[black,-stealth, thick, shorten >= 0.5ex, shorten <= -0.5ex] (blocka1) -- ($(block2a)!0.5!(block2b)$);
\node[inner sep=0pt] (russell) at (5,0)
    {\includegraphics[width=.4\textwidth]{fig4.png}};

\draw[<-,thick] (russell.north) -- (text1.south east);
\end{tikzpicture}
\end{figure}
\begin{itemize}
\item See \textcolor{orange}{doc line\_props} for a full list of properties that can be specified. 
\end{itemize}
\end{frame}
\end{document}

答案1

您可以\subnode使用tikzmark

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc,tikzmark,arrows.meta}
\usepackage{xparse}%  For \NewDocumentCommand
\usepackage{calc}%    For the \widthof macro
\newcommand{\Text}{Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  Sed accumsan nulla ac ipsum elementum interdum. }
\usepackage[skins,raster]{tcolorbox}

\begin{document}
  \begin{frame}{Line and Marker Options}
    \begin{itemize}
      \item Everything on a line can be customized
    \end{itemize}
    \begin{figure}[h]
      \begin{tikzpicture}[remember picture,]
        \coordinate  (origin) at (0,0);
        \coordinate  (text1) at (3.5,3);
        \node  [text width=8.0cm,]at (text1) {%
          \scriptsize{%
            \bfseries\texttt{\textcolor{blue}{%
                {>>  plot(x,y,\lq --s', \lq LineWidth',2,\dots\\
                  \subnode{block1a}{\lq {C}olor',[1 0 0],\dots}
                  \subnode{block2a}{\lq Marker {Edge}Color',\lq k',\dots}
                  \lq MarkerFaceColor',\lq g',\dots\\
                  \lq MarkerSize',10)
                }}}}};
        \node [text width=4.5cm, anchor=west] at (-4, 1) (blocka1) {You can set colors by using a vector [RGB] values or a predefined color character like \lq g',\lq k',etc.};
        \draw[black,-stealth, thick, ] (blocka1.north) -- ([yshift=-.5em]block1a.west);
        \draw[black,-stealth, thick, ] (blocka1.north) -- ([yshift=-.5em]block2a.west);
        \node[inner sep=0pt] (russell) at (5,0) {\includegraphics[width=.4\textwidth]{example-image-a}};
        \draw [{Triangle[open, length=5mm, width=10mm]}-{Butt Cap[]}, thick, double distance=4mm, rounded corners=5mm, postaction={draw, {}-{}, white, line width=4mm, shorten <=4mm, shorten >=.8pt}] (russell.north) |- (text1.south east);
      \end{tikzpicture}
    \end{figure}
    \begin{itemize}
      \item See \textcolor{orange}{doc line\_props} for a full list of properties that can be specified.
    \end{itemize}
  \end{frame}
\end{document}

子节点

相关内容