# Why do I get a message error when using \tkzDrawLine

What is the problem with the \tkzDrawLine command from thetkz-euclide package. It induces an error message when compiling:

! Undefined control sequence. l.1 \tkz @line@start l.36 \tkzDrawLine(C,C'') The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., \hobx'), typeI' and the correct spelling (e.g., I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.

! Undefined control sequence. l.1 \tkz @line@end l.36 \tkzDrawLine(C,C'')

The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., \hobx'), typeI' and the correct spelling (e.g., I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.

\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}

\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}

• Are you sure you should use ()'s and not {}'s for some of these? (I'm not bear a computer so I cannot test) Nov 9 '15 at 18:59
• yes we use ()'s with tkz-euclide package macros. Nov 9 '15 at 19:06
• Then start debugging by commenting out all tkz lines, then remove the commenting one line at a time, compiling each time Nov 9 '15 at 19:20
• the line that is the problem is the last one : \tkzDrawLine(C,C'') Nov 9 '15 at 19:35
• It appears that tkz-euclide is not compatible with the babel TikZ library. Nov 9 '15 at 20:56

The problem is with the babel library. When it's loaded, some TikZ commands are passed through \scantokens and so one must ascertain that @ has the correct category code. Unfortunately, tkz-euclide doesn't, in the \tkzDrawLine macro (actually in the internal version \@tkzDrawLine.

The simplest workaround is to add \makeatletter at the appropriate spot.

\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

\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}