# Is PSTricks breaking LaTeX?

Sorry for the newspaper headline title :P

I have a document in which I (ab)use LaTeX's control structures, namely \@for. Naturally, the contents of some of these loops contain \par agraph breaks.

I added \usepackage{pstricks} to my document and I got tons of Runaway arguments. \tracingall here and there, and I reduced the problem to this MWE:

\documentclass{article}

% \usepackage{pstricks}

\begin{document}

\makeatletter
\@for\el:=a,b,c\do{%
A long text with \el\par or not so long after all\dots\par}

\end{document}


Once you uncomment \usepackage{pstricks} TeX throws an error saying that Paragraph ended before \@fornoop was complete.

On line 90 of pstricks.tex one finds:

% stolen from latex.ltx to make it TeX compatible
\def\@fornoop#1\@@#2#3{}


while the LaTeX kernel has:

\long\def\@fornoop#1\@@#2#3{}


Why does PSTricks doesn't define \@fornoop as \long? Is this intended or a bug? If it is intended, then why?

• Which compiler do you use with pstricks? – Bernard Apr 30 '18 at 22:56
• @Bernard I was compiling with pdfLaTeX. To be honest I didn't try other compilers as I thought it would be irrelevant because this doesn't seem to be a compiler dependent issue. – Phelype Oleinik May 1 '18 at 0:29
• Witpdflatex, did you think of loading auto-pst-pdf (after pstricks) and enabling -shell-escape? Without it, you can compile with xelatex. – Bernard May 1 '18 at 0:33
• @Bernard Actually, the problem arised when I loaded both psvectorian (which loads pstricks) thenauto-pst-pdf, so no that doesn't help, neither does xelatex (I tried just now). Solving the problem is quite easy, just copy the LaTeX definition of \@fornoop after pstricks, or load Nicola Talbot's xfor. My question was more if this is an expected behavior. Thanks anyway :) – Phelype Oleinik May 1 '18 at 0:52
• should be fixed with next update ... – user2478 May 2 '18 at 9:39

If you look at the documented sources of LaTeX you will see that making that \long is a "recent" change and pstricks would have copied an older version and not yet caught up
% \changes{v1.0g}{1995/08/16}{Made defs long}

• Loading xfor after pstricks might help. xfor was written before that change and one of the reasons for writing it was to patch \@for to make it long. – Nicola Talbot Apr 30 '18 at 23:38
• @NicolaTalbot xfor not only solves this issue, but it solves far too many problems I had before with loops. Thanks for the tip :) – Phelype Oleinik May 1 '18 at 0:34