I was trying to draw the some diagram by using the picture environment. I want to put shade certain part of the figure, namely inside of the rectangle (with curved corners) created in the left hand side of the figure. The code is given below.
\documentclass[a4paper,12pt]{amsart}
\usepackage{xspace}
\usepackage{amsmath,amscd,amsfonts,amssymb, color}
\usepackage{latexsym, graphicx, rotating,subfig,framed,xcolor,wrapfig}
\begin{document}
\definecolor{shadecolor}{gray}{0.9}
\begin{figure}[htb]
\setlength{\unitlength}{5mm}
\begin{picture}(20,16)(-10,-5)
\put(-5,0){\line(1,0){10}}
\multiput(-5,0)(-0.3,0){10}{\line(-1,0){0.1}}
\multiput(5,0)(0.3,0){10}{\line(1,0){0.1}} %the baselines
\put(-8,0){\circle*{0.3}}\put(8,0){\circle*{0.3}}
\put(-5,0){\circle*{0.5}}\put(5,0){\circle*{0.5}}
%the verticle line
\multiput(0,-5)(0,0.5){15}{\line(0,1){0.2}}
%the box and the write up
\linethickness{0.25mm}
\put(-1,2.3){\framebox(2,1.2){$x$}}
%remaining verticle line
\linethickness{0.1mm}
\multiput(0,3.5)(0,0.5){10}{\line(0,1){0.2}}
%% This is the intended shaded area which I am hiding by %
%\begin{shaded}
\put(-9,-4.5){\line(0,1){10}}
\put(-4.75,-4.5){\oval(8.5,1.5)[b]}
\put(-0.5,-4.5){\line(0,1){10}}
\put(-4.75,5.5){\oval(8.5,1.5)[t]}
%\end{shaded}
put(-3,-4){Alice}\put(2,-4){Bob}
\put(-3.8,-2){$\mathcal{H}_A=\mathbb{C}^3$}
\put(1.2,-2){$\mathcal{H}_B=\mathbb{C}^3$}
\put(-8,-2){$\mathcal{H}_A^{aux}$}
\put(7,-2){$\mathcal{H}_B^{aux}$}
\put(-7.5,1.5){$|0\rangle_A\langle0|\quad \otimes$}
\put(3.8,1.5){$\otimes\quad|0\rangle_B\langle0|$}
\end{picture}
\caption{Schematic diagram}
\end{figure}
\end{document}
If I put the shaded
section outside the picture environment, it works and covers the whole figure in a gray shade. As mentioned, I just want a part of the area defined by any contour to be shaded. Is there a way to make this work? This question is partly related to this earlier entry.
NOTE: I am using pdflatex. I wanted to write a few mathematical formulas inside the figure, which is the reason for using picture
environment.
Best Answer
I would suggest you using
TikZ
instead (the code contains some explanatory comments):Notice also that I used the
braket
package.