tikz 基线内带有节点的多行文本

tikz 基线内带有节点的多行文本

我希望在TikZ基线框架内有多行文本。我尽量让自己清楚。这是示例:

\documentclass{beamer}

\usepackage[utf8]{inputenc}
\usetheme{default}


\usepackage{tikz}

\usetikzlibrary{arrows,shapes,mindmap,trees,backgrounds}
\tikzstyle{every picture}+=[remember picture]
\tikzstyle{na} = [baseline=-.5ex]
\tikzset{
    invisible/.style={opacity=0,text opacity=0},
    visible on/.style={alt=#1{}{invisible}},
    alt/.code args={<#1>#2#3}{%
      \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}
    },
}

\tikzset{
  background fill/.style={fill=#1},
  background fill/.default={white},
  fill on/.style={alt=#1{}{background fill}},
}

\tikzset{
  background draw/.style={draw=#1},
  background draw/.default={white},
  draw on/.style={alt=#1{}{background draw}},
}
%
\tikzset{
  background filldraw/.style 2 args={draw=#1, fill=#2},
  background filldraw/.default={white}{white},
  filldraw on/.style={alt=#1{}{background filldraw}},
}


\newcommand{\tikzmark}[1]{\tikz[remember picture] \node[coordinate] (#1) {#1};}

\setbeamerfont{caption}{size=\tiny}
\setlength\abovecaptionskip{0pt}
\setbeamertemplate{caption}[numbered]

\usetikzlibrary{positioning, shapes.arrows,shadows.blur}
\usetikzlibrary{arrows,shapes,backgrounds}
\usepackage{verbatim}


\begin{document}


\begin{frame}


 \tikz[baseline]{ \node[background filldraw={green}{white!10},filldraw on=<1->,anchor=base,rounded corners,visible on=<1->] (t1) { Test Test \newline Test Test Test Test Test Test Test Test};}


\end{frame}
\end{document}

这是我得到的:

在此处输入图片描述

但是,我希望文本有多行。我尝试过\newline\\,但似乎不起作用。

我想使用它,\tikz[baseline]因为我必须将文本链接到一个等式。

答案1

在节点中使用\\选项。align

\documentclass{beamer}
\usepackage{tikz}

\begin{document}
\begin{frame}    
\tikz[baseline]{ \node[draw=black, align=center] (t1) { Test Test \\ Test Test Test Test Test Test Test Test};}    
\end{frame}
\end{document}

在此处输入图片描述

参考:https://tex.stackexchange.com/a/124114/133968

相关内容