將電路部件(電容器...)相對放置。使用電路元件的名稱透過「控制」「直觀地」放置網格箭頭

將電路部件(電容器...)相對放置。使用電路元件的名稱透過「控制」「直觀地」放置網格箭頭

這個問題一直是我的其他。由於我的聲譽,我無法對答案添加評論。所以我藉此機會感謝約翰·科米洛他對我最初問題的回答。也很抱歉我的英文不正確。

對於這個問題:

對於電路,我使用circuitikz語法,例如

\begin{circuitikz}
  \draw
  (0,0) to [V = $U$] (0,3)
        to [short, i = $I$, -*] (3,3) -- (6,3)
        to [R = $R_2$, v = $U_2$, i = $I_2$] (6,0) -- (0,0)
  (3,3) to [R = $R_1$, v = $U_1$, i = $I_1$, -*] (3,0);
\end{circuitikz}

這非常簡單且直覺。但是,當我想在電路中添加網格箭頭時,我使用(除了上面的程式碼之外;網格箭頭為例):

\draw
 %
 % mesh one (detailed explanation of the implementation)
 %
 [<-,% direction of the arrow
 > = triangle 45,% kind of the arrow end
 path picture =% allows ''to paint a picture'' inside of an other ''picture''
 {\node[anchor = center]% position of the inner ''picture''
 at (path picture bounding box.center)% bordering rectangle,
                                      % centered inside the arrow (arrow is the outer ''picture'')
 {$M_1$};}]% text of the inner ''picture''
 (1.75,1)% coordinates of the arrow end
 arc% arc-shaped arrow
 (-60:% angle of the arrow start
 170:% angle of the arrow end
 .5);% radius of the arc

有關兩個程式碼段的結果,請參閱上面的連結(我最初的問題)。

「僅僅」一個箭頭的程式碼量對我來說似乎有點太多、複雜而且不直觀。

我想要的是:

1.將電路的各個部分(作為帶有名稱的節點)相對放置,如PGF手冊第 51 頁(第 3.8 小節)中的“Petri-Net”範例:

佩特里網

結合circuitikz語法(請參閱第一個程式碼範例)。

2.使用電路部件的名稱透過宏觀地放置網格箭頭controls(第 748 頁,PGF手冊),就像 John Kormylo 在回答我最初的問題時所做的那樣:

\node (M 3) [below] at (0,0) {\phantom{$M_3$}};% reserving space for M 3 under the circuit
\draw
[->, > = triangle 45] (current bounding box.east) .. controls
                      (current bounding box.south east) ..
                      (M 3.south) node[above, pos = .95] {$M_3$};% see below
% above: location of the inscription ''M_3'' relative to the arrow end
% pos=: location of the inscription ''M_3'' on the ''x''-axis (arrow beginning is zero,
%                                                              arrow end is one)

這可能嗎?如果是這樣,我該怎麼做?我希望你明白我的意圖。

感謝您提前的回答與幫助!

答案1

我沒有將節點放置在圓弧的中心,而是將圓弧放置在節點周圍。結果相同,擊鍵次數較少。還有多種方法可以避免一遍又一遍地重複相同的選項。我使用了範圍,因為更改僅在範圍的持續時間內持續。

大部分簡化是由於刪除了註解。

\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenx}
\usepackage{amsmath}
\usepackage[european]{circuitikz}
\usepackage{showframe}
\begin{document}
  \noindent
  \begin{minipage}[t]{.5\linewidth}
    \begin{circuitikz}[baseline=(current bounding box.north)]
      %
      % circuit
      %
      \draw
      (0,0) to [V = $U$] (0,3)
            to [short, i = $I$, -*] (3,3) -- (6,3)
            to [R = $R_2$, v = $U_2$, i = $I_2$] (6,0) -- (0,0)
      (3,3) to [R = $R_1$, v = $U_1$, i = $I_1$, -*] (3,0);
      %
      % mesh arrows
      %
      \begin{scope}[>=triangle 45]
        \draw[<-] (1.5,1.5) node{$M_1$} +(.25,-.433) arc(-60:170:.5);
        \draw[<-] (4.5,1.5) node{$M_2$} +(.25,-.433) arc(-60:170:.5);
        \node (mesh3) [below] at (0,0) {\phantom{$M_3$}};% reserve space below circuit for M_3
        \draw[->, thick] (current bounding box.east)% not the only way, just easy
          .. controls (current bounding box.south east) .. 
          (mesh3.south) node[above,pos=.9] {$M_3$};
      \end{scope}
    \end{circuitikz}
  \end{minipage}
  \hfill
  \begin{minipage}[t]{.45\linewidth}
    %
    % equations for mesh and knot
    %
    \begin{align*}
      &K  : \quad I   = I_1 + I_2\\
      &M_1: \quad -U  = -U_1\Leftrightarrow U = U_1 = R_1I_1\\
      &M_2: \quad U_1 = -U_2\\
      &M_3: \quad -U  = -U_2\Leftrightarrow U = U_2 = R_2I_2
    \end{align*}
  \end{minipage}
\end{document}

相關內容