Node: Labelling Points, Next: Showing Points, Previous: Point Drawing Functions, Up: Point Reference
Labels make it possible to include TeX text within a drawing.
Labels are implemented by means of class Label
.
The functions label()
and dotlabel()
, described in this
section, create objects of type Label
, and add them to the
Picture
, which was passed to them as an argument
(current_picture
, by default).
See Label Reference, for more information.
void label (const string text_str, [const string position_str = "top", [const bool dot = false , [Picture& picture = current_picture ]]])
|
const function |
void label (const short text_short, [const string position_str = "top", [const bool dot = false , [Picture& picture = current_picture ]]])
|
const function |
These functions cause a Point to be labelled in the drawing.
The first argument is the text of the label. It can either be a
string , in the first version, or a short , in the second.
It will often be the name of the Point in the C++
code, for
example, "p0" .
It is not possible to automate this kind of
labelling, because it is not possible to access the names of variables
through the variables themselves in C++
.
text_str is always placed between
" Point p0(2, 3); p0.label("$p_0$");
If backslashes are needed in the text of the label, then
text_str must contain double backslashes, so that single
backslashes will be written to Point P; Point Q(2, 2); Point R(P.mediate(Q)); R.label("$\\overrightarrow{PQ}$", "ulft");
The position argument indicates where the text of the label should
be located relative to the The dot argument is used to determine whether the label should be
dotted or not. The default is |
void dotlabel ([const string text_str, [const string position_str = "top", [Picture& picture = current_picture ]]])
|
const function |
void dotlabel (const short text_short, [const string position_str = "top", [Picture& picture = current_picture]]) | const function |
These functions are like label() except that they always produces a
dot.
Point p0(2, 3); p0.dotlabel("$p_0$");
|