1

I want to create the following circuit enter image description here

Can someone help me because I have no much experience with Latex. Especially, how can I obtain the yellow colour in the right hand side of the picture. Thanks for any help!

4
  • 3
    If you are using circuitikz, see pages 40-41 and 196 of the manual for fill colors. Any component can be implemented as a node. Labels with arrows can be implemented as separate nodes (TikZ), Mar 30, 2022 at 13:58
  • 2
    See tex.stackexchange.com/questions/200935/… for example. Mar 30, 2022 at 14:03
  • Show us what you try so far. Adding color to "lichtquelle" (light bulb) is not big problem ....
    – Zarko
    Mar 30, 2022 at 15:00
  • @wayne -- for the yellow color lamp please see -- tex.stackexchange.com/a/544692/197451
    – js bibra
    Mar 30, 2022 at 22:50

1 Answer 1

3

Edit: Following @Rmano's comment, I updated the answer inserting \usepackage{circuitikz-1.4.6}. With this version, the fill option worked fine. Figure has also been updated.

A MWE follows. You can choose between the internal label or the alternative with external labels from node and line connecting them to the elements.

\documentclass{article}
%\usepackage{circuitikz}
\usepackage{circuitikz-1.4.6}
\begin{document}
\begin{tikzpicture}[thick]
\draw (0,0) to[normal open switch, *-*, l=Schalter, name=C] ++(0.6,0) -- ++(1.5,0)
  to[lamp, l=Lichtquelle, name=L, fill=yellow] ++(0,-2)
  -| ++(-3.5,0.5)
  to[battery2, l=Spannungquelle, name=S, invert] ++(0,+1) 
  |- (0,0);

% Alternative to l
\draw (-2.5,-2) node[below]{Spannungquelle} -- (S);
\draw (0.3,1) node[above]{Schalter} -- (C);
\draw (2.8,-2) node[below]{Lichtquelle} -- (L);
\end{tikzpicture}
\end{document}

Manually drawn arrows are the alternative ones.

enter image description here

4
  • 1
    Which version are you using? If I compile your code I have: i.stack.imgur.com/K2VXn.png with a yellow lamp.
    – Rmano
    Apr 5, 2022 at 7:53
  • @Rmano, Checking MikTeX console, CircuitikZ version I have is 1.4.6. I searched inside the LaTeX folders, and there are many circuitikz .sty files. So I added the version \usepackage{circuitikz-1.4.6} and now fill applies colors. I will update the answer. Thanks.
    – FHZ
    Apr 5, 2022 at 13:07
  • 1
    that means that you have some "stranded" file with an older version. Please, add This is \pgfcircversion{} on \pgfcircversiondate just after the \begin{document}, check the version printed and find in the .log which file has been really inputted.
    – Rmano
    Apr 5, 2022 at 14:33
  • @Rmano, indeed, versions change accordingly to the \usepackage. I have no idea what MikTeX did. I will check it in depth. Thanks.
    – FHZ
    Apr 5, 2022 at 14:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .