We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Pict2e package limitation


It seems that the included pict2e package lacks important macro as \Vector:

) (ot1enc.dfu) (omsenc.dfu))) (pict2eo.sty (pict2eo.cfg) (p2eo-objecttex.def))
geometry detected driver: objecttex
! Undefined control sequence.
l.208 \Vector

This macro is very important because the standard \vector macro is very limited.

What can I do?

An example with using the picture environment follows:
\arc[0, 346.2541]{3276.6}


Yes, the included version of the pict2e package contains no \Vector definition.
\Vector can be converted to \vector as follows:
Suppose you want to draw \Vector(x1,y1)(x2,y2). Then let d = sqrt((x1-x2)^2+(y1-y2)^2) - the length of the vector. Also, let M=min(x2,y2). Then you can replace your \Vector with \put(x1,y1){\vector(x2/M,y2/M){d}}. In your case that would be \put(-7698.4,1883.2){\vector(4.0879,-1){15850.78}}.


There is something that I don’t understand:
M = min(x2,y2) = min(7698.4,-1883.2) = -1883.2
so x2/M = 7698.4 / -1883.2 = -4.0879
and y2/M = 1
Furthermore M could be 0.
Another important issue is with nearly vertical vectors (x1 = -1.6, y1 = -8191.1, x2 = 1.6, y2 = 8191.1): the \Line macro works fine while the code above produce this:
which gives this error:
! Package pict2eo Error: Bad \line or \vector argument.

while the macro \Line(-1.6,-8191.1)(1.6,8191.1) works fine.


You’re right. That was the special case, and not quite correct. The replacement in common case will be:
\put(x1,y1){\vector((x2-x1)/d,(y2-y1)/d){d}}. So in your example, \Vector(-7698.4,1883.2)(7698.4,-1883.2) can be converted to \put(-7698.4,1883.2){\vector(0.971,-0.238){15850.78}}. And \Vector(-1.6,-8191.1)(1.6,8191.1) to \put(-1.6,-8191.1){\vector(0,1){16382.2}}.

Thank you. Now it works perfectly.

Unfortunatelly I found something wrong with the length of the vector. In the example below the vector should start on the first circle and end on the second one, but it is not.

Yes, you’re right again. It’s a kind of an exercise to find the truth in docs. It turned out that the second argument of the \vector command is not the length of the vector, but the length of the Y-projection (y2 - y1) for vertical vectors and the length of the X-projection (x2-x1) for all other vectors. Thus, \Vector(-7698.4,1883.2)(7698.4,-1883.2) turns to \put(-7698.4,1883.2){\vector(0.971,-0.238){15396.8}}. The vertical one was correct. And the last one, the one between circles, turns to \put(-5204.80,3105.52){\vector(0.86,-0.51){10409.6}.