TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create a drawing of part of a circuit with 3D perspective like so:

enter image description here

How can this be done?

The main body of the capacitors has now been created in latex, all that remains is to create the line from either side of the shaded circle.

share|improve this question
related: tex.stackexchange.com/questions/104529/… – Jubobs Feb 8 '14 at 15:39
Welcome to TeX.SX. Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. – Jubobs Feb 8 '14 at 16:14
Adam, I'm curious: what is the hashed circle supposed to represent? – Jubobs Feb 9 '14 at 12:06
Its a circular disk that will be used to derive the magnetic field at some distance r from the wire – Adam Feb 9 '14 at 13:40
Some kind of magnetometer? Ok, thanks. – Jubobs Feb 9 '14 at 13:41
up vote 5 down vote accepted

The following should get you started.

Edit: you can control the opacity of draw and fill elements independently, using the draw opacity and fill opacity keys, respectively. See Tikz: use opacity for fill, yet leave draw (lines) untouched for more details.

enter image description here


    mark=at position .3 with {\arrow{triangle 90}}},postaction={decorate}},

\def\Cplanesep{3} % <--- adjust the distance between the planes here
\def\Cwirelen{4}  % <--- adjust the wire length here
\path[use as bounding box]
  ({3-\Cwirelen}, -3) rectangle ({3.2+\Cplanesep+\Cwirelen}, 3.5);
  % necessary for cropping the picture
  % because control points lie way out
  % (dimensions adjusted manually...)
  \begin{scope}[xshift=#1 cm]
  \filldraw[thick,draw=black,fill=gray,fill opacity=.3]
      (2.5,-2.5) --
      (2.5,1)    --
      (4,3)      --
      (4,-0.5)   --
  minimum height = 1.5cm,
  minimum width  = 1cm,
  pattern = north east lines,
  fill opacity = .7,
  rotate       = -20
] (hc) at (1.5,0) {};
  ({3-\Cwirelen},0) -- ++(\Cwirelen,0)
  node[pos=.3,anchor=north] {$I$};
\draw[thick] ({3.2+\Cplanesep},0) -- ++(\Cwirelen,0) ;
  .. controls (6,10) and (5, -9) ..
share|improve this answer
Thanks, i have now got a diagram close to what i wanted to achieve. How should i add further questions with code? Do i edit my original post or post code in a comment reply? – Adam Feb 8 '14 at 16:30
@Adam Your question should be as complete as possible to begin with; it's bad practice to gradually move the goalpost in the same question. However, if the answers you get are missing something important, editing your question for clarification is perfeclty fine and highly encouraged. – Jubobs Feb 8 '14 at 16:34
Perhaps it is best to ask in comment here as the question is only small. I have adjusted the \filldraw[fill=white,opacity=1] to \filldraw[black,fill=gray,opacity=0.3] but it seems this also affects the opacity of the lines surrounding the boxes. How can I make these lines be black with opacity=1? – Adam Feb 8 '14 at 16:37
I am now very close to what i wanted to achieve. The final thing i want to do is draw a line from the top of the hashed circle that then goes inbetween both capacitors and finally connects again to the bottom of the hashed circle. Is there any way to plot custom lines like this? – Adam Feb 8 '14 at 16:54

This code uses hobby tikz library to draw the envelope:

\usetikzlibrary{decorations.markings, arrows,calc,patterns,shapes,hobby,backgrounds}

        decoration={markings, mark=at position .5 with {\arrow{triangle 45}}},
    \coordinate (a) at (0,0);
    \coordinate (b) at (2,0);
    \coordinate (c) at (2,2);
    \coordinate (d) at (0,2);
    \coordinate (a1) at (0.65,0.5);
    \coordinate (b1) at (2.65,0.5);
    \coordinate (c1) at (2.65,2.5);
    \coordinate (d1) at (0.65,2.5);
    \draw[thick,fill=gray!30] (d) -- coordinate(da) (a) -- (a1) -- (d1) -- cycle;
    \draw[thick,fill=gray!30] (b) -- (b1) -- (c1) -- (c) -- cycle;
    \draw[single] (-2,1) -- (da)node[midway,above] {I};
    \draw(2.3,1) -- (4,1);
            minimum height = 1cm,
            minimum width  = 0.5cm, 
            pattern = north east lines,            
            fill opacity = .5,
            rotate       = -10
        ] (el) at (-0.5,1) {};
    \begin{scope}[on background layer]
    \draw (el.north)
        to[curve through={(-0.3,1.7) .. (0.5,2.6) .. (0.6,2.6) ..
                  (0.9,1)   .. (0.75,0) ..

enter image description here

share|improve this answer
Thanks for your answer. I started to work with the other answer before yours but i do appreciate the help. – Adam Feb 8 '14 at 17:48
I --> $I$ :) – Svend Tveskæg Feb 8 '14 at 23:52

With PSTricks.



enter image description here

share|improve this answer
Your plates are transparent.. Wires can be seen through ;) – Harish Kumar Feb 8 '14 at 17:17
@HarishKumar: It can be changed easily later if the OP wants. – kiss my armpit Feb 8 '14 at 17:18

Your Answer


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.