更新 #

更新 #

我正在尝试使用circuitTikZ/PGF 2.1 中的库,但是调用 LaTeX 时出现以下错误:

("C:\Documents and Settings\s0237326\Application Data\MiKTeX\2.9\tex\generic\pg
f\frontendlayer\tikz\tikz.code.tex"
Package: tikz 2010/10/13 v2.10 (rcs-revision 1.76)

("C:\Documents and Settings\s0237326\Application Data\MiKTeX\2.9\tex\generic\pg
f\libraries\pgflibraryplothandlers.code.tex"
File: pgflibraryplothandlers.code.tex 2010/05/31 v2.10 (rcs-revision 1.15)
\pgf@plot@mark@count=\count90
\pgfplotmarksize=\dimen140
)
\tikz@lastx=\dimen141
\tikz@lasty=\dimen142
\tikz@lastxsaved=\dimen143
\tikz@lastysaved=\dimen144
\tikzleveldistance=\dimen145
\tikzsiblingdistance=\dimen146
\tikz@figbox=\box33
\tikz@tempbox=\box34
\tikztreelevel=\count91
\tikznumberofchildren=\count92
\tikznumberofcurrentchild=\count93
\tikz@fig@count=\count94

("C:\Documents and Settings\s0237326\Application Data\MiKTeX\2.9\tex\generic\pg
f\modules\pgfmodulematrix.code.tex"
File: pgfmodulematrix.code.tex 2010/08/24  (rcs-revision 1.4)
\pgfmatrixcurrentrow=\count95
\pgfmatrixcurrentcolumn=\count96
\pgf@matrix@numberofcolumns=\count97
)
\tikz@expandcount=\count98

("C:\Documents and Settings\s0237326\Application Data\MiKTeX\2.9\tex\generic\pg
f\frontendlayer\tikz\libraries\tikzlibrarytopaths.code.tex"
File: tikzlibrarytopaths.code.tex 2008/06/17 v2.10 (rcs-revision 1.2)
)))
("C:\Documents and Settings\s0237326\Application Data\MiKTeX\2.9\tex\generic\pg
f\frontendlayer\tikz\libraries\circuits\tikzlibrarycircuits.code.tex"
("C:\Documents and Settings\s0237326\Application Data\MiKTeX\2.9\tex\generic\pg
f\frontendlayer\tikz\libraries\tikzlibrarydecorations.markings.code.tex"
("C:\Documents and Settings\s0237326\Application Data\MiKTeX\2.9\tex\generic\pg
f\frontendlayer\tikz\libraries\tikzlibrarydecorations.code.tex"
("C:\Documents and Settings\s0237326\Application Data\MiKTeX\2.9\tex\generic\pg
f\modules\pgfmoduledecorations.code.tex"
\pgfdecoratedcompleteddistance=\dimen147
\pgfdecoratedremainingdistance=\dimen148
\pgfdecoratedinputsegmentcompleteddistance=\dimen149
\pgfdecoratedinputsegmentremainingdistance=\dimen150
\pgf@decorate@distancetomove=\dimen151
\pgf@decorate@repeatstate=\count99
\pgfdecorationsegmentamplitude=\dimen152
\pgfdecorationsegmentlength=\dimen153
)
\tikz@lib@dec@box=\box35
)
("C:\Documents and Settings\s0237326\Application Data\MiKTeX\2.9\tex\generic\pg
f\libraries\decorations\pgflibrarydecorations.markings.code.tex"))
("C:\Documents and Settings\s0237326\Application Data\MiKTeX\2.9\tex\generic\pg
f\frontendlayer\tikz\libraries\tikzlibrarycalc.code.tex"
File: tikzlibrarycalc.code.tex 2009/09/04 v2.10 (rcs-revision 1.6)
)
\tikz@lib@circ@count=\count100
\tikzcircuitssizeunit=\dimen154
)
("C:\Documents and Settings\s0237326\My Documents\LaTeX\tikz_circuit_error.aux"
)
LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
 ABD: EveryShipout initializing macros

! I can't find file `tikzlibrarycircuit.code.tex'.
<argument> ...nput tikzlibrary\pgf@temp .code.tex 
                                                  \catcode `\@ =\csname tikz...
l.227 ....misc,calc,positioning,plotmarks,circuit}

Please type another input file name
! Emergency stop.
<argument> ...nput tikzlibrary\pgf@temp .code.tex 
                                                  \catcode `\@ =\csname tikz...
l.227 ....misc,calc,positioning,plotmarks,circuit}

*** (job aborted, file error in nonstop mode)

我在 Windows XP 上使用 MiKTeX 2.9。

tikzlibrarycircuits.code.tex现在目录中出现了一个名为的文件C:\Documents and Settings\User\Application Data\MiKTeX\2.9\tex\generic\pgf\frontendlayer\tikz\libraries\circuits(而不是错误中tikzlibrarycircuit.code.tex没有提到的)。从文件名中删除会导致相同的错误,所以我认为 LaTeX 查找的目录不对。我也不知道您如何查看 LaTeX 实际查找的目录,因为命令被截断了,如上所示。ss

这是中的错误吗tikz?我该如何修复它?

更新 #

下面是一个演示错误的简单例子:

\documentclass{minimal}

\usepackage{tikz}
\usetikzlibrary{circuit}

\begin{document}
\begin{tikzpicture}[circuit ee IEC, scale=1.2]
        \draw (0,0) to [diode] (0,2) 
\end{tikzpicture}

\end{document}

替换\usetikzlibrary{circuit}\usetikzlibrary{circuits}将得到以下输出:

! Package pgfkeys Error: I do not know the key '/tikz/circuit ee IEC' and I am 
going to ignore it. Perhaps you misspelled it.

See the pgfkeys package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.7 \begin{tikzpicture}[circuit ee IEC, scale=1.2]

This error message was generated by an \errmessage
command, so I can't give any explicit help.
Pretend that you're Hercule Poirot: Examine all clues,
and deduce the truth by order and method.


! Package pgfkeys Error: I do not know the key '/tikz/diode' and I am going to 
ignore it. Perhaps you misspelled it.

See the pgfkeys package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.8         \draw (0,0) to [diode] (0,2)
                                   ;
(That was another \errmessage.)

[1]
("C:\Documents and Settings\s0237326\My Documents\LaTeX\tikz_circuit_error.aux"
) ) 

答案1

我强烈怀疑您正在加载错误的 TikZ 库来完成您打算做的事情。

这是 TikZ 库的一个相当简单的工作示例circuits(基本上是从手册中复制并制作成完整的文档)。尝试运行它,看看是否仍然会出错。特别要注意正在加载的库的名称。

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{circuits.ee.IEC}

\begin{document}
\begin{tikzpicture}[circuit ee IEC]
\draw (0,0) to [diode={light emitting}] (3,0)
  to [resistor={adjustable}] (3,3)
;
\end{tikzpicture}
\end{document}

结果:

TikZ 与电路

答案2

l.227 ....杂项、计算、定位、绘图标记、电路}

我认为这是其中的一部分\usetikzlibrary{....misc,calc,positioning,plotmarks,circuit}。请始终添加最小工作示例(MWE)这说明了您的问题,而不仅仅是代码片段或错误消息。

circuits不应该circuit。将库文件手动重命名tikzlibrarycircuits.code.textikzlibrarycircuit.code.tex首先是一个非常糟糕的主意,并且 (La)TeX 不会注意到它,直到您更新文件名缓存(名为 的文件)。 (La)TeX 不会直接搜索文件,因为那样会很慢,而是使用此类文件。如果不存在文件,ls-R现代版本实际上会在每次运行中搜索用户 TEXMF 树以查找这些文件。ls-R

只需更改circuitcircuits即可解决此问题。如果您因任何奇怪原因无法更改代码,请通知原作者。一种解决方法是将一个名为 的文件放在tikzlibrarycircuit.code.tex文档\usetikzlibrary{circuits}的同一目录中或本地 TEXMF 树中(在子目录中tex/latex/pgf/)。

相关内容