Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This is an extremely weird bug [Edit]it's not a bug, the problem was in my code.

I spent 1 hour bringing this down to a small working example, can't figure out if its minimal.

Set up: Ubuntu latest release, standard updated .tex. File:

\documentclass{beamer}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{times}
\usepackage{pst-plot}
\usepackage{pst-math}
\newcommand{\polarWedge}[3]{%
\pstVerb{%
/t #1 def%
}%
}%
\begin{document}
\begin{frame}
\begin{pspicture*}(-3,-1)(1.5,2.3)%
\polarWedge{0}{1}{t 2 div 1 add}%
\end{pspicture*}
rt
\end{frame}
\end{document}

Symptoms: This does not compile properly with dvi->ps-pdf toolchain. Compiles with pdflatex. The issue is with the letter combination rt. If you change rt to r t or to any other letter combination, the issue disappears. This is the weirdest thing I've ever seen in latex (could it be the way the rt letters are processed?)

I am not sure how reproducible this issue is, please let me know if you get the same problem on your machine!


[Edit]The issue is now resolved. The problem was correctly identified by Herbert: What happens is that t is used as an internal variable and my redefinition of t messes up something. The solution proposed by Herbert was also the correct one: I need to define a local dictionary in which I evaluate the variable t, and then pop the dictionary. I am posting a corrected version of the slide.

I must admit this was not a bug, but a manifestation of my lack of knowledge of postscript.


[Edit]@cfr: no your minimal example does not address the same issue as my example. In my example, if you remove the pspicture, the slide will compile just fine with the letters rt. The rt-bug shows up only if you use the pspicture.


@Herbert: yes, I do believe the issue lies in the letter t being used in more than one place, combined with the use of the \pstVerb to redefine the letter t. However, I do need to assign values to the letter t to evaluate my function. Is there a way to do that without using \pstVerb?


[Edit] @cfr: The error I got was from the ps2pdf executable. The error report looks like this:

Process started: ps2pdf "pstricksProblem".ps

Error: /invalidrestore in --restore-- Operand stack: (r) 0.4 --nostringval-- --nostringval-- Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1916 1 3 %oparray_pop 1915 1 3 %oparray_pop 1899 1 3 %oparray_pop 1787 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- 1839 3 4 %oparray_pop --nostringval-- 1823 3 4 %oparray_pop --nostringval-- Dictionary stack: --dict:1175/1684(ro)(G)-- --dict:1/20(G)-- --dict:163/200(L)-- --dict:189/300(L)-- Current allocation mode is local Current file position is 133316 GPL Ghostscript 9.10: Unrecoverable error, exit code 1

Process exited with error(s)


[Edit] Since people asked, the original slide looks like this:

\documentclass{beamer}
\usepackage{etex}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{times}
\usepackage{auto-pst-pdf}
\usepackage{pst-plot}
\usepackage{pst-math}
\newcommand{\polarWedge}[3]{%
\pstVerb{%
/t #1 def%
/firstX #1 57.29578 mul cos #3 mul def%
/firstY #1 57.29578 mul sin #3 mul def%
}%
\pstVerb{%
/t #2 def%
/secondX #2 57.29578 mul cos #3 mul def%
/secondY #2 57.29578 mul sin #3 mul def%
}%
\pscustom[fillcolor=cyan, fillstyle=solid, linecolor=blue]{%
\psline(0,0)(! firstX firstY)(! secondX secondY)(0,0)%
}%
}%
\newcommand{\drawPolar}[4]{%
\parametricplot[#4]{#1}{#2}{#3 t 57.29578 mul cos mul #3 t 57.29578 mul sin mul}%
}

\begin{document}
\begin{frame}
\begin{pspicture*}(-3,-1)(3.5,3.3)%
\uncover<2->{%
\polarWedge{0}{0.05}{3 t sub}%
}%
\uncover<3->{%
\polarWedge{0.05}{0.1}{3 t sub}%
}%
\uncover<4->{%
\polarWedge{0.1}{0.15}{3 t sub}%
}%
\uncover<5->{%
\polarWedge{0.15}{0.2}{3 t sub}%
}%
\uncover<6->{%
\polarWedge{0.2}{0.25}{3 t sub}%
}%
\uncover<7->{%
\polarWedge{0.25}{0.3}{3 t sub}%
}%
\uncover<8->{%
\polarWedge{0.3}{0.35}{3 t sub}%
}%
\uncover<9->{%
\polarWedge{0.35}{0.4}{3 t sub}%
}%
\drawPolar{0}{2.5}{3 t sub}{linecolor=red, plotpoints=1000}%
\end{pspicture*}
\uncover<1-10>{}
rt
\end{frame}
\end{document}

[Edit] The variable I use is called t, because I am passing the function

3 t sub

as an argument to a function which calls \parametricplot, and the variable name in use for parametricplot is t. If you wish, I am making a function whose argument is a function. Of course, my setup relies entirely on the assumption that the variable "t" is a local variable. That this is the case is supported by the fact that the above slide works when the letters r and t are separate. What is the role of letters r and t being side by side however, is something I can't figure out.

[Edit] Final corrected version of the slide. The correction followed from the advice of Herbert (many thanks!) and a little reading of postscript documentation.

\documentclass{beamer}
\usepackage{etex}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{times}
\usepackage{auto-pst-pdf}
\usepackage{pst-plot}
\usepackage{pst-math}
\newcommand{\polarWedge}[3]{%
\pstVerb{%
/firstX  1 dict begin /t #1 def #1 57.29578 mul cos #3 mul end def%
/firstY  1 dict begin /t #1 def #1 57.29578 mul sin #3 mul end def%
/secondX 1 dict begin /t #2 def #2 57.29578 mul cos #3 mul end def%
/secondY 1 dict begin /t #2 def #2 57.29578 mul sin #3 mul end def%
}%
\pscustom[fillcolor=cyan, fillstyle=solid, linecolor=blue]{%
\psline(0,0)(! firstX firstY)(! secondX secondY)(0,0)%
}%
}%
\newcommand{\drawPolar}[4]{%
\parametricplot[#4]{#1}{#2}{#3 t 57.29578 mul cos mul #3 t 57.29578 mul sin mul}%
}

\begin{document}
\begin{frame}
\begin{pspicture*}(-3,-1)(3.5,3.3)%
\uncover<2->{%
\polarWedge{0}{0.05}{3 t sub}%
}%
\uncover<3->{%
\polarWedge{0.05}{0.1}{3 t sub}%
}%
\uncover<4->{%
\polarWedge{0.1}{0.15}{3 t sub}%
}%
\uncover<5->{%
\polarWedge{0.15}{0.2}{3 t sub}%
}%
\uncover<6->{%
\polarWedge{0.2}{0.25}{3 t sub}%
}%
\uncover<7->{%
\polarWedge{0.25}{0.3}{3 t sub}%
}%
\uncover<8->{%
\polarWedge{0.3}{0.35}{3 t sub}%
}%
\uncover<9->{%
\polarWedge{0.35}{0.4}{3 t sub}%
}%
\drawPolar{0}{2.5}{3 t sub}{linecolor=red, plotpoints=1000}%
\end{pspicture*}
\uncover<1-10>{}
\end{frame}
\end{document}

-Todor Milev

share|improve this question
    
I get the error {No room for a new #3}... l.2272 \newdimen\pst@yunit when trying to compile. Is that the problem you're referring to? Just saying that it 'does not compile properly' is not very informative, especially when used to describe an entire toolchain. Which step fails? How does it fail? –  cfr Mar 23 at 21:16
    
OK. I didn't get that far because latex failed to compile the example. (See below. I should probably delete it in a bit since that's irrelevant to the issue.) –  cfr Mar 24 at 2:39
    
So is this fixed? Note that if I compile your original example, removing the pspicture does not help. I guess you have a different beamer version... Your new slide code compiles fine for me... –  cfr Mar 24 at 3:05
    
Yes I finally figured it out, thanks a lot for the help! It wasn't a bug after all, it was all me. The issue was the one identified by Herbert (thanks!). I explained in the original post. –  user39417 Mar 24 at 3:58
    
You should explain what your code should show. See my edited answer. –  Herbert Mar 24 at 7:33

1 Answer 1

It is absolutely not clear to me what you want to show. As I already said t is used internally by beamer and also as a variable by \psparametricplot. It is dangerous to redefine it. Tell us what you want to show and we can give a useful help. However, here is your example:

\documentclass{beamer}
\usepackage{etex}
\usepackage{pst-plot}
\usepackage{pst-math}
\newcommand\polarWedge[3]{%
  \pstVerb{/t #1 def}
  \pscustom[fillcolor=cyan,fillstyle=solid,linecolor=blue,linewidth=0.2pt]{
    \psline(0,0)(! #1 COS #3 mul #1 SIN #3 mul)
    \parametricplot{#1}{#2}{#3 t COS mul #3 t SIN mul}
    \closepath}}
\newcommand\drawPolar[4]{%
  \parametricplot[#4]{#1}{#2}{#3 t COS mul #3 t SIN mul}%
}

\begin{document}
\begin{frame}
\begin{pspicture*}(-3,-1)(3.5,3.3)%
\multido{\iA=2+1,\rA=0.00+0.05,\rB=0.05+0.05}{16}{%
  \uncover<\iA->{\polarWedge{\rA}{\rB}{3 t sub}}}%
\drawPolar{0}{2.5}{3 t sub}{linecolor=red, plotpoints=100}%
\end{pspicture*}

rt
\end{frame}
\end{document}

And the view of the last slide:

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.