Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've made this drawing, but I can manage to place the node $m$ to the line. Any suggestions? Thanks in advance

enter image description here

\documentclass[a4paper]{article}
\usepackage{pgfplots}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{center}
\begin{tikzpicture}
\coordinate (M) at (0,0) ;
\coordinate (A) at (canvas polar cs:angle=90,radius=3cm);
\coordinate (B) at (canvas polar cs:angle=20,radius=3cm) ;
\draw (M) circle (3cm);
\draw (A) -- (B) ;
\tkzDefMidPoint(A,B) \tkzGetPoint{P}
\draw (A) -- (P) node[midway,sloped] {$// $} ;
\draw (P) -- (B) node[midway,sloped] {$// $} ;
\tkzDrawLine[add = 0.5 and 1.6](P,M) node {m}; %PROBLEM%
\tkzDrawPoints(A,B,M);
\tkzLabelPoints(B,M);
\tkzLabelPoints[above](A);
\end{tikzpicture}
\end{center}
\end{document}
share|improve this question
1  
The node {m}; text is not part of a TikZ path. You will place the node manually or use one of the \tkz… macros or options for that. –  Qrrbrbirlbel Aug 26 '13 at 11:35
    
@macmadness86 ... It is marked in the code... %PROBLEM% ;-) –  Arne Aug 26 '13 at 11:43
1  
@Arne You can use \tkzDrawLine[add = 0.5 and 1.6, start=m, start style={midway}](P,M) (or end instead of start). Usually those two nodes default to at start (= pos = 0) and at end (= pos = 1) but you can overwrite this with the … style keys. –  Qrrbrbirlbel Aug 26 '13 at 12:29
1  
In general tkz commands do not have ; in the end –  percusse Aug 26 '13 at 13:06
1  
You can't accept comments, but I'm sure @Qrrbrbirlbel will write an answer as soon as he has time. –  Torbjørn T. Aug 26 '13 at 13:44

1 Answer 1

up vote 2 down vote accepted

The macros of the tkz-* packages are all wrappers around TikZ paths. A simple node {m}; is therefore not part of any path (like every ; after any of the \tkz* macros).

The \tkzDrawLine macro provides the keys

  • start,
  • end,
  • start style and
  • end style

to add nodes to the path, the * style can be used to apply another position besides at start and at end.

In this example, I have used near start to show the affect:

\tkzDrawLine[add = 0.5 and 1.6, start=$m$, start style={near start}](P,M)

Code

\documentclass[tikz,convert=false]{standalone}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\coordinate (M) at (0,0) ;
\coordinate (A) at (canvas polar cs:angle=90,radius=3cm);
\coordinate (B) at (canvas polar cs:angle=20,radius=3cm) ;
\draw (M) circle (3cm);
\draw (A) -- (B) ;
\tkzDefMidPoint(A,B) \tkzGetPoint{P}
\draw (A) -- (P) node[midway,sloped] {$// $} ;
\draw (P) -- (B) node[midway,sloped] {$// $} ;
\tkzDrawLine[add = 0.5 and 1.6, start=$m$, start style={near start}](P,M)
\tkzDrawPoints(A,B,M);
\tkzLabelPoints(B,M);
\tkzLabelPoints[above](A);
\end{tikzpicture}
\end{document}

Output

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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