[pstricks] Right triangle to scale

David Arnold dwarnold45 at suddenlink.net
Sun Jun 28 01:54:17 CEST 2009

All,

Here is a partial solution to my question.

##########################################################################
### TOPIC 5

\topic= Circles: Area
|@|

# author: DA

### MODEL 1.1, QUESTION 1
\versions=25
|@|
\code =
my ($a,$b,$c); do { ($a,$b)=randint(2,20,2,()); } until$b>=$a; my$unit=2/$b; my$csq=$a**2+$b**2;
my $ans=rad(1,2,$csq);
my $anstex=radtex($ans);
print "$a,$b,$ans,$anstex,$unit\n"; |@| \qutext= A right triangle has legs that measure #a meters and #b meters. Use the Pythagorean Theorem to find the exact length of the hypotenuse of the right triangle. |@| \mode = decimal |@| \answer=#ans |@| \answertex=$#anstex$|@| \soltext = The first step is to sketch a right triangle with legs measuring #a feet and #b feet. \begin{center} \psset{unit=#unit in} \begin{pspicture}(0,0)(#b,#a) \pnode(0,0){A} \pnode(#b,0){B} \pnode(#b,#a){C} \ncline{A}{B} \nbput{$#b\,\text{m}$} \ncline{B}{C} \trput{$#a\,\text{m}$} \ncline{A}{C} \naput{$c$} \end{pspicture} \end{center} |@| \endquestion |@| \endtopic|@| Please excuse our "script" with which we generate random questions for our testbank. The general idea is pretty easy. Any of the variables compute in the \code= field (we can put any perl code in this field that we wish) will be replaced in the fields that follow when we process this script with one of our perl scripts. So, for example, #b in the \qutext section will be replaced by the contents of$b computed
in the perl code section.

This works quite nicely, giving us the attached page. However, as you
can see, the labels on the legs are not visible because they lie
outside the pspicture environment. So I need a way to expand the
pspicture environment. What would work really well in this situation
is if there were some way I could expand the bottom of the pspicture
environment by exactly 1cm. Same for the right side of the pspicture
environment. I tried lly and urx but they didn't seem to help.

Any other ideas?

David.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dev.pdf
Type: application/pdf
Size: 30881 bytes
Desc: not available
URL: <http://tug.org/pipermail/pstricks/attachments/20090627/899eb926/attachment-0001.pdf>
-------------- next part --------------

On Jun 27, 2009, at 4:17 PM, David Arnold wrote:

> In what document is psscalebox discussed?
>
> D.
>
> On Jun 27, 2009, at 3:14 PM, Juergen Gilg wrote:
>

>> Dear David,
>>
>> what about scaling down the right triangle within the \pspicture
>> environment with the command:
>>
>> \psscalebox   ?
>>
>> Hope that inspires you.
>>
>> Regards,
>>
>> Juergen
>>
>> David Arnold wrote:
>>> All,
>>>
>>> Is there a cute way to present an algorithm a pythagorean triple
>>> and have a right triangle drawn to scale in a space that measures
>>> 2 inches by two inches?
>>>
>>> For example, I feed the problem 3, 4, 5 and I get a right triangle
>>> with sides 3, 4, and 5.
>>>
>>> Thanks.
>>>
>>> David.
>>> _______________________________________________
>>> PSTricks mailing list
>>> PSTricks at tug.org
>>> http://tug.org/mailman/listinfo/pstricks
>>>
>>>
>>
>> --
>> J?rgen Gilg
>> Austr. 59
>> 70376 Stuttgart
>> -------------------------------------
>> Tel       0711.59 27 88
>> e-Mail    gilg at acrotex.net
>>
>>
>> _______________________________________________
>> PSTricks mailing list
>> PSTricks at tug.org
>> http://tug.org/mailman/listinfo/pstricks
>
> _______________________________________________
> PSTricks mailing list
> PSTricks at tug.org
> http://tug.org/mailman/listinfo/pstricks