2

I want to do a figure in TikZ, and the compilation works but it doesn't include the red vertex.

Here is the copy of my code and then the error message:

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\title{}
\author{}
\date{}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{mathrsfs} 
\usepackage{ amssymb }
\usepackage[margin=1in,footskip=0.3in]{geometry}
\usepackage{hyperref}  
\usepackage{cleveref}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{matrix,arrows,positioning, decorations.pathmorphing,backgrounds,fit,petri,calc}
\usepackage{float}
\usepackage{pgf,tikz}
\usepackage[all,cmtip]{xy}
\graphicspath{ {images/} }
\usepackage[all]{xy}
\linespread{1.3}
\usepackage{mathtools}
\newcommand\SmallMatrix[1]{{%

  \tiny\arraycolsep=0.3\arraycolsep\ensuremath{\begin{pmatrix}#1\end{pmatrix}}}}
    \usepackage{enumerate}
    \begin{document}
    \begin{figure}[H]
    \centering  
    \begin{tikzpicture}[scale=3]
    \tkzDefPoint(0,-0.17){a}
    \tkzDrawPoints[color=red,fill=red,size=12](a)
    \node at ($(0.5,-1.1)$)    {$C_1$}; 
    \node at ($(-0.5,-1.1)$)    {$C_2$}; 
    \draw (-0.1,0) to  (0.5,-1);
    \draw (0.1,0) to  (-0.5,-1);
    \end{tikzpicture}



\caption{Step $1$}

\end{figure}

\end{document}

Here is the error message :

l.38 \tkzDefPoint (0,-0.17){a} 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. Missing character: There is no ( in font nullfont! Missing character: There is no 0 in font nullfont! Missing character: There is no , in font nullfont! Missing character: There is no - in font nullfont! Missing character: There is no 0 in font nullfont! Missing character: There is no . in font nullfont! Missing character: There is no 1 in font nullfont! Missing character: There is no 7 in font nullfont! Missing character: There is no ) in font nullfont! Missing character: There is no a in font nullfont! ! Undefined control sequence. l.40 \tkzDrawPoints [color=red,fill=red,size=12](a) 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'), type I' and the correct spelling (e.g.,I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.

Also it's working on the computer of my friend. So I am pretty confused (I used the same packages as him). I'm taking on Sharelatex. Many thanks in advance !

3
  • add \usepackage{tkz-euclide} to your preamble...
    – user121799
    Jan 17 '18 at 15:42
  • Or change the two \tkz commands to a regular TikZ one.
    – Alenanno
    Jan 17 '18 at 15:45
  • By the way: you loaded tikz and xy twice!
    – CarLaTeX
    Jan 17 '18 at 15:47
4

i would rather draw this image in pure tikz:

enter image description here

the mwe after considering above comments regarding your document preamble and fact that mathtools call amsmath˙, amssymb call amssfonts, tikz call pgf and that hyperref had to be with exception of cleveref the last in preamble, is:

\documentclass[11pt]{article}
\usepackage[margin=1in,footskip=0.3in]{geometry}
\usepackage[utf8]{inputenc}
\title{}
\author{}
\date{}
\usepackage{mathtools,amssymb,amsthm}
\newcommand\SmallMatrix[1]{{%
\tiny\arraycolsep=0.3\arraycolsep\ensuremath{\begin{pmatrix}#1\end{pmatrix}}}}
\usepackage{mathrsfs}
\usepackage{graphicx}
\usepackage{float}
\usepackage{tikz}
\usetikzlibrary{matrix,arrows,positioning, decorations.pathmorphing,backgrounds,fit,petri,calc}
\usepackage[all,cmtip]{xy}
\graphicspath{ {images/} }
\linespread{1.3}

\usepackage{enumerate}
\usepackage{hyperref}
\usepackage{cleveref}

\begin{document}
\begin{figure}
 \centering
\begin{tikzpicture}[scale=3]
\fill[red] (0,-0.17) circle (1pt);
\draw ( 0.1,0) -- (-0.5,-1) node[below] {$C_1$};
\draw (-0.1,0) -- ( 0.5,-1) node[below] {$C_2$};
\end{tikzpicture}
\caption{Step $1$}
\end{figure}
2

I agree with Zarko's answer. But why not let tikz do the job of finding the intersection?

\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{calc,intersections,through,backgrounds}

\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[scale=3]
\coordinate (A) at (0.1,0);
\coordinate (B) at (-0.5,-1);
\draw [name path=A--B] (A) -- (B) node[below] {$C_1$};
\coordinate (C) at (-0.1,0);
\coordinate (D) at ( 0.5,-1);
\draw [name path=C--D] (C) -- (D) node[below] {$C_2$};
\path [name intersections={of=A--B and C--D,by=E}];
\node [circle, fill=red,label=-90:$E$] at (E) {};
\end{tikzpicture}
\caption{Step $1$}
\end{figure}

\end{document}

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.