1

I'm getting this error message

! Missing \endcsname inserted.
<to be read again> 
                   \theta 
l.18 \end{frame}

when compliling my .tex file:

\documentclass{beamer}
\usepackage[english,russian]{babel}
\usepackage{tikz}
\usetikzlibrary{angles,calc,quotes}
\begin{document}
\begin{frame}{Title}
\begin{tikzpicture}
\coordinate (A) at (2,0);
\coordinate (B) at (0,0);
\coordinate (C) at (1,2);
\draw (A) -- (B) -- (C);
\pic["$\theta_1$"{above=3, right=2}, draw=black, double, angle radius=8pt] {angle = A--B--C};
\end{tikzpicture}
\end{frame}
\end{document}

The error disappears if I turn off all shorthands when babel is loaded, i.e., \usepackage[english,russian,shorthands=off]{babel}. However, this is not a solution since it disables the shorthands in the entire document.

So, I suppose, my question boils down to the following: how to disable shorthands only inside the tikzpicture environment?

I have tried to adopt this answer in the following way:

\usepackage{etoolbox}
\AtBeginEnvironment{tikzpicture}{
  \shorthandoff{"}
}

but it also fails.

1 Answer 1

1

You can use the babel tikz library and combine this with a fragile frame:

\documentclass{beamer}
\usepackage[english,russian]{babel}
\usepackage{tikz}
\usetikzlibrary{angles,calc,quotes,babel}
\begin{document}
\begin{frame}[fragile]{Title}
\begin{tikzpicture}
\coordinate (A) at (2,0);
\coordinate (B) at (0,0);
\coordinate (C) at (1,2);
\draw (A) -- (B) -- (C);
\pic["$\theta_1$"{above=3, right=2}, draw=black, double, angle radius=8pt] {angle = A--B--C};
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .