3

I looked into pgfcircbipoles.tex and found values like \ctikzvalof{bipoles/capacitor/height}, but this seems to be factors (?).

How do I draw a line as long and as wide as a capacitor line?

enter image description here

\documentclass[margin=5pt]{standalone}
\usepackage{circuitikz}

\begin{document}

%\def\t{\ctikzvalof{sources/symbol/thickness}}% test
%\def\t{\ctikzvalof{bipoles/cuteswitch/thickness}}% test
\def\t{\ctikzvalof{bipoles/thickness}}% test
\def\h{\ctikzvalof{bipoles/capacitor/height}}% test

\begin{circuitikz}
\draw (0,0) to[capacitor, name=A] (2,0)  to[R] (4,0);

\draw[red, line width=\t, opacity=0.5] (A.north east) node[above, inner sep=0.5pt]{\t=t}
-- +(0,-\h) node[near start, right]{\h=h}; 
\end{circuitikz}

\end{document}

1 Answer 1

5

Unfortunately, width and height are internal parameters, and they have different (slightly so, but still...) meanings for different kinds of capacitors. Therefore, it is better to use only interfaces that are published in the manual; in this case, the best option is to use class parameters, such as capacitors/thickness, and so on. For distances, use only anchors.


\documentclass[margin=5pt]{standalone}
\usepackage{circuitikz}
\ctikzset{capacitors/thickness=2}
\begin{document}
\begin{circuitikz}
    \draw [color=red] (0,0) to[capacitor, name=A] (2,0)  to[R] (4,0);
    \draw [line width=0.8pt] (A.north east) -- (A.right);
    % don't use internal (not published) parameters: they can change without warning
    \draw [blue] (A.north west) -- ++(0, {-1.4cm*\ctikzvalof{bipoles/capacitor/height}});
\end{circuitikz}
\end{document}

C and R with superimposed lines on C

In this case, the thickness is relative to the default TikZ picture thickness (0.4pt by default); the height and width should be relative to the main bipoles/length (which is 1.4cm by default, see 3.1.4.1)

Relevant part of the manual:

Screenshoot of section 4.3.3 of the circuitikz manual

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.