\tkzDrawLine
包中的命令有什么问题tkz-euclide
。它在编译时引发错误消息:
!未定义的控制序列。l.1 \tkz @line@start l.36 \tkzDrawLine(C,C'') 错误消息顶行末尾的控制序列从未被 \def'ed。如果您拼错了它(例如,
\hobx'), type
I' 和正确的拼写(例如,`I\hbox')。否则继续,我会忘记未定义的内容。! 未定义控制序列。l.1 \tkz @line@end l.36 \tkzDrawLine(C,C'')
错误消息顶行末尾的控制序列从未被 \def 过。如果您拼错了它(例如,
\hobx'), type
I')和正确的拼写(例如,`I\hbox')。否则继续,我会忘记未定义的任何东西。
\documentclass[french,tikz,border=2.5mm]{standalone}
\usepackage[ansinew]{inputenc}% caractères accentués
\usepackage[T1]{fontenc} % fontes extended computer modern (EC)
\usepackage{lmodern} % l'affichage correct des caractères diacritiqués français
\usepackage{babel}% \usepackage[french]{babel} typographie française
\usepackage{xcolor}
\usepackage{tikz,tkz-euclide,siunitx}
\usetikzlibrary{quotes ,babel,arrows.meta,angles,calc,shadings,positioning}
\usetkzobj{all}
%\setcounter{page}{4}
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(0,0){A}
\tkzDefPoint(55:8.8){C}
\tkzDefPoint(55:5.2){B}
\tkzDefShiftPoint[B](20:3){B'}
\tkzDefShiftPoint[C](20:-3){C'}
\tkzDefShiftPoint[C](180:5){C''}
\tkzDrawSegment[line cap =round, double distance=3mm](A,C)
\tkzDrawPoints(A,B,C,C'')
\begin{scope}[very thick]
\tkzDrawVector[-Stealth](B',B)
\tkzDrawVector(C',C)
\end{scope}
\tkzLabelPoint(C){\(C\)}
\tkzLabelPoint(A){\(A\)}
\tkzLabelPoint(B){\(B\)}
\tkzLabelPoint(C''){\(C''\)}
\tkzDrawLine(C,C'')
\end{tikzpicture}
\end{document}
答案1
问题出在babel
库上。加载时,会传递一些 TikZ 命令\scantokens
,因此必须确定它@
具有正确的类别代码。不幸的是,在宏中(实际上是在内部版本中)tkz-euclide
没有。\tkzDrawLine
\@tkzDrawLine
\makeatletter
最简单的解决方法是在适当的位置添加。
\documentclass[french,tikz,border=2.5mm]{standalone}
\usepackage[ansinew]{inputenc}% caractères accentués
\usepackage[T1]{fontenc} % fontes extended computer modern (EC)
\usepackage{lmodern} % l'affichage correct des caractères diacritiqués français
\usepackage{babel}% \usepackage[french]{babel} typographie française
\usepackage{xcolor}
\usepackage{tikz,tkz-euclide,siunitx}
\usepackage{etoolbox} % for \patchcmd
\usetikzlibrary{quotes,arrows.meta,angles,calc,shadings,positioning,babel}
\usetkzobj{all}
% make \tkzDrawLine compatible with the babel TikZ library
\makeatletter
\patchcmd{\tkz@DrawLine}{\begingroup}{\begingroup\makeatletter}{}{}
\makeatother
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(0,0){A}
\tkzDefPoint(55:8.8){C}
\tkzDefPoint(55:5.2){B}
\tkzDefShiftPoint[B](20:3){B'}
\tkzDefShiftPoint[C](20:-3){C'}
\tkzDefShiftPoint[C](180:5){C''}
\tkzDrawSegment[line cap =round, double distance=3mm](A,C)
\tkzDrawPoints(A,B,C,C'')
\begin{scope}[very thick]
\tkzDrawVector[-Stealth](B',B)
\tkzDrawVector(C',C)
\end{scope}
\tkzLabelPoint(C){\(C\)}
\tkzLabelPoint(A){\(A\)}
\tkzLabelPoint(B){\(B\)}
\tkzLabelPoint(C''){\(C''\)}
\tkzDrawLine(C,C'')
\end{tikzpicture}
\end{document}