[Tex/LaTex] configure dash length in circuitikz

circuitikztikz-pgf

I'm trying to manually set the dash length while using \usepackage{circuitikz}.
I only know about the options \draw[dashed] or \draw[densely dashed] . But how can I get the dashes even shorter? Or even punctuated, something like "\draw[punctuated]".

Here's an example of my code:

\documentclass [a4paper,11pt,oneside]{scrbook}
\usepackage[left=2.5cm,right=2.5cm,top=3.5cm,bottom=3.5cm]{geometry}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[european, siunitx]{circuitikz}
\usepackage{siunitx}
\usepackage{graphicx, pgf, listings, units, hyperref}
\usepackage{float}
    \restylefloat{figure}
\usepackage{amsmath}
\usepackage{bm}     
%-------------------------------------------
\begin{document}
%-------------------------------------------
\begin{figure}[H]
    \centering
\begin{circuitikz}[>=latex]
%--------------BASE CIRCUIT & CELLS-------
\draw
(0,0) -- (5.75,0)
;
\draw[thick]
(5.75,0)
-- (5.75,-0.25)
-- (6.25,-0.25)
-- (6.25,0.25)
-- (5.75,0.25)
-- (5.75,0)
;
\draw
(6.25,0) -- (12,0)
-- (12,1)
to[C, l=$\text{C}_{\text{x}}$] (6,7)
to[C, l=$\text{C}_{\text{n}}$] (0,1)
-- (0,0)
;
\draw[dashed]
(9.5,3.5) -- (10.5,4.5)
(9.5,5.5)-- (8.5,4.5)
;
\draw
(9.5,5.5)
to[pC, l={\tiny{Elko}}] (10.5,4.5)
;
%
\draw[densely dashed]         % This part is supposed to be with shorter dashes
(10.5,4.5) -- (11.5,5.5)
(10.5,6.5) -- (9.5,5.5)
;
\draw
(10.5,6.5)
to[empty diode, l={\tiny{Varicap}}] (11.5,5.5);
;
%
\end{circuitikz}
\caption[\LaTeX: test]{test}
\label{fig:test}
\end{figure}
%------------------------
\end{document}

Is this possible?

Best Answer

You can use the dotted or densely dotted line styles, or you can define your own dash pattern. See page 168, sec. 15.3.2 of the PGF 3.0 manual. Note that I've minimized your preamble to only what is necessary here, and substituted the mathtools package for amsmath.

\documentclass{standalone}
\usepackage{mathtools}
\usepackage[european]{circuitikz}
%-------------------------------------------
\begin{document}
\begin{circuitikz}[>=latex]
%--------------BASE CIRCUIT & CELLS-------
\draw (0,0) -- (5.75,0);
\draw[thick] (5.75,0) -- (5.75,-0.25) -- (6.25,-0.25) -- (6.25,0.25) -- (5.75,0.25) -- (5.75,0);
\draw (6.25,0) -- (12,0) -- (12,1) to[C, l=$\text{C}_{\text{x}}$] (6,7) to[C, l=$\text{C}_{\text{n}}$] (0,1) -- (0,0);
\draw[dashed] (9.5,3.5) -- (10.5,4.5) (9.5,5.5)-- (8.5,4.5);
\draw (9.5,5.5) to[pC, l={\tiny{Elko}}] (10.5,4.5);
%
% \draw[dotted]         % Could be dotted
% (10.5,4.5) -- (11.5,5.5)
% (10.5,6.5) -- (9.5,5.5)
% ;
\draw[dash pattern=on 1pt off 1pt]         % Or you can use dash pattern
(10.5,4.5) -- (11.5,5.5)
(10.5,6.5) -- (9.5,5.5)
;
\draw (10.5,6.5) to[empty diode, l={\tiny{Varicap}}] (11.5,5.5);
%;
%
\end{circuitikz}
%------------------------
\end{document}
Related Question