段落在 \tikz@intersect@path@names@parse 完成之前结束

段落在 \tikz@intersect@path@names@parse 完成之前结束

梅威瑟:

\documentclass[]{article}

\usepackage{tikz}
\usetikzlibrary{calc,intersections,through,backgrounds,matrix,patterns}
\usepackage[normalem]{ulem}
\usetikzlibrary{decorations.pathreplacing}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage{pdfpages}

\begin{document}


\begin{tikzpicture}[scale=1.2]
\footnotesize   

\draw[<->] (0,3.6) node[above]{$y$}--(0,0)--(5,0) node[right]{$x$};

\draw[red, name path=D, dashed] (0,0)--(3.5,3.5);

\foreach \i in {1,2,3}{
    \draw[name path global = I\i] (0,0) plot [domain=0.4+(\i-1)*0.38:4.7] (\x,\i*1.4/\x) node[right]{I$_\i$};
    \path [name intersections={of=I\i and D,by=P\i}];
    \draw[fill,red] (P1\i) circle[radius=1.3pt] node[above,red, shift={(0,0.1)}]{\i};
}
\end{tikzpicture}

\end{document}

我收到错误:

段落在 \tikz@intersect@path@names@parse 完成之前结束。

为什么会发生这种情况?我以前使用过类似的循环,没有任何问题。事实上,如果你删除循环中的最后两行,然后执行:

\begin{tikzpicture}[scale=1.2]
\footnotesize   

\draw[<->] (0,3.6) node[above]{$y$}--(0,0)--(5,0) node[right]{$x$};

\draw[red, name path=D, dashed] (0,0)--(3.5,3.5);

\foreach \i in {1,2,3}{
    \draw[name path global = I\i] (0,0) plot [domain=0.4+(\i-1)*0.38:4.7] (\x,\i*1.4/\x) node[right]{I$_\i$};
}
\end{tikzpicture}

编译时没有任何问题。

答案1

逆转 I\i并 D解决你的问题:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}[scale=1.2]
\footnotesize   
\draw[<->] (0,3.6) node[above]{$y$}--(0,0)--(5,0) node[right]{$x$};
\draw[red, name path=D, dashed] (0,0)--(3.5,3.5);
\foreach \i in {1,2,3}{
    \draw[name path global = I\i] (0,0) plot [domain=0.4+(\i-1)*0.38:4.7] (\x,\i*1.4/\x) node[right]{I$_\i$};
    \path [name intersections={of=D and I\i,by=P\i}];
    \draw[fill,red] (P\i) circle[radius=1.3pt] node[above,red, shift={(0,0.1)}]{\i};% <- What is P1\i???
}
\end{tikzpicture}
\end{document}

蒂克兹

或者,你应该I\i用一对来 包围你{}

\path[name intersections={of={I\i} and D,by=P\i}];

但我会重新参数化函数f(x) = \i*1.4/x。请注意上图中左边的凌乱会产生难看的直线段。那么,为什么不使用<input> = sqrt(\i*1.4) * exp(x)<output> = sqrt(\i*1.4) * exp(-x),这样它们的乘积就是常数 \i*1.4呢?

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}[scale=1.2]
\footnotesize   
\draw[<->]
  (0,3.6) node[above] {$y$} --
  (0,0) --
  (5,0) node[right] {$x$};
\draw[red,name path=D,dashed]
  (0,0) -- (3.5,3.5);
\foreach \i in {1,2,3} {
  \draw[name path global=I\i]
    (0,0) plot[domain={ln(2*sqrt(\i/35))}:{ln(47/2/sqrt(35*\i))}]
            ({sqrt(\i*1.4)*exp(\x)},{sqrt(\i*1.4)*exp(-\x)}) node[right] {$I_\i$};
  \path[name intersections={of=D and I\i,by=P\i}];
  \draw[fill,red]
    (P\i) circle[radius=1.3pt]
          node[above,red,shift={(0,0.1)}] {\i};
}
\end{tikzpicture}
\end{document}

tikz2

相关内容