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.

I need transparent grids on the top of other graphic objects. I know that the option strokeopacity can be used to change the stroke opacity of path. I have made a try as follows, but it cannot work for grid.

Could you tell me how to achieve my goal?

enter image description here

\documentclass{article}
\usepackage{pstricks}

\usepackage[active,tightpage]{preview}
\PreviewEnvironment{pspicture}
\PreviewBorder=12pt


\newpsstyle{mygridstyle}{
    strokeopacity=0.5,
    subgriddiv=4,
    gridlabels=5pt,
    gridlabelcolor=red,
    gridfont=Verdana,
    gridcolor=magenta!50,
    subgridcolor=gray!50,
    gridwidth=2pt,
    subgridwidth=1pt,
}


\begin{document}
\begin{pspicture}(3,3)
\psset{linewidth=10pt,strokeopacity=0.5}
\psline[linecolor=blue](3,3)
\psline[linecolor=red](3,0)(0,3)
\psgrid[style=mygridstyle]
\end{pspicture}
\end{document}
share|improve this question

1 Answer 1

up vote 5 down vote accepted

With the version of pstricks.tex from http://texnik.dante.de/tex/generic/pstricks/ the value of strokeopacity is taken into account. By the way: you can use showgrid=top:

\documentclass{article}
\usepackage{pstricks}

\newpsstyle{gridstyle}{
    strokeopacity=0.5,
    subgriddiv=4,
    gridlabels=5pt,
    gridlabelcolor=red,
    gridfont=Verdana,
    gridcolor=magenta!50,
    subgridcolor=gray!50,
    gridwidth=2pt,
    subgridwidth=1pt,
}

\begin{document}
\begin{pspicture}[showgrid=top](3,3)
\psset{linewidth=10pt}%,strokeopacity=0.5}
\psline[linecolor=blue](3,3)
\psline[linecolor=red](3,0)(0,3)
\end{pspicture}
\end{document}

I'll upload pstricks.tex aLso to CTAN today.

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.