I'm working on a LaTeX beamer presentation where I'd like to add a notes section below each \item heading which simply copies its text. For example I have
\begin{frame}{Frame Title}
\begin{itemize}[<+->]
\item Einstein was a clever man.
\item My favorite equation is,
\begin{equation}
E = m c^2.
\end{equation} where
\begin{enumerate}
\item $m$ is the mass,
\item $c$ the velocity of light and,
\item $E$ is the energy.
\end{enumerate}
\end{itemize}
\end{frame}
and I would like to have
\begin{frame}{Frame Title}
\begin{itemize}[<+->]
\item Einstein was a clever man.
\note<.>[item]{
Einstein was a clever man.
}
\item My favorite equation is,
\begin{equation}
E = m c^2.
\end{equation} where
\begin{enumerate}
\item $m$ is the mass,
\item $c$ the velocity of light and,
\item $E$ is the energy.
\end{enumerate}
\note<.>[item] {
My favorite equation is,
\begin{equation}
E = m c^2.
\end{equation where
\begin{enumerate}
\item $m$ is the mass,
\item $c$ the velocity of light and,
\item $E$ is the energy.
\end{enumerate}
}
\end{itemize}
\end{frame}
How can I do this in vim, or using command line tools like awk or sed?
Via vim I'm able to copy-and-append isolated lines starting with the pattern \item via
:g/^\\item/ copy . | s//\\note\{item\}<.>\{/g
but I'm unable to capture the whole block belonging to each top-level \item.