在图片中,LaTeX 实现了我想要的效果,但效果并不明显。我希望箭头一直延伸到圆圈的中间,但向下时长度会减小。这是我的代码。如果我尝试运行它,就会出现错误。我无法发布其余代码,因为它是我论文的一部分,包含敏感信息。
\begin{minipage}[h!]{0.8\linewidth}
\centering
\hspace*{1cm}\raisebox{-15cm}{\begin{tikzpicture}[scale=2,baseline={(10,-10)},>=stealth]
\draw (-60pt,0) circle [radius=40pt];
\draw (-60pt,40pt) -- (-60pt,-40pt);
%\newcounter{\x}{20pt}
\foreach \x/\y in {-80/40,-79/38,-78/36,...,-60/0}
{
\draw [->,line width=1pt] (-60pt,\y pt) -- (\x pt,\y pt);}
\foreach \y in {0,-2,-4,...,-40}
{
\draw [->,line width=1pt] (-60pt,\y pt) -- (-40pt,\y pt);}
\draw (60pt,0) circle [radius=40pt];
\draw (60pt,0) circle [radius=25pt];
\draw (60pt,40pt) -- (60pt,-40pt);
\foreach \y in {40,38,36,...,26}
{
\draw [->,line width=1pt] (60pt,\y pt) -- (40pt,\y pt);}
\foreach \y in {-26,-28,-30,...,-40}
{
\draw [->,line width=1pt] (60pt,\y pt) -- (80pt,\y pt);}
%\draw [->,line width=1pt] (-60pt,40pt) -- (-80pt,40pt);
\end{tikzpicture}}
\end{minipage}
答案1
您的代码不起作用,因为重复语法...
专门用于循环的情况单变量. 循环播放时二变量,你必须列出全部您想要循环的元素。
我已经完全重写了代码:
- 圆心现在是原点
(0,0)
,这使得很容易形成中心对称(0,0)
。 - 我只循环一个变量:另一个变量可以很容易地从第一个变量中推导出来。
翻译www.DeepL.com/Translator(免费版)
\documentclass[border=5mm,tikz]{standalone}
\begin{document}
\begin{tikzpicture}[scale=2,>=stealth,tips=on proper draw]
\draw (0,0) circle [radius=40pt];
\draw (0,40pt) -- (0,-40pt);
\foreach \x [evaluate=\x as \y using int(2*\x)] in {1,...,20}
{ \draw [->,line width=1pt] (0, \y pt) --++ (-\x pt , 0);
\draw [->,line width=1pt] (0,-\y pt) --++ (\x pt, 0);
}
\end{tikzpicture}
\end{document}