Search code examples
latexfigurebeamertikz

Latex beamer error: argument of \language@active@arg" has an extra }. \end{frame}


I'm trying to put together a presentation using latex beamer. I drew a triangle using the tikz package but I can't put the names on the angles. When executing the code, the following error appears: "Argument of \language@active@arg" has an extra }. \end{frame}"

The code is:

\documentclass[xcolor=dvipsnames,10pt,serif]{beamer} % serif, mathserif

\usepackage[english,brazil]{babel}         
\usepackage[utf8]{inputenc}     
\usepackage[T1]{fontenc}        
\usepackage{ae}                      

\setbeamertemplate{caption}[numbered]
\setlength\abovecaptionskip{-3pt}
\setbeamertemplate{caption}[numbered]
\setbeamerfont{caption}{size=\scriptsize}
\usefonttheme[onlymath]{serif}

\usepackage{color}
\usepackage{amsmath}              
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amstext}
\usepackage{mathrsfs}              
\usepackage{icomma}                 
\usepackage{bm}                    
\usepackage{steinmetz}
\usepackage{tikz}
\usepackage{adjustbox}

\usepackage{subfigure}
\usepackage{ragged2e}
\usepackage{tkz-euclide}
\usetikzlibrary{angles,quotes,babel}

\DeclareMathOperator{\sen}{sen}  

\mode<presentation>
{
    \usetheme{CambridgeUS}
}
\begin{document}

\begin{frame}{Frame Title}
        \begin{figure}
            \begin{tikzpicture}
                \coordinate (C) at (-1.5,-1);
                \coordinate (A) at (1.5,-1);
                \coordinate (B) at (1.5,1);
                \coordinate (D) at (1.5,-3);
                \node [below] at (3,-1) {$\Re$};
                \node [above] at (-1.5,2) {$\Im$}; 
        
                %draw cartesian plane
                \draw[stealth-stealth] (-1.5,-4) -- (-1.5,2) coordinate (y axis);
                \draw[-stealth] (C) -- (3,-1) coordinate (x axis);
                
                \draw[very thick,-{Stealth[length=3mm, width=1.5mm]}] (C) -- 
                    node[font=\Large,sloped,above] {$S_{abc}$} (B);
                \draw[very thick,-{Stealth[length=3mm, width=1.5mm]}](A) -- 
                    node[font=\Large,pos=0.7,right] {$Q_{abc}$} (B);
                \draw[very thick,-{Stealth[length=3mm, width=1.5mm]}](C) -- 
                    node[font=\Large,pos=0.8,above] {$P_{abc}$} (A);
                \draw[very thick,-{Stealth[length=3mm, width=1.5mm]}](C) -- 
                    node[font=\Large,sloped,below] {$S_{abc}$} (D);
                \draw[very thick,{Stealth[length=3mm, width=1.5mm]}-](D)-- 
                    node[font=\Large,pos=0.3,right] {$-Q_{abc}$} (A) ;
                
                \pic[thick,"$\theta$", draw=blue,-stealth, angle eccentricity=1.2, angle radius=1cm]
                {angle=A--C--B};
                \pic[thick,"$\theta$", draw=red, stealth-, angle eccentricity=1.2, angle radius=0.9cm]
                {angle=D--C--A};
            \end{tikzpicture}
        \end{figure}
\end{frame}

\end{document}

Can anybody help me?


Solution

  • If you have fragile content in your frame, like certain tikz pictures, use the fragile frame option.

    Some other comments:

    • the serif class option is obsolete. A warning in the log file will tell you to use the serif font theme instead, but as you already do this, there is really no reason to use this class option

    • if your tex distribution isn't terrible outdated, you no longer need \usepackage[utf8]{inputenc}

    • there are two \setbeamertemplate{caption}[numbered]

    • you don't need color and the ams* packages, beamer already loads them for you


    \documentclass[xcolor=dvipsnames,10pt]{beamer} % serif, mathserif
    
    \usepackage[english,brazil]{babel}         
    %\usepackage[utf8]{inputenc}     
    \usepackage[T1]{fontenc}        
    \usepackage{ae}                      
    
    \setbeamertemplate{caption}[numbered]
    \setlength\abovecaptionskip{-3pt}
    %\setbeamertemplate{caption}[numbered]
    \setbeamerfont{caption}{size=\scriptsize}
    \usefonttheme[onlymath]{serif}
    
    %\usepackage{color}
    %\usepackage{amsmath}              
    %\usepackage{amsfonts}
    %\usepackage{amssymb}
    %\usepackage{amstext}
    \usepackage{mathrsfs}              
    \usepackage{icomma}                 
    \usepackage{bm}                    
    \usepackage{steinmetz}
    \usepackage{tikz}
    \usepackage{adjustbox}
    
    \usepackage{subfigure}
    \usepackage{ragged2e}
    \usepackage{tkz-euclide}
    \usetikzlibrary{angles,quotes,babel}
    
    \DeclareMathOperator{\sen}{sen}  
    
    \mode<presentation>
    {
        \usetheme{CambridgeUS}
    }
    \begin{document}
    
    \begin{frame}[fragile]
    \frametitle{Frame Title}
            \begin{figure}
                \begin{tikzpicture}
                    \coordinate (C) at (-1.5,-1);
                    \coordinate (A) at (1.5,-1);
                    \coordinate (B) at (1.5,1);
                    \coordinate (D) at (1.5,-3);
                    \node [below] at (3,-1) {$\Re$};
                    \node [above] at (-1.5,2) {$\Im$}; 
            
                    %draw cartesian plane
                    \draw[stealth-stealth] (-1.5,-4) -- (-1.5,2) coordinate (y axis);
                    \draw[-stealth] (C) -- (3,-1) coordinate (x axis);
                    
                    \draw[very thick,-{Stealth[length=3mm, width=1.5mm]}] (C) -- 
                        node[font=\Large,sloped,above] {$S_{abc}$} (B);
                    \draw[very thick,-{Stealth[length=3mm, width=1.5mm]}](A) -- 
                        node[font=\Large,pos=0.7,right] {$Q_{abc}$} (B);
                    \draw[very thick,-{Stealth[length=3mm, width=1.5mm]}](C) -- 
                        node[font=\Large,pos=0.8,above] {$P_{abc}$} (A);
                    \draw[very thick,-{Stealth[length=3mm, width=1.5mm]}](C) -- 
                        node[font=\Large,sloped,below] {$S_{abc}$} (D);
                    \draw[very thick,{Stealth[length=3mm, width=1.5mm]}-](D)-- 
                        node[font=\Large,pos=0.3,right] {$-Q_{abc}$} (A) ;
                    
                    \pic[thick,"$\theta$", draw=blue,-stealth, angle eccentricity=1.2, angle radius=1cm]
                    {angle=A--C--B};
                    \pic[thick,"$\theta$", draw=red, stealth-, angle eccentricity=1.2, angle radius=0.9cm]
                    {angle=D--C--A};
                \end{tikzpicture}
            \end{figure}
    \end{frame}
    
    \end{document}