如果使用俄语、德语、西班牙语或葡萄牙语中的任何一种,babel 和 TikZ 都会出现问题

如果使用俄语、德语、西班牙语或葡萄牙语中的任何一种,babel 和 TikZ 都会出现问题

MWE 中的tikzpicture可以毫无问题地编译greekFrenchItalian,但是English,如果将RussianngermanSpanish中的任何一个Portuguese添加到babelERROR ! Missing \endcsname inserted. <to be read again> \alpha l.32 pic ["$\alpha$", draw, fill=yellow] {angle = F--X--A} The control sequence marked <to be read again> should not appear between \csname and \endcsname则会产生 。

\documentclass{article}
% RN. 1 July 2019
%=======================
\usepackage{tikz}
\usetikzlibrary{angles}
\usetikzlibrary{calc}
\usetikzlibrary{quotes}
\usepackage[greek,french,italian,english]{babel}
%\usepackage[greek,russian,ngerman,french,spanish,italian,portuguese,english]{babel}
%-----------------------
\begin{document}
\begin{tikzpicture}[angle radius=.75cm]
\node (A) at (-2,0) [red,left] {$A$};
\node (B) at ( 3,.5) [red,right] {$B$};
\node (C) at (-2,2) [blue,left] {$C$};
\node (D) at ( 3,2.5) [blue,right] {$D$};
\node (E) at (60:-5mm) [below] {$E$};
\node (F) at (60:3.5cm) [above] {$F$};
\coordinate (X) at (intersection cs:first line={(A)--(B)}, second line={(E)--(F)});
\coordinate (Y) at (intersection cs:first line={(C)--(D)}, second line={(E)--(F)});
\path
(A) edge [red, thick] (B)
(C) edge [blue, thick] (D)
(E) edge [thick] (F)
pic ["$\alpha$", draw, fill=yellow] {angle = F--X--A}
pic ["$\beta$", draw, fill=green!30] {angle = B--X--F}
pic ["$\gamma$", draw, fill=yellow] {angle = E--Y--D}
pic ["$\delta$", draw, fill=green!30] {angle = C--Y--E};
\end{tikzpicture}
\end{document}

答案1

添加shorthands=off作品:

\usepackage[greek,russian,ngerman,french,spanish,italian,portuguese,english, shorthands=off]{babel} 

但现在你也应该使用

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

或者使用基于unicode的引擎之一。

相关内容