[pstricks] calculating the length of a line

Herbert Voss Herbert.Voss at fu-berlin.de
Sun Aug 28 12:46:48 CEST 2022



Am 28.08.22 um 12:27 schrieb Herbert Voss:
> Hello all,
>
> an example how you can use any calculation with lualatex:
>
> \documentclass[pstricks]{standalone}5 run with lualatex

should be

\documentclass[pstricks]{standalone}% run with lualatex


Herbert


> \usepackage{pst-plot,pst-node}
>
> \def\myLineY#1{%
>        \pcline{->}(0,0)(!4 dup #1 tan mul)
>        \ncput*{\directlua{
> tex.print(math.floor(4/math.cos(#1*math.pi/180)*10)/10)}}
>        \pcline{->}(0,0)(!-4 4 #1 tan mul)}
> \def\myLineX#1{%
>     \pcline{->}(0,0)(!4 #1 tan div 4)
>     \pcline{->}(0,0)(!-4 #1 tan div -4)}
>
> \begin{document}
> \begin{pspicture}(-5,-5)(5,5)
> \psaxes{<->}(0,0)(-4,-4)(4,4)
> \multido{\iA=-45+15}{7}{\myLineY{\iA}}
> \multido{\iA=45+15}{6}{\myLineX{\iA}}
> \end{pspicture}
> \end{document}
>
> \end{document}
>
>
>
>
> Herbert
> -- 
> list: https://lists.tug.org/pstricks
> archive: https://tug.org/pipermail/pstricks/



More information about the PSTricks mailing list.