我想使用此代码绘制一个电路,但是它给出了错误,问题出在哪里?
\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}
答案1
问题来自于你使用standalone
类的事实,对于该类来说,浮点数的概念是没有意义的。我删除了所有不兼容或不相关的内容,编译得很好。我添加了包auto-pst-pdf
以允许直接编译(你必须使用下的开关pdflatex
启动编译器,使用或才能使其工作):--enable-write18
MiKTeX
-shell-escape
TeX Live
MacTeX
\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}
答案2
使用以下命令运行该文档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}