\newpage \section{Writing Convention} % (fold) \label{sec:writing_convention} \subsection{Miscellaneous} % (fold) \label{sub:miscellanous} \begin{itemize} \item Numerical variable: the writing conventions for real numbers are the same as for \pkg{Lua}. \item Complex numbers: as for real numbers but to define them you must write |za = point (1,2)|. Mathematically, this corresponds to 1+2i, which you can find with |tex.print(tostring(za))|.(see \ref{sub:complex_numbers}) \item Boolean: you can write |bool = true| or |bool = false| then with Lua you can use the code :\\ \begin{mybox} |if bool == ... then ... else ... end| \end{mybox} and outside the environment \tkzNameEnv{tkzelements} you can use the macro \begin{mybox} |\ifthenelse{\equal{\tkzUseLua{bool}}{true}}{ ... }{ ... }| \end{mybox} after loading the \tkzNamePack{ifthen} package. \item String: if st = "Euler's formula" then \begin{mybox} |\tkzUseLua{st}| gives |Euler's formula| \end{mybox} \end{itemize} % subsection miscellanous (end) \subsection{Assigning a Name to a Point} % (fold) \label{sub:assigning_a_name_to_a_point} Currently the only obligation is to store the points in the table |z| \footnote{To place the point M in the table, simply write |z.M| = \ldots or |z["M"]|= \ldots} if you want to use them in \TIKZ\ or \pkg{tkz-euclide}. If it is a point which will not be used, then you can designate it as you wish by respecting the conventions of Lua. The points which occur in the environment \tkzNameEnv{tkzelements} must respect a convention which is |z.name| such that |name| will be the name of the corresponding \tkzname{node}. What are the conventions for designating |name|? You have to respect the Lua conventions in particular cases. \begin{enumerate} \item The use of prime is problematic. If the point name contains more than one symbol and ends with |p| then when passing into \pkg{TikZ} or \pkg{tkz-euclide}, the letters |p| will be replaced by |'| using the macro \tkzcname{tkzGetNodes}; \index{prime} \item One possibility, however, in order to have a more explicit code is to suppose that you want to designate a point by "euler". It would be possible for example to write |euler = ...|, and at the end of the code for the transfer, |z.E = euler|. It is also possible to use a temporary name |euler| and to replace it in \TIKZ{}. Either at the time of placing the labels, or for example by using |pgfnodealias{E}{euler}|. This possibility also applies in other cases: prime, double prime, etc. \end{enumerate} Here are some different ways of naming a point: \begin{mybox} \begin{itemize} \item |z.A = point : new (1,2)| \item |z.Bp = point : new (3,4)| --> this gives |B'| in the \tkzNameEnv{tikzpicture} \item |z.H_a = T.ABC : altitude ()| --> this gives |H_a| in the \tkzNameEnv{tikzpicture} code and $H_a$ in the display. \end{itemize} \end{mybox} % subsection assigning_a_name_to_a_point (end) \subsection{Assigning a Name to Other Objects} % (fold) \label{sub:assigning_a_name_to_other_objects} You have the choice to give a name to objects other than points. That said, it is preferable to respect certain rules in order to make the code easier to read. I have chosen for my examples the following conventions: first of all I store the objects in tables: |L.name| for lines and segments, |C.name| for circles, |T.name| for triangles, |E.name| for ellipses. For lines, I use the names of the two points. So if a line passes through points $A$ and $B$, I name the line |L.AB|. For circles, I name |C.AB| the circle of center $A$ passing through $B$, but something like |C.euler| or |C.external| is fine. For triangles, I name |T.ABC| the triangle whose vertices are $A$, $B$ and $C$ but |T.feuerbach|. For ellipses, I name |E.ABC| the ellipse with center $A$ through vertex $B$ and covertex $C$. % subsection assigning_a_name_to_other_objects(end) \subsection{Writing conventions for attributes, methods.} % (fold) \label{sub:writing_conventions_for_attributes_methods_and_functions} You must use the conventions of Lua, so \begin{itemize} \item To obtain an \Amacro{attribute}, for all objects, the convention is identical: |object.attribute|. For example, for the point $A$ we access its abscissa with |z.A.re| and its ordinate with |z.A.im|; as for its type we obtain it with |z.A.type|. To get the south pole of the circle |C.OA| you need to write: |C.OA.south|. \item To use a method such as obtaining the incircle of a triangle ABC, just write |C.incircle = T.ABC : in_circle ()|. \item Some methods need a parameter. For example, to know the distance between a point $C$ to the line $(A,B)$ we will write |d = L.AB : distance (z.C)|. \item Use the \Amacro{underscore} to store a result you don't want to use. If you only need the second point of an intersection between a line and a circle, you would write |_,z.J = intersection (L.AB , C.OC)|. \end{itemize} % section writing_convention (end) \endinput