1

I was trying to draw the figure below. Please avoid the coordinates marked in this figure (:D) enter image description here

My codes are

\documentclass[12pt, a4size]{article}
\begin{document}
 \begin{circuitikz}
  \draw 
        (0,0) -- ++ (2,0)
              -- ++ (0,1) to [nos,l=$y$] -- ++ (1,0)
              -- ++ (0,1) to [nos,l=$z$] -- ++ (2,0)
              -- ++ (0,-1) to (1,0) -- ++ (0,-1)
              ; 
    \end{circuitikz}
 \end{circuitikz}
\end{document}

which is just the above part of the above figure. But error are generating. Package tikz Error: (, +, coordinate, pic, or node expected. -- ++ (0,1) to [nos,l=$y$] - and so many.

What exactly are the mistakes?

2
  • does it look better now -- once you add a component in the circuit you need to finish the syntax line by a coordinate after the component -- -- ++ (0,1) to [nos,l=$y$]++ (1,0) -- after the nos component add the relevant coordinate ++(1,0) without dashes
    – js bibra
    Apr 28, 2021 at 14:42
  • did the answer below meet your requirement -- if so please accept the answer and upvote
    – js bibra
    Apr 29, 2021 at 6:51

1 Answer 1

2

enter image description here

\documentclass[12pt, a4size]{article}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
 \begin{circuitikz}
  \draw 
        (0,0) -- ++ (2,0)
              -- ++ (0,1) to [nos,l=$y$]++ (1,0)
              -- ++ (0,1) to [nos,l=$z$]++ (2,0)
              -- ++ (0,-1) 
              -- ++ (1,0) 
              -- ++ (0,-1)
              -- ++ (1,0)
              ; 
    \end{circuitikz}
\end{document}

complete answer

\documentclass[12pt, a4size]{article}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
 \begin{circuitikz}
  \draw 
        (0,0)   to [short, o-*]         ++ (2,0)        coordinate(in)
                -- ++ (0,1) 
                to [nos,l=$y$, -*]      ++ (2,0)        coordinate(y)
                -- ++ (0,0.5) 
                to [nos,l=$z$]          ++ (2,0)
                to [short,-*]           ++ (0,-0.5) 
                -| ++ (0.5,-1)                          coordinate(out)
                to[short,*-o]           ++(2,0)
        (y)     -- ++(0,-0.5)
                to [nos,l=$x$]          ++(2,0)               
                -- ++ (0,0.5)
        (in)    --++(0,-1)
                to[nos,l=$z$, -*]       ++(2,0)         coordinate(z)   
                -- ++ (0,0.5) 
                to [nos,l=$u$]          ++ (2,0)
                to [short,-*]           ++ (0,-0.5)             
        (z)     -- ++(0,-0.5)
                to [nos,l=$v$]          ++(2,0)               
                -- ++ (0,0.5)
                -|(out)
              ; 
    \end{circuitikz}
\end{document}

enter image description here

2
  • It's very nice. Would you like to tell me what are coordinate(in), coordinate(out)? Also why did you write (y), (z) separately?
    – Manjoy Das
    Apr 28, 2021 at 17:39
  • since we use the notation ++ refers to relative positioning the actual coordinates are not known hence a temporary coordinate in stores the actual coordinate in memory and can be later recalled for further usage -- as far as y z are concerned you can combine them if you so feel
    – js bibra
    Apr 29, 2021 at 0:59

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.