\tikzexternalize 与 \begin{circuitikz} 冲突

\tikzexternalize 与 \begin{circuitikz} 冲突

当我启用\usepgfplotslibrary{external}和时\tikzexternalize,我收到一条错误消息

! Package tikz Error: Sorry, the system call 'pdflatex -halt-on-error -interact
ion=batchmode -jobname "sam2-figure0" "\def\tikzexternalrealjob{sam2}\input{sam
2}"' did NOT result in a usable output file 'sam2-figure0' (expected one of .pd
f:.jpg:.jpeg:.png:). Please verify that you have enabled system calls. For pdfl
atex, this is 'pdflatex -shell-escape'. Sometimes it is also named 'write 18' o
r something like that. Or maybe the command simply failed? Error messages can b
e found in 'sam2-figure0.log'. If you continue now, I'll try to typeset the pic
ture.
See the tikz package documentation for explanation.
Type H <return> for immediate help.
...
l.65 \end{tikzpicture}
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.
Runaway argument?
! File ended while scanning use of \tikzexternal@laTeX@collect@until@end@tikzpi
cture.
<inserted text>
\par
l.65 \end{tikzpicture}
I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.
! Undefined control sequence.
\endtikzpicture ...r@layerlist@globally \endscope
\let \pgf@baseline =\pgf@s...
l.65 \end{tikzpicture}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Extra }, or forgotten \endgroup.
\endpgfpicture ...globally \endgroup \hss \egroup
\pgf@restore@layerlist@fro...
l.65 \end{tikzpicture}
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.
! Missing } inserted.
<inserted text>
}
l.65 \end{tikzpicture}
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.
! Infinite glue shrinkage found in a paragraph.
<inserted text> }
l.65 \end{tikzpicture}
The paragraph just ended includes some glue that has
infinite shrinkability, e.g., `\hskip 0pt minus 1fil'.
Such glue doesn't belong there---it allows a paragraph
of any length to fit on one line. But it's safe to proceed,
since the offensive shrinkability has been made finite.
! Missing } inserted.
<inserted text>
}
l.65 \end{tikzpicture}
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.
! Too many }'s.
\endpgfpicture ...dpicture \endgroup \hss \egroup
\pgfsys@typesetpicturebox ...
l.65 \end{tikzpicture}
You've closed more groups than you opened.
Such booboos are generally harmless, so keep going.
! Extra \endgroup.
\endpgfpicture ...setpicturebox \pgfpic \endgroup
l.65 \end{tikzpicture}
Things are pretty mixed up, but I think the worst is over.
! Extra \endgroup.
\endtikzpicture ...lobal \endpgfpicture \endgroup
l.65 \end{tikzpicture}
Things are pretty mixed up, but I think the worst is over.
! LaTeX Error: \begin{document} ended by \end{tikzpicture}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.65 \end{tikzpicture}
Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.
! Extra \endgroup.
<recently read> \endgroup
l.65 \end{tikzpicture}
Things are pretty mixed up, but I think the worst is over.
! LaTeX Error: \caption outside float.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.66 \caption
{I/O characteristics}
You're in trouble here. Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! Undefined control sequence.
\caption ... \endcsname \fi \fi \@dblarg {\@tempf
\@captype }
l.66 \caption
{I/O characteristics}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
\caption ...e \fi \fi \@dblarg {\@tempf \@captype
}
l.66 \caption
{I/O characteristics}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Infinite glue shrinkage found in a paragraph.
\@endfloatbox ->\par
\vskip \z@skip \@minipagefalse \outer@nobreak \egroup \...
l.68 \end{figure}
The paragraph just ended includes some glue that has
infinite shrinkability, e.g., `\hskip 0pt minus 1fil'.
Such glue doesn't belong there---it allows a paragraph
of any length to fit on one line. But it's safe to proceed,
since the offensive shrinkability has been made finite.
Overfull \hbox (142.48814pt too wide) in paragraph at lines 1--68
[]\OT1/cmr/m/n/10 I need to ex-port the fol-low-ing fig-ure into a sep-a-rate p
df. []
[]
! Too many }'s.
\@endfloatbox ...pagefalse \outer@nobreak \egroup
\color@endbox
l.68 \end{figure}
You've closed more groups than you opened.
Such booboos are generally harmless, so keep going.
! Extra \endgroup.
\color@endgroup ->\endgraf \endgroup
l.68 \end{figure}
Things are pretty mixed up, but I think the worst is over.
! Too many }'s.
\color@endbox ->\color@endgroup \egroup
l.68 \end{figure}
You've closed more groups than you opened.
Such booboos are generally harmless, so keep going.
! LaTeX Error: \begin{document} ended by \end{figure}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.68 \end{figure}
Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.
! Extra \endgroup.
<recently read> \endgroup
l.68 \end{figure}
Things are pretty mixed up, but I think the worst is over.
[1
{C:/ProgramData/MiKTeX/2.9/pdftex/config/pdftex.map}]
Package atveryend Info: Empty hook `BeforeClearDocument' on input line 70.
Package atveryend Info: Empty hook `AfterLastShipout' on input line 70.
(sam2.aux)
Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 70.
Package atveryend Info: Empty hook `AtEndAfterFileList' on input line 70.
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 70.
)
Here is how much of TeX's memory you used:
38031 strings out of 493333
995294 string characters out of 3136585
1166294 words of memory out of 3000000
41098 multiletter control sequences out of 15000+200000
5049 words of font info for 20 fonts, out of 3000000 for 9000
1141 hyphenation exceptions out of 8191
62i,10n,96p,10361b,1071s stack positions out of 5000i,500n,10000p,200000b,50000s
<C:/Program Files (x86)/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmmi10.pfb>
<C:/Program Files (x86)/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmmi7.pfb><C:
/Program Files (x86)/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmr10.pfb><C:/Pr
ogram Files (x86)/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmr7.pfb>
Output written on sam2.pdf (1 page, 46245 bytes).
PDF statistics:
25 PDF objects out of 1000 (max. 8388607)
0 named destinations out of 1000 (max. 500000)
13 words of extra memory for PDF output out of 10000 (max. 10000000)

我的代码如下所示

\documentclass{article}
\usepackage{pgfplots}
\usepackage{float}
%\usepgfplotslibrary{external}
%\tikzexternalize%[shell escape=-enable-write18]%[prefix=Plots/]

\usepackage[american voltages, american currents,siunitx]{circuitikz}

%%My macros
\newcommand\Rlblmos[1]{($(M#1.G)+(1.3,-0.2)$) node [below] {$M_{#1}$}}
\newcommand\Llblmos[1]{($(M#1.G)+(-1.3,-0.2)$) node [below] {$M_{#1}$}}
\newcommand\lblvdd[2]{(M#1.#2)node [rground,yscale=-1] (vdd){}
            ($(M#1.#2)+(0,0.75)$) node[right]{$V_{DD}$}}

\begin{document}
Hi there....
\begin{figure}[H]
    \centering
    \begin{circuitikz}[american,scale=1]
        \ctikzset{tripoles/mos style/arrows}
        \def\Ba{0,.5} % This also works

        \draw 
        (\Ba)node[ground]{}

        ($(\Ba)+(0,2)$) node[](vp){} to [I, l=$I_{SS}$] (\Ba){}
        %define locations of MOS
        ($(vp)+(-2.5,1)$) node[nmos](M1){}\Rlblmos{1}
        ($(vp)+(2,1)$) node[nmos,xscale=-1](M2){}\Llblmos{2}
        ($(vp)+(-1.5,5)$) node[pmos,emptycircle,xscale=-1](M3){}\Llblmos{3}
        ($(vp)+(2,5)$) node[pmos,emptycircle](M4){}\Rlblmos{4}

        (M4.S)node[circ](vdd3){}
        (M3.S)node[circ](vdd2){}
        (M1.S)|-(vp)node [circ] {}
        (M2.S)|-(vp)
        (M3.D)--($(M3.D)+(0,-.5)$)node[circ]{} to [I,l=$I_O$] ($(M3.D)+(0,-2.5)$) node[ground]{}
        (M3.G)--(M4.G)
        ($(M3.D)+(0,-.5)$)-|($(M3.G)!0.5!(M4.G)$)node[circ]{}
        (M4.D)--($(M4.D)!0.5!(M2.D)$)node (vout){}--(M2.D)
        (vout)node[circ]{}--($(vout)+(0.5,0)$) node[circ]{} node[right] {$V_{\mathrm{out}}$}
        ($(M3.S)+(-1,0)$)node[circ](vdd1){}--(M1.D)
        (M1.G)node[circ]{}node[left]{$V_{in1}$}
        (M2.G)node[circ]{}node[right]{$V_{in2}$}
        ;
        \draw[line width=0.5mm]($(vdd1)+(-0.5,0)$)--($(vdd3)+(0.5,0)$);

    \end{circuitikz}

    \caption{Differential Amp with active load}
    \label{DiffAmp1}
\end{figure}
I need to export the following figure into a separate pdf.
\begin{figure}[H]
\begin{tikzpicture} 
    \begin{axis}[axis x line=middle, axis y line=middle, xmin=-3, xmax=3, ymin=0, ymax=3, 
      title={Large signal I-O characteristics},
      xlabel={$v_{id}$},
      ylabel={$v_{od}$},
      yticklabels={}, xticklabels={}]
    \addplot[domain=-3:3]{1+tanh(x)};
    \addplot[red,dashed,domain=0:3]{2}; %1+tanh(x)

    \end{axis}
\end{tikzpicture}
\caption{I/O characteristics}
\label{IO}
\end{figure}

\end{document}

答案1

似乎 circuitikz 和 tixexternalize 以我无法理解的方式产生了冲突。但是,circuitikz 命令也可以在标准 tikzpicture 环境中使用,如下文详细讨论:

使用 -shell-escape 编译 CircuiTikZ (pdflatex)

因此,只需将您的脚本更改\begin{circuitikz} ... \end{circuitikz}\begin{tikzpicture}...\end{tikzpicture},您的脚本就可以工作。

相关内容