3

While using quotes, I get the error

ERROR: Argument of \language@active@arg" has an extra }.

from

\documentclass{article}

\usepackage[spanish]{babel}
\usepackage{subcaption}
\usepackage{tikz}
\usetikzlibrary{quotes}
\usetikzlibrary{babel}

\begin{document}
\begin{figure}
  \subcaptionbox{foo} {
    \tikz \node ["bar"] {};
  }
\end{figure}
\end{document}

I don't know what I'm doing wrong.

  • Welcome to TeX.SE! I must say that so far I never used that syntax even though it can be found in the pgfmanual. What I want to say is that \tikz{\node[label=bar] {};} does the same and doesn't cause any issues. So perhaps you may use that instead. – user121799 Sep 6 '18 at 1:55
  • Does it help if you load babel after loading the babel library? – cfr Sep 6 '18 at 2:20
1

This is an expansion problem for material that is in the argument of a macro.

\newcommand{\x}[1]{#1}
\x{\tikz \node ["bar"] {};}

produces the same error with your collection of packages (with or without subcaption), where as

\tikz \node ["bar"] {};

on its own works fine. In your case you are putting the \tikz code in the second argument of the \subcaption command.

A workaround is just to use \node [label={bar}] instead of \node["bar"] (and \node [label={[red]bar] instead of \node["bar" red]).

Sample output

\documentclass{article}

\usepackage[spanish]{babel}
\usepackage{subcaption}
\usepackage{tikz}
\usetikzlibrary{quotes}
\usetikzlibrary{babel}

\begin{document}

\begin{figure}
  \subcaptionbox{foo} {
  \tikz \node [label={bar}] {};
  }
\end{figure}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.