5

I feel very thankful for marmot for helping me with this problem, but I have another problem. It seems like tkz is actually very hard to understand. I have added the \usetkzobj{all} command and it does actually work, although as I get further in the paper (tkz-euclide) it doesn't work anymore! Here is an example:

\documentclass{article}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}

\begin{document}

\begin{tikzpicture}[scale=1.5]
\tkzInit[xmax=5,ymax=5]\tkzGrid[sub]
\tkzDefPoint(1,2){A} \tkzDefPoint(3,4){B}
\tkzDefPoint(3,2){C} \tkzDefPoint(3,1){D}
\tkzDrawSegments(A,B A,C A,D)
\tkzDrawPoints[color=red](A,B,C,D) \tkzLabelPoints(A,B,C,D)
\tkzFindSlope(A,B){SAB} \tkzFindSlope(A,C){SAC}\tkzFindSlope(A,D){SAD}
\tkzText[fill=Gold!50,draw=brown](2.5,0){La pente de (AB) est : \SAB}
\tkzText[fill=Gold!50,draw=brown](2.5,-.5){La pente de (AC) est : \SAC}
\tkzText[fill=Gold!50,draw=brown](2.5,-1){La pente de (AD) est : \SAD}
\end{tikzpicture}

\end{document} 

Here is the result:

See the xcolor package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.17 ...brown](2.5,0){La pente de (AB) est : \SAB}

? 

Process has been terminated ...

This is what it's supposed to look like:

Grid

1
  • I used WinEdt for making this code. Jan 31, 2019 at 2:45

1 Answer 1

8

You haven't shown the whole error message. It says

! Package xcolor Error: Undefined color `Gold'.

See the xcolor package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.16 ...own](2.5,-.5){La pente de (AC) est : \SAC}

Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit

The key part being the first line.

xcolor does have a lot of predefined colors, but they are not loaded by default. For Gold, you need to load xcolor with the svgnames option. Of course, you're not loading xcolor explicitly, that's done by TikZ, but you could do

\documentclass[svgnames]{article}

which will pass svgnames to xcolor when it's loaded. With that modification your code runs without error.

1
  • Thanks! I really didn't know that xcolor didn't load all the colors! Oct 20, 2018 at 17:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .