![如果使用俄语、德语、西班牙语或葡萄牙语中的任何一种,babel 和 TikZ 都会出现问题](https://linux22.com/image/398225/%E5%A6%82%E6%9E%9C%E4%BD%BF%E7%94%A8%E4%BF%84%E8%AF%AD%E3%80%81%E5%BE%B7%E8%AF%AD%E3%80%81%E8%A5%BF%E7%8F%AD%E7%89%99%E8%AF%AD%E6%88%96%E8%91%A1%E8%90%84%E7%89%99%E8%AF%AD%E4%B8%AD%E7%9A%84%E4%BB%BB%E4%BD%95%E4%B8%80%E7%A7%8D%EF%BC%8Cbabel%20%E5%92%8C%20TikZ%20%E9%83%BD%E4%BC%9A%E5%87%BA%E7%8E%B0%E9%97%AE%E9%A2%98.png)
MWE 中的tikzpicture
可以毫无问题地编译greek
、French
和Italian
,但是English
,如果将Russian
、ngerman
或Spanish
中的任何一个Portuguese
添加到babel
,ERROR ! 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的引擎之一。