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.

\usepackage{amsmath,amscd,amsfonts,amssymb, color}
\usepackage{latexsym, graphicx, rotating,subfig,framed,xcolor,wrapfig}
\multiput(5,0)(0.3,0){10}{\line(1,0){0.1}} %the baselines
%the verticle line
%the box and the write up
%remaining verticle line
%% This is the intended shaded area which I am hiding by %  
\put(-7.5,1.5){$|0\rangle_A\langle0|\quad \otimes$}
    \caption{Schematic diagram} 

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.

  • you are using psfrag and pstricks but you say you are using pdflatex? Commented Jul 20, 2013 at 11:01
  • @DavidCarlisle sorry. i copied the same header. i did not use those packages in the text and so it did not give error. modified the code.
    – RSG
    Commented Jul 20, 2013 at 11:27
  • Perhaps if you tell us your real intent, we can suggest you better alternatives. Your MWE doesn't show anything about formulas, but you mentioned in your NOTE. If we have clarity about what you are trying to achieve, we can suggest you the right approach. Commented Jul 20, 2013 at 22:10
  • @GonzaloMedina I did not write them as I thought it will take more space unnecessarily where as I just wanted to shade a part of it. I am changing the code accordingly hiding the shading by a %
    – RSG
    Commented Jul 21, 2013 at 13:01
  • @rsg I updated my answer using your modified code. Commented Jul 21, 2013 at 17:34

1 Answer 1


I would suggest you using TikZ instead (the code contains some explanatory comments):




% the black circles and their connecting lines
\node[fill,circle,inner sep=1.5pt] (sc1) {};
\node[fill,circle,inner sep=2.5pt,right=1.4cm of sc1] (bc1) {};
\node[fill,circle,inner sep=2.5pt,right=4.5cm of bc1] (bc2) {};
\node[fill,circle,inner sep=1.5pt,right=1.4cm of bc2] (sc2) {};
\path[draw,dashed] (sc1) to (bc1) (sc2) to (bc2) ;
\draw (bc1) -- (bc2);

% labels above
\node[above=of bc1,anchor=east,inner xsep=0pt] {$\ket{0}_A\bra{0}$};
\node[above=of bc1,anchor=west,xshift=10pt] {$\otimes$};
\node[above=of bc2,anchor=west,inner xsep=0pt] {$\ket{0}_B\bra{0}$};
\node[above=of bc2,anchor=east,xshift=-10pt] {$\otimes$};

% labels below
\node[below=of sc1,anchor=west,inner sep=0pt] (ha) {$\mathcal{H}_A^{aux}$};
\node[right=of ha,anchor=west,inner sep=0pt] (hac) {$\mathcal{H}_A=\mathbb{C}^3$};
\node[below=of sc2,anchor=east,inner sep=0pt] (hb) {$\mathcal{H}_B^{aux}$};
\node[left=of hb,anchor=east,inner sep=0pt] (hbc) {$\mathcal{H}_B=\mathbb{C}^3$};
\node[below=0.8cm of hac] (ali) {Alice};
\node[below=0.8cm of hbc] (bob) {Bob};

% the shaded rounded corner rectangle
\coordinate[above=3.5cm of hac] (aux1);
\node[draw,inner sep=10pt,fill=gray!60,fit=(ali) (sc1) (aux1),rounded corners=10pt] (rect) {};

% the dahed line and its label
  let \p1=(bc1), \p2=(bc2) in
  (0.5*\x2+0.5*\x1,0|-rect.south) -- +(0,7cm) coordinate[pos=0.65] (aux2);
\node[draw,fill=white,text width=2em,align=center] at (aux2) {$x$};
\caption{Schematic diagram} 


enter image description here

Notice also that I used the braket package.

  • Thanks for the help. I have started learning TikZ using your code as a model.
    – RSG
    Commented Jul 22, 2013 at 7:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .