1

Tikz has some problems when used in conjunction with babel (like babel changing the character ", which tikz uses for some things), so there's a babel library to solve these issues. However, said library doesn't seem to work when your tikz picture is inside a frame environment. Here's a MWE:

\documentclass{beamer}
\usepackage[spanish]{babel}
\usepackage{tikz}
\usetikzlibrary{babel}
\usetikzlibrary{angles,quotes}
\begin{document}
%\begin{frame}
\begin{tikzpicture}
    \draw[->] (-0.5,0) -- (2.2,0)  node[right]{$x$};
    \draw[->] (0,-3.7) -- (0,0.5)  node[above]{$y$};
    \coordinate (Or) at (0,0);
    \coordinate (Pen) at (1.5,-3);
    \coordinate (aux) at (0,-2);
    \draw (Or) to (Pen);
    \fill (Pen) circle(3pt);
    \draw pic[draw,"$\theta$" shift={(0.9mm,-3.9mm)}]{angle=aux--Or--Pen};
    \end{tikzpicture}
%\end{frame}
\end{document} 

If I uncomment the frame enviroment, it gives the same errors as if I weren't using the babel library. An alternative to said library is to use \shorthandoff{"}, at the start of the tikz picture, but again, while this works normally, it doesn't work inside a frame for some reason. Anyone knows a solution to this?

2
  • 1
    Catcode problems (presumably, characters being turn into tokens too early by the frame environment, more specifically before the tikzpicture gets a chance to change the catcode of "). It works if you use \begin{frame}[fragile].
    – frougon
    Commented Jul 19, 2021 at 19:24
  • My option is normally to deactivate all special chars with github.com/latex3/babel/issues/38#issuecomment-559186376 .You can enter all Spanish chars directly with UTF-8. Ah, yes, add the T1 encoding...
    – Rmano
    Commented Jul 19, 2021 at 19:51

0

You must log in to answer this question.

Browse other questions tagged .