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 want to pick and highlight a diagonal plane of a cube. I do not want to color it but use some kind of fill-style so that I can print it on a black and white printer. The following is my solution using pst-3dplot treating the plane as a parametric surface. This cannot be the only way to do this. Is there another (better?) way? The following is the code.

    \documentclass[12pt]{report}
    \usepackage{pst-3dplot}

    \begin{document}
    \psset{coorType=2,Alpha=90,IIIDticks}
    \begin{pspicture}(-3,-2.5)(3,4.25)
    \pstThreeDCoor[IIIDticks,IIIDticksize=0]
    \pstThreeDBox[hiddenLine](0,0,0)(0,0,2)(2,0,0)(0,2,0)
    \parametricplotThreeD[plotstyle=curve,yPlotpoints=20](0,2)(0,2){t  t  u}
    \end{pspicture}
    \end{document} 
share|improve this question

2 Answers 2

up vote 2 down vote accepted

This looks like a different way. To create the plane I used the \pstThreeDSquare command. From the vector (0,0,0) the vectors (0,0,2) and (2,2,0) span the square. The fillstyle is hlines, vlines, or croshatch. Hatchwidth is the thickness of each line and hatchsep is the distance between adjacent lines.

\documentclass[12pt]{report}
\usepackage{xcolor}
\usepackage{pst-3dplot}
\begin{document}
\psset{coorType=2,Alpha=90,IIIDticks}
\begin{pspicture}(-3,-2.5)(3,4.25)
\pstThreeDCoor[coorType=2,IIIDticks,IIIDticksize=0,xMin=-2,xMax=4,yMin=-2,yMax=4,zMin=-1,zMax=3]{\psset{coorType=2,fillstyle=vlines,hatchwidth=.2mm,hatchsep=.55mm}\pstThreeDSquare(0,0,0)(0,0,2)(2,2,0)}
\pstThreeDBox[hiddenLine](0,0,0)(0,0,2)(2,0,0)(0,2,0)
\end{pspicture}
\end{document} 

PS: you should be able to color it (solid) shades of gray and get it to print on a black and white printer.

share|improve this answer
    
Thank you very much. I like your solution better than mine. It gives me the option of several fill-styles. Besides, you should not expect someone to know how to parametrize surfaces to plot something simple like this. Ps. I tried to edit the 7th line of your code as it can be broken into 3 lines, but couldn't do it. –  Sony Sep 14 '11 at 10:46
    
Your welcome. Yes, most people couldn't come up with your parametrized solution. The fact \pstThreeDSquare is used to creates a shape that doesn't look rectangular is odd and the format of 3 vectors needed to generate it takes some getting used to. It's worth reiterating that if you use the xcolor package you can create lighter versions of solid colors like, say, black!45. You can adjust the number (0-100) until it shows up on your printer to your liking. –  DJP Sep 14 '11 at 14:33

I played with tikz and tikz-3dplot packages a little bit today. The following is a solution using those packages.

\documentclass[11pt]{report}
\usepackage{tikz}
\usepackage{tikz-3dplot}

\begin{document}
\tdplotsetmaincoords{60}{110}
\begin{tikzpicture}[scale=1.5,tdplot_main_coords]
\draw[thick,->] (0,0,0) -- (3,0,0) node[anchor=north east]{$x$};
\draw[thick,->] (0,0,0) -- (0,3,0) node[anchor=north west]{$y$};
\draw[thick,->] (0,0,0) -- (0,0,3) node[anchor=south]{$z$};
\draw[fill, color=blue!30, draw=black,line width=1pt]
(2,2,2) -- (0,0,2) -- (0,0,0) -- (2,2,0) -- cycle;
\draw[line width=1pt]
(0,0,0) -- (0,0,2) -- (2,0,2) -- (2,0,0) -- (0,0,0) -- (0,2,0) -- (0,2,2) -- (0,0,2)
(2,0,2) -- (2,2,2) -- (2,2,0) -- (2,0,0)
(2,2,0) -- (0,2,0)
(2,2,2) -- (0,2,2);
\end{tikzpicture}
\end{document}
share|improve this answer
    
If you put \usetikzlibrary{patterns} in your preamble and replace color=blue!30 with pattern=north east lines, you'll get a hatched pattern, which would work well for printing. –  Jake Sep 15 '11 at 1:38

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.