1

I'm having trouble when trying to position a label of a circuit element in \draw mode.

\documentclass{article}
\usepackage{tikz}
\usepackage[american, siunitx]{circuitikz}

\begin{document}

\begin{figure*}[h]
\centering
\begin{tikzpicture} \draw
(0,0) node[ocirc]{Anode} to[short,i=$i'_D$] (1,0) to[empty diode, v=$v'_D$] 
(3,0) node[ocirc]{Cathode};
%\node at (0,0) [left] {Anode};
%\node at (3,0) [right] {Cathode};
\end{tikzpicture}
\caption*{Figure: Diode}
\end{figure*}

\end{document}

enter image description here

The only alternative I can think of is placing and labeling individual nodes (commented) but I was just wondering if there was a more efficient way. I tried node[ocirc, left] but that wouldn't compile & I'm unsure why, is it because nodes must be dealt with differently in the draw mode?

Best regards, Matthew

1

Probably better to use a label for the node. The custom node types from circuitikz is intended to only generate the shape I believe, not include text.

Regarding why node[ocirc,left] didn't work, the error message you get gives a hint, in that it says east is not known. The left option sets anchor=east, but apparently the ocirc node doesn't define any anchor called east, and hence you get an error.

\documentclass{article}
\usepackage[american, siunitx]{circuitikz}

\begin{document}

\begin{figure*}
\centering
\begin{tikzpicture} \draw
(0,0) node[ocirc,label=left:Anode]{} to[short,i=$i'_D$] (1,0) to[empty diode, v=$v'_D$] 
(3,0) node[ocirc,label=right:Cathode]{};
\end{tikzpicture}
\caption*{Figure: Diode}
\end{figure*}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.