2

I want to draw a circuit using this code but it gives me errors Where is the problem?.

   \documentclass[preview]{standalone}
        \usepackage[utf8]{inputenc}
        \usepackage{amsmath}
        \usepackage{pst-circ}
        \usepackage{comment}
        \usepackage{cite}
        \usepackage{graphicx}
        \usepackage{tikz}
        \usetikzlibrary{shapes,arrows}

        % For ploting graphs
        \usepackage{amsfonts}
        \usepackage{amssymb}
        \usepackage{pst-plot}
        \usepackage{dashrule}
        \begin{document}
        \begin{figure}
                \begin{center}
               \begin{pspicture}(15,5)                                              
                    % AC Source
                    \pnode(0.5,2){A}
                    \pnode(0.5,0.5){B}          
                    \vco(B)(A){}
                    \newground(B)   


                    \pnode(0.5,3.5){A}                      
                    \pnode(2.5,3.5){B}
                    \resistor[dipolestyle=zigzag,arrows=o](A)(B){$R_{1}$}
                    \pnode(4.5,3.5){AA}
                    \coil[dipolestyle=elektorcurved,arrows=-o](B)(AA){$L_{1}$}
                    \capacitor[parallel](AA)(A){$C$}


                    % Capacitor
                    \pnode(4.5,2){A}
                    \pnode(4.5,0.5){B}          
                    \capacitor(A)(B){$C_1$}
                    \newground(B)       

                    % Second Stage                      
                    \pnode(4.5,3.5){A}                      
                    \pnode(6.5,3.5){B}
                    \resistor[dipolestyle=zigzag,arrows=o](A)(B){$R_{2}$}
                    \pnode(8.5,3.5){AA}
                    \coil[dipolestyle=elektorcurved,arrows=-o](B)(AA){$L_{2}$}  
                    \capacitor[parallel](AA)(A){$C$}                                                

                    % Capacitor
                    \pnode(8.5,2){A}
                    \pnode(8.5,0.5){B}          
                    \capacitor(A)(B){$C_2$}
                    \newground(B)

                    % Multiple Stages
                    \pnode(8.5,3.5){B}                  
                    \pnode(10.5,3.5){A}                             
                    \psline[linestyle=dashed,arrows=-o](B)(A)
                    \pnode(12.5,3.5){B}
                    \resistor[dipolestyle=zigzag](A)(B){$R_{n}$}
                    \pnode(14.5,3.5){AA}
                    \coil[dipolestyle=elektorcurved,arrows=-o](B)(AA){$L_{n}$}
                    \capacitor[parallel](AA)(A){$C$}


                    \pnode(8.5,2){A}
                    \pnode(10.5,2){B}                               
                    \psline[linestyle=dashed,arrows=o-o](B)(A)          

                    \pnode(14,2.25){A}          
                    \pnode(13.75,3.25){B}
                    \pnode(13,4){C}                                 

                    % Capacitor
                    \pnode(14.5,2){A}
                    \pnode(14.5,0.5){B}         
                    \capacitor(A)(B){$C_n$}
                    \newground(B)       

                    % Mutual Impedances
                    \pnode(3.5,3.5){A}
                    \pnode(5.5,4.5){B}
                    \pnode(7.5,3.5){C}
                    \pscurve[linestyle=dashed]{-}(A)(B)(C)  
                    \pnode(5.5,4.75){B}
        %           \rput[cve](B){$R_{12}+j \omega L_{12}$} 
                    \rput[cve](B){$Z_{12}$} 

                    \pnode(8.5,4.5){B}
                    \pnode(13.5,3.5){C}
                    \pscurve[linestyle=dashed]{-}(A)(B)(C)  
                    \pnode(8,4.75){B}
        %           \rput[cve](B){$R_{1n}+j \omega L_{1n}  $}   
                    \rput[cve](B){$Z_{1n}  $}
                    \pnode(7.5,3.5){A}
                    \pnode(10.5,4.75){B}
                    \pnode(13.5,3.5){C}
                    \pscurve[linestyle=dashed]{-}(A)(B)(C)  
                    \pnode(10.5,5){B}
                    %\rput[cve](B){$R_{2n}+j \omega L_{2n}$}
                    \rput[cve](B){$Z_{2n}$} 
                \end{pspicture}
                \caption{ Simplified equivalent circuit of a transformer winding for frequency response analysis}   
                \label{Model_Circ_1}
                \end{center}        
            \end{figure}
        \end{document}
2

The problems come from the fact you use the standalone class, for which the notion of floats is meaningless. I removed everything that was incompatible or irrelevant, and it compiles fine. I added the auto-pst-pdf package to allow direct compilation with pdflatex (you have to launch the compiler with the --enable-write18switch under MiKTeX, -shell-escape with TeX Live or MacTeX to make it work):

\documentclass[border=3pt]{standalone}
    \usepackage[utf8]{inputenc}

    \usepackage{pst-circ, auto-pst-pdf}
    \begin{document}

           \begin{pspicture}(15,5)
                % AC Source
                \pnode(0.5,2){A}
                \pnode(0.5,0.5){B}
                \vco(B)(A){}
                \newground(B)


                \pnode(0.5,3.5){A}
                \pnode(2.5,3.5){B}
                \resistor[dipolestyle=zigzag,arrows=o](A)(B){$R_{1}$}
                \pnode(4.5,3.5){AA}
                \coil[dipolestyle=elektorcurved,arrows=-o](B)(AA){$L_{1}$}
                \capacitor[parallel](AA)(A){$C$}


                % Capacitor
                \pnode(4.5,2){A}
                \pnode(4.5,0.5){B}
                \capacitor(A)(B){$C_1$}
                \newground(B)

                % Second Stage
                \pnode(4.5,3.5){A}
                \pnode(6.5,3.5){B}
                \resistor[dipolestyle=zigzag,arrows=o](A)(B){$R_{2}$}
                \pnode(8.5,3.5){AA}
                \coil[dipolestyle=elektorcurved,arrows=-o](B)(AA){$L_{2}$}
                \capacitor[parallel](AA)(A){$C$}

                % Capacitor
                \pnode(8.5,2){A}
                \pnode(8.5,0.5){B}
                \capacitor(A)(B){$C_2$}
                \newground(B)

                % Multiple Stages
                \pnode(8.5,3.5){B}
                \pnode(10.5,3.5){A}
                \psline[linestyle=dashed,arrows=-o](B)(A)
                \pnode(12.5,3.5){B}
                \resistor[dipolestyle=zigzag](A)(B){$R_{n}$}
                \pnode(14.5,3.5){AA}
                \coil[dipolestyle=elektorcurved,arrows=-o](B)(AA){$L_{n}$}
                \capacitor[parallel](AA)(A){$C$}


                \pnode(8.5,2){A}
                \pnode(10.5,2){B}
                \psline[linestyle=dashed,arrows=o-o](B)(A)

                \pnode(14,2.25){A}
                \pnode(13.75,3.25){B}
                \pnode(13,4){C}

                % Capacitor
                \pnode(14.5,2){A}
                \pnode(14.5,0.5){B}
                \capacitor(A)(B){$C_n$}
                \newground(B)

                % Mutual Impedances
                \pnode(3.5,3.5){A}
                \pnode(5.5,4.5){B}
                \pnode(7.5,3.5){C}
                \pscurve[linestyle=dashed]{-}(A)(B)(C)
                \pnode(5.5,4.75){B}
    % \rput[cve](B){$R_{12}+j \omega L_{12}$}
                \rput[cve](B){$Z_{12}$}

                \pnode(8.5,4.5){B}
                \pnode(13.5,3.5){C}
                \pscurve[linestyle=dashed]{-}(A)(B)(C)
                \pnode(8,4.75){B}
    % \rput[cve](B){$R_{1n}+j \omega L_{1n} $}
                \rput[cve](B){$Z_{1n} $}
                \pnode(7.5,3.5){A}
                \pnode(10.5,4.75){B}
                \pnode(13.5,3.5){C}
                \pscurve[linestyle=dashed]{-}(A)(B)(C)
                \pnode(10.5,5){B}
                %\rput[cve](B){$R_{2n}+j \omega L_{2n}$}
                \rput[cve](B){$Z_{2n}$}
            \end{pspicture}

    \end{document} 

enter image description here

  • Iam using winEdt, how can i launch the compiler with the --enable-write18switch under MiKTeX, -shell-escape with TeX Live or MacTeX? – Misaki Aug 11 '16 at 13:53
  • Nevermind i used this link to enable it tex.stackexchange.com/questions/37489/… – Misaki Aug 11 '16 at 13:57
  • luatex85.sty not found! – Misaki Aug 11 '16 at 14:28
  • Are you under MiKTeX? – Bernard Aug 11 '16 at 14:48
  • @Misaki: B.t.w., what does this code have to do with luatex? – Bernard Aug 11 '16 at 17:37
1

Run the document with xelatex:

\documentclass{article}
%\usepackage[utf8]{inputenc}% UTF8 is the default for xelatex
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{fontspec}
\usepackage{pst-circ}
\usepackage{comment}
\usepackage{cite}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}

% For ploting graphs
\usepackage{pst-plot}
\usepackage{dashrule}
\begin{document}
\begin{figure}
    \centering
    \begin{pspicture}(15.5,5.5)                                              
            % AC Source
            \pnodes(0.5,2){A}(0.5,0.5){B}          
            \vco(B)(A){}
            \newground(B)   

            \pnodes(0.5,3.5){A}(2.5,3.5){B}
            \resistor[dipolestyle=zigzag,arrows=o](A)(B){$R_{1}$}
            \pnode(4.5,3.5){AA}
            \coil[dipolestyle=elektorcurved,arrows=-o](B)(AA){$L_{1}$}
            \capacitor[parallel](AA)(A){$C$}

            % Capacitor
            \pnodes(4.5,2){A}(4.5,0.5){B}          
            \capacitor(A)(B){$C_1$}
            \newground(B)       

            % Second Stage                      
            \pnodes(4.5,3.5){A}(6.5,3.5){B}
            \resistor[dipolestyle=zigzag,arrows=o](A)(B){$R_{2}$}
            \pnode(8.5,3.5){AA}
            \coil[dipolestyle=elektorcurved,arrows=-o](B)(AA){$L_{2}$}  
            \capacitor[parallel](AA)(A){$C$}                                               

            % Capacitor
            \pnodes(8.5,2){A}(8.5,0.5){B}          
            \capacitor(A)(B){$C_2$}
            \newground(B)

            % Multiple Stages
            \pnodes(8.5,3.5){B}(10.5,3.5){A}                             
            \psline[linestyle=dashed,arrows=-o](B)(A)
            \pnode(12.5,3.5){B}
            \resistor[dipolestyle=zigzag](A)(B){$R_{n}$}
            \pnode(14.5,3.5){AA}
            \coil[dipolestyle=elektorcurved,arrows=-o](B)(AA){$L_{n}$}
            \capacitor[parallel](AA)(A){$C$}


            \pnodes(8.5,2){A}(10.5,2){B}                               
            \psline[linestyle=dashed,arrows=o-o](B)(A)          

            \pnodes(14,2.25){A}(13.75,3.25){B}(13,4){C}                                 

            % Capacitor
            \pnodes(14.5,2){A}(14.5,0.5){B}         
            \capacitor(A)(B){$C_n$}
            \newground(B)       

            % Mutual Impedances
            \pnodes(3.5,3.5){A}(5.5,4.5){B}(7.5,3.5){C}
            \pscurve[linestyle=dashed]{-}(A)(B)(C)  
            \pnode(5.5,4.75){B}
            %           \rput[cve](B){$R_{12}+j \omega L_{12}$} 
            \rput[cve](B){$Z_{12}$} 

            \pnodes(8.5,4.5){B}(13.5,3.5){C}
            \pscurve[linestyle=dashed]{-}(A)(B)(C)  
            \pnode(8,4.75){B}
            %           \rput[cve](B){$R_{1n}+j \omega L_{1n}  $}   
            \rput[cve](B){$Z_{1n}  $}
            \pnodes(7.5,3.5){A}(10.5,4.75){B}(13.5,3.5){C}
            \pscurve[linestyle=dashed]{-}(A)(B)(C)  
            \pnode(10.5,5){B}
            %\rput[cve](B){$R_{2n}+j \omega L_{2n}$}
            \rput[cve](B){$Z_{2n}$} 
        \end{pspicture}
    \caption{ Simplified equivalent circuit of a transformer winding for frequency response analysis}\label{Model_Circ_1}        
\end{figure}
\end{document}

enter image description here

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.