我想在 tikzpicture 周围添加括号。这个帖子给出一个简单的解决方案。
但是,在我的情况下,它效果不佳。如下面的 MWE 所示,括号在 tikzpicture 顶部添加了一个空白:
\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\frame{
\frametitle{test}
\[ \left( \begin{tikzpicture}[baseline=-\the\fontdimen22\textfont2,
declare function={
excitation(\t,\w) = sin(\t*\w);
noise = rnd - 0.5;
source(\t) = excitation(\t,20) + noise;
filter(\t) = 1 - abs(sin(mod(\t, 50)));
speech(\t) = 1 + source(\t)*filter(\t);
}
]
\draw[orange, thick, x=0.0085cm, y=-.5cm] (0,1) -- plot [domain=0:360, samples=144, smooth] (\x,{speech(\x)});
\end{tikzpicture} \right)
\]
}
\end{document}
我怎样才能让括号适合 tikz 波形,没有额外的空格?
答案1
baseline=(current bounding box.center)
效果更好。
\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}
\frametitle{test}
\[ \left( \begin{tikzpicture}[baseline=(current bounding box.center),
declare function={
excitation(\t,\w) = sin(\t*\w);
noise = rnd - 0.5;
source(\t) = excitation(\t,20) + noise;
filter(\t) = 1 - abs(sin(mod(\t, 50)));
speech(\t) = 1 + source(\t)*filter(\t);
}
]
\draw[orange, thick, x=0.0085cm, y=-.5cm] (0,1) -- plot [domain=0:360, samples=144, smooth] (\x,{speech(\x)});
\end{tikzpicture} \right)
\]
\end{frame}
\end{document}