I am trying to adapt the second solution of "Label variables of the equation using Tikz without using itemize
" to my equation, P_t= P_T G_T G_t H_f
.
The code is the following:
\documentclass{beamer}
\usetheme[progressbar=frametitle]{metropolis}
\setbeamertemplate{frame numbering}[fraction]
\useoutertheme{metropolis}
\useinnertheme{metropolis}
\usefonttheme{metropolis}
\usecolortheme{spruce}
\setbeamercolor{background canvas}{bg=white}
\definecolor{mygreen}{rgb}{.125,.5,.25}
\usecolortheme[named=mygreen]{structure}
\setbeamercovered{transparent=15}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{positioning}
\tikzset{>=stealth}
\newcommand{\tikzmark}[3][]{\tikz[overlay,remember picture,baseline] \node [anchor=base,#1](#2) {#3};}
\begin{document}
\begin{frame}[t]{Channel model}
\begin{itemize}
\item<1-> The power coupled into the IC, $P_t$ is
\end{itemize}
\begin{equation*}
P_t = \tikzmark{identity}{P_T} \tikzmark[red]{G}{G_T}\,
\tikzmark[blue]{L}{G_t} \tikzmark[purple]{C}{H_f}
\end{equation*}
\begin{tikzpicture}[overlay, remember picture,node distance =1.5cm]
\node (identitydescr) [below left=of identity ]{transmitted power of the sender};
\draw[,->,thick] (identitydescr) to [in=-90,out=90] (identity);
\node[red] (Gdescr) [below =of G]{gain of the transmitter antenna};
\draw[red,->,thick] (Gdescr) to [in=-90,out=90] (G);
\node[blue,xshift=1cm] (Ldescr) [above right =of L]{gain of the box antenna};
\draw[blue,->,thick] (Ldescr) to [in=45,out=-90] (L.north);
\node[purple] (Cdescr) [below right =of C]{attenuation of the transmitted power};
\draw[purple,->,thick] (Cdescr) to [in=-90,out=90] (C.south);
\end{tikzpicture}
\end{frame}
\end{document}
But it does not work as the linked solution above does. There seem to be several problems in the code, like tikzmark
does not work with math like G_T
. Besides, the labels can not break in several lines. I have tried \\
but it does not work.
I would also like to be able to place the tikzpicture
in some part below the text. Now it overlies the first text line, or if I put the tikzpicture
into the itemize environment, the arrows and labels appear displaced.
I would like to know how to control the bend and position of the arrows specified with the in and out angles.
Regards
Best Answer
There are a couple of problems:
If you want to use things like
P_T
in the\tikzmark
, you need math modeYour previous definition of
\tikzmark
containedoverlay
as option, this hides the width of the content, thus all your letters were superimposed.To get line breaks in your descriptions, you can use pass the
text width
option to the node.if you load the
metropolis
theme, there is no need to load its outer, inner and font themes a second time.And please don't listen to @marmot and accept his answer :)