2

I want to add parentheses around a tikzpicture. This post give a simple solution.

However, in my case it doesn't work well. As shown by the following MWE, parentheses add a blank space at the top of the 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}

enter image description here

How can I proceed to make parentheses fit around the tikz waveform, without the additional blank space?

Raoul722
  • 365
  • 1
  • 10

1 Answers1

4

baseline=(current bounding box.center) works better.

output

\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}
Torbjørn T.
  • 206,688