texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Texmacs-dev] Re: [TeXmacs] Automatically create maths figures in dr


From: Corcelle
Subject: Re: [Texmacs-dev] Re: [TeXmacs] Automatically create maths figures in drawing mode
Date: Wed, 17 Jun 2009 13:27:47 +0200 (CEST)

> On Tue, Jun 16, 2009 at 11:13:12PM +0200, Corcelle wrote:
> > Hello,
> > 
> > For the moment, I didn't succeed in "attaching" objects to others
> and I think I still have a long way to go...
> > 
> > So I started with something in between. I wrote procedures to
> automatically create objects :
> > 1- Some entries give a complete figure :
> >   ("Rectangle" (graphics-set-mode "cline") 
> >     (make-fig-polygon-lab '(0 4 4+2i +2i) '("D" "C" "B" "A") '("" ""
> "L" "l"))   ;; polygon with n complex summits 
> >     (make-fig-mark-right 4 0 +2i 0.3)   ;; angle (4 0 +2i) of size 0.3
> >     (make-fig-mark-seg 0 4 "double" 0.2 +i)   ;; double mark on segment
> (0 4) of size 0.2 and angle argument(+i)
> >     (make-fig-mark-seg +2i 4+2i "double" 0.2 +i))
> 
> Yes, this is a good way to proceed. If you do things in a clean way,
> you may later replace your make- commands by macro constructors.
Ok.

> 
> > 2- Others give an interactive access to the different objects, the
> scheme command is given in the footer and can be modified afterwards
> (I chose to use complex numbers for an easier use) :
> >   ("Polygone"
> >     ((tm-property (footer-eval cmd)
> >             (:argument cmd "Command ->")
> >             (:proposals cmd '("(make-fig-polygon-lab '(0 4 3+2i +2i) '(\"A\"
> \"B\" \"C\" \"D\") '(\"d\" \"c\" \"a\" \"b\"))" 
> >                               "Help : '(Affixes des points) '(Labels des 
> > points) '(Labels
> des cotes)")))
> >      (interactive footer-eval)))
> 
> I don't think that the user wants to give scheme commands at the
> footer, in general.
> But if you just insert your figure, then you should be able to change
> the labels
> (for instance) manually anyway.

A simple example :
If the user wants to create a specific isoscele triangle.
-1- He choses "Triangle..." 
which gives in the footer : (make-fig-triangle-lab '(0 4 1+2i) '("A" "B" "C") 
'("a" "b" "c"))
and modifies '(0 4 1+2i) to '(0 5 2.5+3i) and eventually "a" to "5 cm" (or of 
course change he labels manually after insertion)

-2- Then "Mark segment..."
which gives in the footer : (make-fig-mark-seg 0 4 "double" 0.2 +i)
and modifies "0 4" to "0 2.5+3i"
and another time modifies "0 4" to "5 2.5+3i"

-3- Then for example "Perpendicular line..."
which gives in the footer : (make-fig-perp-line 0 4 1+2i #t 0.3)
and modifies it to : (make-fig-perp-line 0 5 2.5+3i #t 0.3)
to insert a perpendicular to (0 5) containing point 2.5+3i with the right angle 
(#t)

The only things to know are the coordinates of each point.
We can easily imagine to electric diagrams with commands like 
(make-fig-resistor z1 z2 size) modifing the numbers z1 and z2 to have 
------[___]------ between points of your choice.

Finally, my purpose would be to do the same thing by choosing a mode ("mark 
segment" for example) then choosing the two points by clicking on them. This 
solution is the one I chose because I can't do better for the moment.

> 
> > I have two little question about this :
> > 1- All my procedures are called "fig-something" to clearly
> distinguish them from TeXmacs ones. Is it necessary to do that or not
> ?
> 
> It is not necessary, but generally a good practice in Scheme.
> 
> > 2- The interactive insertion of figure works really well but it
> seems a little tricky. Is it a problem and if it is could you give me
> an other way to do that in a proper way ?
> 
> I don't understand your question very well.

I'm not always really clear. 
I wanted to know if these commands (tm-property... interactive footer-eval) are 
sufficiently clean ?

Thank you.

Emmanuël





reply via email to

[Prev in Thread] Current Thread [Next in Thread]