1

我正在使用 circuitikz 绘制一个如图所示的小电路,但是电阻器 R 1没有平滑地连接到周围的线路。

在此处输入图像描述

用于生成此图的代码是

\documentclass[border=1mm]{standalone}

\usepackage{amsmath, amssymb, mathtools}
\usepackage{siunitx}

\usepackage[]{circuitikz}
\usetikzlibrary{positioning, calc}
\newcommand\myVoltageBuffer[2]{%
    %1: ID amplifier, %2 start coordinate
    \draw #2 coordinate(opamp#1-in)
        to[short]
            ++(1,0) node[op amp, noinv input up, anchor=+](opamp#1){$A_#1$}
            (opamp#1.-) -- ++(0,-1) coordinate(opamp#1-feedback)
            (opamp#1-feedback) -| (opamp#1.out)
        to [short, *-]
            ++(1,0) coordinate(opamp#1-out);
}

\newcommand\myDRL[6]{%
    %1: ID amplifier, %2 start coordinate, %3 R gain %4 R series, %5 C series, %6 R parallel
    \draw #2 coordinate(opamp#1-in)
        to[R=#3] ++(1,0)
        to [short]
            ++(1, 0) node[op amp, anchor=+](opamp#1){$A_#1$}

        (opamp#1.-) -- ++(0, 1) coordinate(opamp#1-feedback)
        to [short, -*] ++(0, 0)
        to [R=#4] ++(1.5, 0)
        to [C=#5] ++(1.5, 0)
        to [short, -*] ++(0, 0) coordinate(opamp#1-feedback-C-point)

        (opamp#1-feedback) -- ++(0, 1.5)
        to [R=#6] ++(3, 0) -| (opamp#1-feedback-C-point)
        to [short, -*] ++(0, -1.5) coordinate(opamp#1-last-bullet)

        (opamp#1.out) -- (opamp#1-last-bullet) -- ++(1, 0) coordinate(opamp#1-out);
}
\begin{document}
\begin{circuitikz}[american, transform shape, use fpu reciprocal,]
    \myVoltageBuffer{1}{ (0, 0) }{}{}
    \node [ocirc] at (opamp1-in) {};

    \myDRL{2}{ (opamp1-out) }{ $R_1$ }{ $R_s$ }{ $C_s$ }{ $R_{\parallel}$ }
    \node [ocirc] at (opamp2-out) {};
\end{circuitikz}
\end{document}
4

1 回答 1

1

您可以稍微调整 DRL 的坐标以使电阻器的间隙足够大(例如,至少一个bipoles/length,默认为 1.4 厘米):

\documentclass[border=1mm]{standalone}

\usepackage{amsmath, amssymb, mathtools}
\usepackage{siunitx}

\usepackage[]{circuitikz}
\usetikzlibrary{positioning, calc}
\newcommand\myVoltageBuffer[2]{%
    %1: ID amplifier, %2 start coordinate
    \draw #2 coordinate(opamp#1-in)
        to[short]
            ++(1,0) node[op amp, noinv input up, anchor=+](opamp#1){$A_#1$}
            (opamp#1.-) -- ++(0,-1) coordinate(opamp#1-feedback)
            (opamp#1-feedback) -| (opamp#1.out)
        to [short, *-]
            ++(1,0) coordinate(opamp#1-out);
}

\newcommand\myDRL[6]{%
    %1: ID amplifier, %2 start coordinate, %3 R gain %4 R series, %5 C series, %6 R parallel
    \draw #2 coordinate(opamp#1-in)
        to[R=#3] ++(1.4,0)
        to [short]
            ++(1, 0) node[op amp, anchor=+](opamp#1){$A_#1$}

        (opamp#1.-) -- ++(0, 1) coordinate(opamp#1-feedback)
        to [short, -*] ++(0, 0)
        to [R=#4] ++(1.5, 0)
        to [C=#5] ++(1.5, 0)
        to [short, -*] ++(0, 0) coordinate(opamp#1-feedback-C-point)

        (opamp#1-feedback) -- ++(0, 1.5)
        to [R=#6] ++(3, 0) -| (opamp#1-feedback-C-point)
        to [short, -*] ++(0, -1.5) coordinate(opamp#1-last-bullet)

        (opamp#1.out) -- (opamp#1-last-bullet) -- ++(1, 0) coordinate(opamp#1-out);
}
\begin{document}
\begin{circuitikz}[american, transform shape, use fpu reciprocal,inner sep=0pt,outer sep=0pt]
    \myVoltageBuffer{1}{ (0, 0) }{}{}
    \node [ocirc] at (opamp1-in) {};

    \myDRL{2}{ (opamp1-out) }{ $R_1$ }{ $R_s$ }{ $C_s$ }{ $R_{\parallel}$ }
    \node [ocirc] at (opamp2-out) {};
\end{circuitikz}
\end{document}

在此处输入图像描述

或者,您可以使用\ctikzset{resistors/scale=0.7}使电阻器更小,以便它仍然适合您给它的微小间隙。

于 2021-11-28T15:21:46.690 回答