[pstricks] multido controlled by postscript variables

Poul Riis poul.riis at skolekom.dk
Thu Jan 25 15:21:50 CET 2018


Graphics with PSTricks <pstricks at tug.org> writes:
>\def\nxmax{5}
OK - thanks. To me it would be highly desirable if all parameters could be
transferable from postscript to pstricks commands.

In the project below I would like to replace \prim with \primminusone in
the red line. But when doing so I get an empty table. Why? And how can I
make it work?


Poul Riis



\documentclass{article}
\usepackage{multido}
\usepackage[x11names]{xcolor}
\usepackage{pst-tools}
\usepackage{pstricks-add}

\newcommand{\multitable}[1]{\def\prim{#1}\def\primminusone{\the\numexpr(\prim
- 1)}
	\psset{unit=5mm}
	\pstVerb{/prim #1 def 
		{ mul prim mod} /modularmul exch def
	}
	\begin{pspicture}(-0.5,-#1)(#1,1)
	\uput{5pt}[90]{0}(!#1 2 div 1){\huge\fcolorbox{Red1}{Gold1}{$a\cdot b$
mod $\psPrintValue[fontscale=20]{prim}$\hspace{1em}}}
	\psline[linecolor=blue](-0.75,-0.25)(!prim -0.25)
	\psline[linecolor=red](0.85,0.75)(0.85,-12)
	\psComment*[ref=r,linecolor=blue]{->}(-0.75,0.25)(0.75,0.25){\color{blue}$b$}%[\ncarc]
\psComment*[ref=b,linecolor=red]{->}(0.2,1)(0.2,-0.25){\color{red}$a$}
	\multido{\nh=1+1}{\prim}{%Problem!?!?!?!?!?!? No numbers in table if
\prim is replaced by \primminusone!?
		\uput{0}[0](!\nh\space 0.2 add
0){\psPrintValue[linecolor=blue]{\nh\space}}
			\multido{\ng=1+1}{\primminusone}{
		\uput{0}[0](!0 \ng\space neg){\psPrintValue[linecolor=red]{\ng\space}}
		}
		\multido{\ng=1+1}{\primminusone}{
			\uput{0}[0](!\nh\space 0.2 add 1 neg \ng\space mul
){\psPrintValue[valuewidth=2]{\ng\space \nh\space modularmul}
			}
	}}
	\end{pspicture}	
}


\begin{document}
\multitable{13}\\[1cm]
$p=$\prim\\
$p-1=$\primminusone
\end{document}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/pstricks/attachments/20180125/243bb440/attachment.html>


More information about the PSTricks mailing list