如何进行一些调整并集中这些图表

如何进行一些调整并集中这些图表

这些是我想要重现的图表:

在此处输入图片描述 在此处输入图片描述

这是我所做的:

在此处输入图片描述

我的问题是:

  1. 如何在第二个图表中的每个循环中制作这些箭头。
  2. (如果可能的话)如何在第一个图中减小字母的大小(P、dB 和 ids)。
  3. 如何将我所做的事情集中在同一行。

代码:

\documentclass[11pt]{article}

\usepackage[english]{babel}
\usepackage{array}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows, shapes.arrows,decorations.pathmorphing, matrix,chains,scopes,positioning,fit,shapes.gates.logic.US, shapes.gates.logic.IEC, calc}

\begin{document}

\begin{center}
    \begin{tikzpicture}[baseline=(current bounding box.center)]
    \draw (0,0) .. controls (3,-1.8) and (0.5,-3.2) .. (0.75,-5);
    \draw (0.12,0.06) .. controls (3.12,-1.8) and (0.62,-3.2) .. (0.87,-5);
    \draw[dashed] (1.116,-0.2) -- (1.991,-2.8);
    \draw[thick, ->] (1.65,-1.4188) -- (1.4025,-0.6875);
    \coordinate (P) at (3.6,-2);
    \draw[->] (1.65,-1.4188) -- (P);
    \draw[thick, ->] (1.65,-1.4188) -- (2.3813, -1.6368);
    \draw[line width = 1.15mm] (1.44,-1.35) -- (1.51, -1.56);
    \draw (3.8,-2.08) node {$\times$};
    \draw (3.8,-2.06) circle (0.17cm);
    \coordinate [label=below left:$ds$] (ds) at (1.4,-1.3);
    \coordinate [label=above right:$id\vec{s}$] (ids) at (1.41,-0.7);
    \coordinate [label=below right:$\hat{r}$] (hr) at (1.74,-1.53);
    \coordinate [label=below right:$d\vec{B}$] (hr) at (3.65,-1.27);
    \draw (3.85,-2.55) node {$P$};
    \coordinate [label=above right:$r$] (r) at (2.5,-1.75);
    \draw (1.9242,-1.5006) arc (-15:105:0.3);
    \draw (2.08,-1.03) node {$\theta$};
    \coordinate (ci) at (0.45, -4.7);
    \coordinate (ce) at (0.6, -3.9);
    \draw[->] (ci) to [bend left] node [left] {$i$} (ce);
    \end{tikzpicture}

    \hspace{0.5in}

    \begin{tikzpicture}[baseline=(current bounding box.center)]
    \draw[fill=black] (0,0) circle (0.07cm);
    \draw (0,0) circle (0.15cm);
    \draw (0,0) circle (0.35cm);
    \draw (0,0) circle (0.45cm);
    \draw (0,0) circle (0.55cm);
    \draw (0,0) circle (0.75cm);
    \draw (0,0) circle (1.05cm);
    \draw (0,0) circle (1.45cm);
    \draw (0,0) circle (1.95cm);
    \draw (0,0) circle (2.55cm);
    \draw[thick, ->] (-1.05,0) -- (-1.05,-2) node [above left] {$\vec{B}$};
    \draw[thick, ->] (-2.55,0) -- (-2.55,-0.5) node [left] {$\vec{B}$};
    \draw (0,0) -- (1.4,2.4) node [above right] {wire with current};
    \draw (2.9,2.3) node {out of the page};
    \end{tikzpicture}
    \end{center}

\end{document}

答案1

首先,你可以使用这样的装饰器。首先定义一个

\usetikzlibrary{decorations.markings,arrows.meta,bending}
\tikzset{
  myarrows/.style ={
    postaction=decorate,
    decoration={
      markings,
      mark={between positions 0.001 and 1 step 0.25 with \arrow{Latex[reversed,fill=none,flex]}}
    }
  },
  }

然后使用\foreach类似

\foreach \x in {0.35,0.45,0.55,0.75,1.05,1.45,1.95,2.55}{
      \draw[myarrows] (0,0) circle (\x cm);
    }

arrows.meta提供Latex[reversed,fill=none,flex]bending使箭头更好地对齐flex

其次,您可以将font=\footnotesize(或\small等)传递到相应的节点。

\draw (3.85,-2.55) node[font=\footnotesize] {$P$};

如果您希望所有节点都使用它,请将所有内容放入scope并使用

\begin{scope}[font=\footnotesize]

甚至没有范围

\begin{tikzpicture}[font=\footnotesize]

对于三,如果我理解正确的话(“在同一行”短语),您可以使用范围并将其移动

 \begin{scope}[shift={(8cm,-2.45cm)}]

请注意,我删除了两个tikzpictures 并使用了scope

完整代码:

\documentclass[11pt]{article}

\usepackage[english]{babel}
\usepackage{array}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows, shapes.arrows,decorations.pathmorphing, decorations.markings, matrix,chains,scopes,positioning,fit,shapes.gates.logic.US, shapes.gates.logic.IEC, calc,arrows.meta,bending}

\tikzset{
  myarrows/.style ={
    postaction=decorate,
    decoration={
      markings,
      mark={between positions 0 and 1 step 0.25 with \arrow{Latex[reversed,fill=none,flex]}}
    }
  },
  }

\begin{document}

\begin{center}
    \begin{tikzpicture}[baseline=(current bounding box.center)]
    \begin{scope}[font=\footnotesize]
    \draw (0,0) .. controls (3,-1.8) and (0.5,-3.2) .. (0.75,-5);
    \draw (0.12,0.06) .. controls (3.12,-1.8) and (0.62,-3.2) .. (0.87,-5);
    \draw[dashed] (1.116,-0.2) -- (1.991,-2.8);
    \draw[thick, ->] (1.65,-1.4188) -- (1.4025,-0.6875);
    \coordinate (P) at (3.6,-2);
    \draw[->] (1.65,-1.4188) -- (P);
    \draw[thick, ->] (1.65,-1.4188) -- (2.3813, -1.6368);
    \draw[line width = 1.15mm] (1.44,-1.35) -- (1.51, -1.56);
    \draw (3.8,-2.08) node {$\times$};
    \draw (3.8,-2.06) circle (0.17cm);
    \coordinate [label=below left:$ds$] (ds) at (1.4,-1.3);
    \coordinate [label=above right:$id\vec{s}$] (ids) at (1.41,-0.7);
    \coordinate [label=below right:$\hat{r}$] (hr) at (1.74,-1.53);
    \coordinate [label=below right:$d\vec{B}$] (hr) at (3.65,-1.27);
    \draw (3.85,-2.55) node {$P$};
    \coordinate [label=above right:$r$] (r) at (2.5,-1.75);
    \draw (1.9242,-1.5006) arc (-15:105:0.3);
    \draw (2.08,-1.03) node {$\theta$};
    \coordinate (ci) at (0.45, -4.7);
    \coordinate (ce) at (0.6, -3.9);
    \draw[->] (ci) to [bend left] node [left] {$i$} (ce);
    \end{scope}
    \begin{scope}[shift={(8cm,-2.45cm)}]
    \draw[fill=black] (0,0) circle (0.07cm);
    \draw (0,0) circle (0.15cm);
    \foreach \x in {0.35,0.45,0.55,0.75,1.05,1.45,1.95,2.55}{
      \draw[myarrows] (0,0) circle (\x cm);
    }
    \draw[thick, ->] (-1.05,0) -- (-1.05,-2) node [above left] {$\vec{B}$};
    \draw[thick, ->] (-2.55,0) -- (-2.55,-0.5) node [left] {$\vec{B}$};
    \draw (0,0) -- (1.4,2.4) node [above right] {wire with current};
    \draw (2.9,2.3) node {out of the page};
    \end{scope}
    \end{tikzpicture}
    \end{center}

\end{document}

在此处输入图片描述

相关内容