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.

The following example, using \psscaleboxto, produces an error:

"I can't carry out that multiplication or division, since the result is out of range."

Why does it happen?

\documentclass{article}
\usepackage{pstricks}

\begin{document}
\begin{pspicture}(20,20)
\psscaleboxto(1,1) {
  \psframe(0,0)(5,5)
}
\end{pspicture}
\end{document}
share|improve this question

1 Answer 1

up vote 4 down vote accepted

that cannot work, because all PSTricks objects have inside TeX a width and height of 0pt. That is the reason why you can't expand "nothing" to 1x1. This will work:

\documentclass{article}
\usepackage{pstricks}

\begin{document}
\begin{pspicture}[showgrid](10,10)
\psscaleboxto(1,1){\rule{5cm}{5cm}}
\psframe*[unit=0.2,linecolor=red](5,5)(10,10)
\end{pspicture}
\end{document}

\rule is known with width and height on TeX level.

enter image description here

You can use the default \resizebox or \psscalebox if you have a pspicture environment:

\documentclass{article}
\usepackage{pstricks,graphicx}

\begin{document}

\resizebox{4cm}{2cm}{%
  \begin{pspicture}[showgrid](10,10)
  \psframe*[linecolor=red](5,5)(10,10)
  \psdot[dotstyle=x,dotscale=5](3,3)
  \end{pspicture}%
}
\qquad
\psscaleboxto(2,4){%
  \begin{pspicture}[showgrid](10,10)
  \psframe*[linecolor=red](5,5)(10,10)
  \psdot[dotstyle=x,dotscale=5](3,3)
  \end{pspicture}%
}
\end{document}

enter image description here

share|improve this answer
    
I see that putting the psframe inside the scalebox also works, as long as the \rule is there: "\psscaleboxto(1,1){ \rule{5cm}{5cm} \psframe*[linecolor=red](5,5)(10,10) }" Is there a way to make the black "rule" disappear? –  Erel Segal Halevi Mar 1 at 19:52
    
What exactly do you want to achieve? With the options xunit=..,yunit=.. you can do the same with objects. –  Herbert Mar 1 at 20:06
    
I have not a single object but an arrangement of several objects (frames, dots, etc), and I want to reproduce the same arrangement in a smaller scale, in order to illustrate some recursive construction (similar to a fractal). –  Erel Segal Halevi Mar 1 at 20:34
    
see my edit ... –  Herbert Mar 1 at 20:59
    
I see, so I just have to put the pspicture inside the psscalebox. –  Erel Segal Halevi Mar 1 at 21:03

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.