# The babel library does not work with the \tikzset command inside the document environment

Here is an example with the angle option of the Straigth Barb arrow using the colon character :

\tikzset{>={Straight Barb[angle=60:2pt 3]}}


The error is

! Paragraph ended before \pgfarrowsfourparameters@ was complete.

\documentclass[french]{article}
\usepackage{babel,tikz}
\usetikzlibrary{arrows.meta,babel}
\begin{document}

% inside the environment document, babel library doesnt work
\tikzset{>={Straight Barb[angle=60:2pt 3]}}

\begin{tikzpicture}
\tikzset{>={Straight Barb[angle=60:2pt 3]}}
\draw[<->](0,0)--(2,0);

\end{tikzpicture}
\end{document}

• Of course not, I took the trouble to write a minimal example and you still have to look for problems where there are none. When the document is composed of several pages and several tikzpicture environments, it is better to assign the arrows globally and not locally. – AndréC Jun 10 at 17:59

When \tikzset is located in the preamble, the TikZ babel library works.

\documentclass[french]{article}
\usepackage{babel,tikz}
\usetikzlibrary{arrows.meta,babel}
% In the preamble, babel library work
\tikzset{>={Straight Barb[angle=60:2pt 3]}}

\begin{document}

\begin{tikzpicture}
\draw[<->](0,0)--(2,0);
\end{tikzpicture}

\end{document}


Inside the document environment, it is necessary to place \tikzset between the \shorthandoff{:} and \shorthandon{:}

\documentclass[french]{article}
\usepackage{babel,tikz}
\usetikzlibrary{arrows.meta,babel}

\begin{document}
% Between the command \shorthandoff{:} and \shorthandon{:}, no more problems
\shorthandoff{:}
\tikzset{>={Straight Barb[angle=60:2pt 3]}}
\shorthandon{:}

\begin{tikzpicture}
\tikzset{>={Straight Barb[angle=60:2pt 3]}}
\draw[<->](0,0)--(2,0);
\end{tikzpicture}

\end{document}


In both cases, we get:

• @AndréC TikZ has to parse input where some characters (here ,:) aren't the same from TeX's point of view for everyone (depending on use of the optional use of babel and the chosen language). I don't know the implementation, but this is not an easy situation. Back in the days, you couldn't even use \label{fig:foobar} in LaTeX with an active : character... Why don't you use \tikzset in the preamble if it works there? – frougon Jun 11 at 6:24
• @Rmano Do you mean shorthands=off? :-) – Javier Bezos Jun 11 at 12:01
• @AndréC Huh? You said yourself in your own answer that there is no problem when \tikzset is used in the preamble. Therefore, the sentence on page 70 (“Ilka has moved the style definition to the preamble by saying \tikzset{terminal/.style=...} (...)”) gives working advice according to your own sayings, as opposed to using \tikzset in the document environment outside any tikzpicture. – frougon Jun 11 at 18:22
• @AndréC You still haven't pointed any place in the manual suggesting to put \tikzset in a place where it might cause problems. On page 143, \tikzset is used inside the \tikzpicture environment; it works quite fine there even with [french]{babel}, as shown by this example: \documentclass[french]{article} \usepackage{babel,tikz} \usetikzlibrary{arrows.meta,babel} \begin{document} \begin{tikzpicture} \tikzset{>={Straight Barb[angle=60:2pt 3]}} \draw[<->](0,0)--(2,0); \end{tikzpicture} \end{document}. – frougon Jun 11 at 21:14
• @AndréC I have no problem. I didn't ask the question on this page. Never mind. – frougon Jun 11 at 21:42