![halbwörtlich mit Tikz in Beamer](https://rvso.com/image/286343/halbw%C3%B6rtlich%20mit%20Tikz%20in%20Beamer.png)
Ich verwende semiverbatim
mit tikz
in beamer
. Mein folgender MWE gibt einen Fehler aus:
! Paket tikz-Fehler: Entschuldigung, ein Paket hat die Bedeutung des Dollarzeichens im Mathematikmodus neu definiert. Dies ist nicht kompatibel mit tikz und seiner Calc-Bibliothek und kann zu nicht behebbaren Fehlern führen.
Irgendeine Idee zur Lösung dieses Problems? Vielen Dank im Voraus.
\documentclass{beamer}
\usepackage{csed}
\usepackage{tikz}
\usetikzlibrary{shapes}
\newif\ifshowanimation
% The slides with animations take a long time to process.
% They are omitted in handout mode.
\showanimationfalse
\newenvironment<>{exercise}{\begin{block}#1{Exercise}}{\end{block}}
\newenvironment<>{notes}{\begin{alertblock}#1{Notes}}{\end{alertblock}}
\newcommand*{\menu}[1]{\textbf{#1}}
\newcommand*{\menuitem}[1]{\,$\to$\,\textbf{#1}}
\definecolor{highlight1}{named}{yellow}
\definecolor{highlight2}{named}{pink}
\definecolor{highlight3}{named}{green}
\definecolor{highlight4}{named}{orange}
\definecolor{Red}{named}{red}
\definecolor{Blue}{named}{blue}
\pgfdeclareimage[width=0.95\textwidth]{backdrop}{images/background.jpg}
\pgfdeclareimage[width=1mm]{pointer}{images/pointer.png}
\pgfdeclareimage[width=0.18\textwidth]{startmenu}{images/startMenu.jpg}
\pgfdeclareimage[width=0.34\textwidth]{programsmenu}{images/programsMenu.jpg}
\pgfdeclareimage[width=0.495\textwidth]{submenu}{images/subMenu.jpg}
\pgfdeclareimage[width=0.608\textwidth]{latexmenu}{images/latexMenu.jpg}
\pgfdeclareimage[width=0.591\textwidth]{latexmenu2}{images/latexMenu2.png}
\pgfdeclareimage[width=0.591\textwidth]{cmd1}{images/cmd1.jpg}
\pgfdeclareimage[width=0.591\textwidth]{cmd2}{images/cmd2.jpg}
\foreach \x in {1,...,46}
{
\pgfdeclareimage[width=0.84\textwidth]{tmkwin\x}{images/tmkwin-\x.jpg}
}
\pgfdeclareimage[width=0.75\textwidth]{saveAs1}{images/tex-28.jpg}
\pgfdeclareimage[width=0.75\textwidth]{saveAs2}{images/tex-30.jpg}
\pgfdeclareimage[width=0.75\textwidth]{saveAs3}{images/tex-32.jpg}
\pgfdeclareimage[width=0.75\textwidth]{saveAs4}{images/tex-35.jpg}
\pgfdeclareimage[width=0.75\textwidth]{saveAs5}{images/tex-36.jpg}
\pgfdeclareimage[width=0.75\textwidth]{saveAs6}{images/tex-37.jpg}
\begin{document}
\begin{frame}[fragile]
\frametitle{A Simple Document}
\begin{example}
\begin{semiverbatim}
\textcolor<2>{Red}{\cs{documentclass}\annote<5-7>[offset=0.5in,voffset=1cm,pos=br,bg=highlight2]{[a4paper,12pt]}{Class options}\annote<4-7>[pos=br,bg=highlight1]{\marg{article}}{The class name.}}
\vspace{-2\baselineskip}\alt<7>{\colorbox{highlight4}{\rmfamily Preamble}}{\strut}
\textcolor<2>{Red}{\cs{begin}\marg{document}}
\textcolor<3>{Blue}{\% This is a comment}
\annote<6-7>[pos=cr,bg=highlight3,offset=0.4in]{\begin{tabular}{@{}l}
This is a simple\\
document\cs{footnote}\marg{with a footnote}.\\
\\
This is a new paragraph.
\end{tabular}}{The document.}
\textcolor<2>{Red}{\cs{end}\marg{document}}
\end{semiverbatim}
\end{example}
\end{frame}
\end{document}
Herausgegeben
csed
erhältlich beiHier.
Antwort1
Dies war zu lang für einen Kommentar.
Die Fehlermeldung wird ausgelöst durch \tikz@ensure@dollar@catcode
die Datei, die tikz.code.tex
normalerweise auf zu finden ist .../tex/generic/pgf/frontendlayer/tikz/tikz.code.tex
. Eine Möglichkeit besteht darin, die Fehlermeldung zu deaktivieren mit
\makeatletter
\global\let\tikz@ensure@dollar@catcode=\relax
\makeatother
Dies kann an anderer Stelle im Dokument zu unerwünschten Ergebnissen führen, führt aber zumindest mit Ihrem Beispielcode zum gewünschten Ergebnis:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{shapes}
\usepackage{csed}
\makeatletter
\global\let\tikz@ensure@dollar@catcode=\relax
\makeatother
\newif\ifshowanimation
% The slides with animations take a long time to process.
% They are omitted in handout mode.
%\showanimationfalse
\newenvironment<>{exercise}{\begin{block}#1{Exercise}}{\end{block}}
\newenvironment<>{notes}{\begin{alertblock}#1{Notes}}{\end{alertblock}}
\newcommand*{\menu}[1]{\textbf{#1}}
\newcommand*{\menuitem}[1]{\,$\to$\,\textbf{#1}}
\definecolor{highlight1}{named}{yellow}
\definecolor{highlight2}{named}{pink}
\definecolor{highlight3}{named}{green}
\definecolor{highlight4}{named}{orange}
\definecolor{Red}{named}{red}
\definecolor{Blue}{named}{blue}
\pgfdeclareimage[width=0.95\textwidth]{backdrop}{images/background.jpg}
\pgfdeclareimage[width=1mm]{pointer}{images/pointer.png}
\pgfdeclareimage[width=0.18\textwidth]{startmenu}{images/startMenu.jpg}
\pgfdeclareimage[width=0.34\textwidth]{programsmenu}{images/programsMenu.jpg}
\pgfdeclareimage[width=0.495\textwidth]{submenu}{images/subMenu.jpg}
\pgfdeclareimage[width=0.608\textwidth]{latexmenu}{images/latexMenu.jpg}
\pgfdeclareimage[width=0.591\textwidth]{latexmenu2}{images/latexMenu2.png}
\pgfdeclareimage[width=0.591\textwidth]{cmd1}{images/cmd1.jpg}
\pgfdeclareimage[width=0.591\textwidth]{cmd2}{images/cmd2.jpg}
\foreach \x in {1,...,46}
{
\pgfdeclareimage[width=0.84\textwidth]{tmkwin\x}{images/tmkwin-\x.jpg}
}
\pgfdeclareimage[width=0.75\textwidth]{saveAs1}{images/tex-28.jpg}
\pgfdeclareimage[width=0.75\textwidth]{saveAs2}{images/tex-30.jpg}
\pgfdeclareimage[width=0.75\textwidth]{saveAs3}{images/tex-32.jpg}
\pgfdeclareimage[width=0.75\textwidth]{saveAs4}{images/tex-35.jpg}
\pgfdeclareimage[width=0.75\textwidth]{saveAs5}{images/tex-36.jpg}
\pgfdeclareimage[width=0.75\textwidth]{saveAs6}{images/tex-37.jpg}
\begin{document}
\begin{frame}
\frametitle{A Simple Document}
\begin{example}
\begin{semiverbatim}
\textcolor<2>{Red}{\cs{documentclass}\annote<5-7>[offset=0.5in,voffset=1cm,pos=br,bg=highlight2]{[a4paper,12pt]}{Class options}\annote<4-7>[pos=br,bg=highlight1]{\marg{article}}{The class name.}}
\vspace{-2\baselineskip}\alt<7>{\colorbox{highlight4}{\rmfamily Preamble}}{\strut}
\textcolor<2>{Red}{\cs{begin}\marg{document}}
\textcolor<3>{Blue}{\% This is a comment}
\annote<6-7>[pos=cr,bg=highlight3,offset=0.4in]{\begin{tabular}{@{}l}
This is a simple\\
document\cs{footnote}\marg{with a footnote}.\\
\\
This is a new paragraph.
\end{tabular}}{The document.}
\textcolor<2>{Red}{\cs{end}\marg{document}}
\end{semiverbatim}
\end{example}
\end{frame}
\end{document}
Wie ich bereits sagte, hat dies den Status eines langen Kommentars und nicht einer Antwort, da es lediglich die Fehlermeldung deaktiviert.