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've just started using Circuitikz and and I'd like to know how one would go about getting a label say, 'v', in the middle of the open circuit (perhaps with a plus and minus either side of it).

Also, is it possible to insert an ammeter or a voltmeter which don't have the diagonal line going through it?

Thanks

Edit:

\begin{circuitikz}[american, scale = 2]\draw
(0,0)       to [sV = $V_m\cos(\omega t + \theta)$]  (0,2)
            to [C = \si{10}{\pico\farad}]           (2,2)
            to [R = \si{250}{\ohm}, *-*]            (2,0)
            to [L = \si{300}{\micro\henry}]         (0,0)
(2,2)       --                                      (4,2)
            to [voltmeter = \si{800}{\nano\farad}]  (4,0)
            --                                      (2,0)
(0,2)       to [short, *-o]                         (0,3)
(2,2)       to [short, -o]                          (2,3)
;\end{circuitikz}

circuit

share|improve this question
3  
Can you include the code that produces this image please so that we can play around with it? –  percusse May 16 '12 at 1:38
    
For getting voltmeters/ammeters without the arrow: tex.stackexchange.com/a/42804/2552 –  Jake May 16 '12 at 5:38
    
Sorry bout that, I've added the code. –  user968243 May 16 '12 at 6:21
    
You can directly use TikZ syntax inside circuitikz env. say \node at (1,3) {$+\; V\; -$};. Also without an arrow measurement units are simply circles hence easy to place it using standard TikZ commands. –  percusse May 16 '12 at 8:33

1 Answer 1

up vote 5 down vote accepted

You should edit the voltmeter definition from the CircuiTikZ code. I did it for you by commenting some lines and adding a new line to rotate the label. Actually I created a new component named myvoltmeter, based on the original. I mirrored the inductor too. Please, use siunitx as explained in the package manual.

\documentclass{article}
\usepackage{siunitx}
\usepackage{circuitikz}
\makeatletter
\def\pgf@circ@myvoltmeter@path#1{\pgf@circ@bipole@path{myvoltmeter}{#1}}
\tikzset{myvoltmeter/.style = {\circuitikzbasekey, /tikz/to
                               path=\pgf@circ@myvoltmeter@path}}
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/voltmeter/height}}{myvoltmeter}
    {\ctikzvalof{bipoles/voltmeter/height}}{\ctikzvalof{bipoles/voltmeter/width}}
{
  \def\pgf@circ@temp{right}
  \ifx\tikz@res@label@pos\pgf@circ@temp
    \pgf@circ@res@step=-1.2\pgf@circ@res@up
  \else
    \def\pgf@circ@temp{below}
    \ifx\tikz@res@label@pos\pgf@circ@temp
      \pgf@circ@res@step=-1.2\pgf@circ@res@up
    \else
      \pgf@circ@res@step=1.2\pgf@circ@res@up
    \fi
  \fi

  \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}     
  \pgfpointorigin   \pgf@circ@res@other =  \pgf@x
  \advance \pgf@circ@res@other by -\pgf@circ@res@up
  \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
  \pgfusepath{draw}

  \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}
                   \pgfstartlinewidth}

  \pgfscope
    \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@up}
    \pgfusepath{draw}       
  \endpgfscope  

  \pgfsetlinewidth{\pgfstartlinewidth}
  \pgftransformrotate{90} % rotate the label
  %\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{.8\pgf@circ@res@up}}
  %\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.8\pgf@circ@res@down}}
  %\pgfusepath{draw}
  \pgfnode{circle}{center}{\textbf{V}}{}{}
  \pgfscope
    % \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{.8\pgf@circ@res@up}}
    % \pgftransformrotate{45}
    % \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
  \endpgfscope

  \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}}
  \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
  \pgfusepath{draw}

  \pgfusepath{stroke}   
}
\makeatother

\begin{document}
\begin{circuitikz}[american, scale = 2]
\draw 
(0,0)       to [sV = $V_m\cos(\omega t + \theta)$]  (0,2) 
            to [C = \SI{10}{\pico F}]               (2,2) 
            to [R = \SI{250}{\ohm}, *-*]            (2,0) 
(0,0)       to [L = \SI{300}{\micro H}]             (2,0) 
(2,2)       --                                      (4,2) 
            to [myvoltmeter]                        (4,0) 
            --                                      (2,0) 
(0,2)       to [short, *-o]                         (0,3) 
(2,2)       to [short, -o]                          (2,3)
(0,3) [yshift=5pt] to [open, v=$v(t)$]              (2,3) 
;
\end{circuitikz} 
\end{document}

share|improve this answer
1  
@percusse, if you comment the empty pgfscope, you'll get two concentric circles. –  Luigi May 16 '12 at 11:33
    
That's strange but I should have run the code before the edit. Sorry. –  percusse May 16 '12 at 11:44
    
Thanks. Is there a way to make the change permanent? (So every time I use Circuitikz, the voltmeters have no line throught them.) –  user968243 May 17 '12 at 6:06
1  
@user968243, just open pgfcircbipoles.sty and comment lines 1049-1051 and 1054-1056 (as I did for my component). –  Luigi May 17 '12 at 10:39

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.