3

What is the problem with the tkz-euclide command \tkzDrawLine which induces a message error 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}

\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}
  • Are you sure you should use ()'s and not {}'s for some of these? (I'm not bear a computer so I cannot test) – daleif Nov 9 '15 at 18:59
  • yes we use ()'s with tkz-euclide package macros. – Hafid Boukhoulda 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 – daleif Nov 9 '15 at 19:20
  • the line that is the problem is the last one : \tkzDrawLine(C,C'') – Hafid Boukhoulda Nov 9 '15 at 19:35
  • 1
    It appears that tkz-euclide is not compatible with the babel TikZ library. – egreg Nov 9 '15 at 20:56
5

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

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

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.