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.

It seems to me this problem related to PSTricks so I have to modify the previous question.

\psset{fillstyle=solid,linecolor=red} that I define globally outside the preview environment can affect the graphics object. But why do I have to put \psset{fillcolor=green} inside the preview environment to make it works?

\documentclass[preview,border=12pt]{standalone}
\usepackage{pstricks}
\psset{fillstyle=solid,linecolor=red}

% the following setting will be ignored by preview
% \psset{fillcolor=green}

\begin{document}
\preview
% Thus the setting must be inside the preview, does it seem strange to you?
\psset{fillcolor=green}
\psframebox{Karl's students}
\endpreview
\end{document}

Is fillcolor very special in this case?

share|improve this question
    
I think that's how preview works. Only the stuff between the preview environment gets executed after \begin{document}. Otherwise use crop option instead of preview in the class options. –  percusse Mar 15 '13 at 15:05
    
@percusse: See my update because I just found that it is heavily related to fillcolor option. –  I am who I say I am Mar 15 '13 at 15:07
1  
It's not related to \preview. The issue comes up whether you use preview or not. It seems to have to do with where you call \psset. Setting things in the preamble doesn't always have the desired effect. Not sure why at this point. If you place your \psset{fillcolor=green} immediately after begin{document} it will work, but not if you place it inside the preamble. –  A.Ellett Mar 15 '13 at 18:00
add comment

3 Answers

up vote 2 down vote accepted
+50

If you look inside pstricks.sty, at the very end of the package you will find the following line:

\AtBeginDocument{%
  \psset{fillcolor=white}%      hv 0.33
  \let\pst@endcolor=\relax%
%  \let\pst@color=\relax%
% LaTeX used `\color@endgroup' instead. RN 2004-05-06
}

Thus trying to set fillcolor inside the preamble will be defeated once you hit \begin{documnent}

share|improve this answer
add comment

use

\AtBeginDocument{\psset{fillstyle=solid,linecolor=red}}
share|improve this answer
    
But what is the purpose of setting fillcolor=white at the begin document in pstricks.sty? –  I am who I say I am Apr 4 '13 at 15:06
    
Problems when there is no defined fillcolor –  Herbert Apr 4 '13 at 15:10
    
Why wasn't it put at the bottom of pstrick.sty but not inside \AtBeginDocument (because our global \psset{} is always below \usepackage{pstricks})? –  I am who I say I am Apr 4 '13 at 15:16
    
because no one should set it to undefined –  Herbert Apr 4 '13 at 15:24
    
I meant \psset{fillcolor=white} should be defined at the bottom of pstricks.sty but not inside \AtBeginDocument{}. So this setting can be overridden by us via \psset{fillcolor=<other color>} that we put below \usepackage{pstricks}. –  I am who I say I am Apr 4 '13 at 15:28
show 4 more comments

This weird feature has been disabled in the current pstricks.sty.

share|improve this answer
    
@texenthusiast: No. It has not been mentioned in the news letter yet. –  I am who I say I am Apr 7 '13 at 6:00
add comment

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.