我希望能够为微积分或物理课程创建如下所示的粒子运动图;
这是我发布问题时的情况:
\documentclass[12pt]{article}
enter code here
\usepackage{mathptmx} % rm & math
\usepackage[scaled=0.90]{helvet} % ss
\usepackage{courier} % tt
\normalfont
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{multicol}
\usepackage{graphpap}
\usepackage[normalem]{ulem}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png}
\begin{document}
\begin{tikzpicture}
% an arrow
\draw[-latex][line width=.3mm] (0,0) -- (6,0);
\node at (5.9, -0.3) {$s$};
\node at (1,0) {\circle*{4.0}};
\node at (1, -0.5) {$t = 0$};
\node at (1, -1.0) {$s = 0$};
\node at (5,0) {\circle*{4.0}};
\node at (5, -0.5) {$t = 1$};
\node at (5, -1.0) {$s = 4$};
\end{tikzpicture}
\end{document}
答案1
欢迎来到 TeX.SE!本网站旨在帮助您解决代码问题,而不是将屏幕截图转换为 LaTeX 代码。对于新手,有时会有例外。
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{ arrows.meta,bending,decorations.markings,positioning}
\begin{document}
% from https://tex.stackexchange.com/a/430239/121799
\tikzset{% inspired by https://tex.stackexchange.com/a/316050/121799
arc arrow/.style args={%
to pos #1 with length #2}{
decoration={
markings,
mark=at position 0 with {\pgfextra{%
\pgfmathsetmacro{\tmpArrowTime}{#2/(\pgfdecoratedpathlength)}
\xdef\tmpArrowTime{\tmpArrowTime}}},
mark=at position {#1-\tmpArrowTime} with {\coordinate(@1);},
mark=at position {#1-2*\tmpArrowTime/3} with {\coordinate(@2);},
mark=at position {#1-\tmpArrowTime/3} with {\coordinate(@3);},
mark=at position {#1} with {\coordinate(@4);
\draw[-{Stealth[length=#2,bend]}]
(@1) .. controls (@2) and (@3) .. (@4);},
},
postaction=decorate,
},
fixed arc arrow/.style={arc arrow=to pos #1 with length 2mm}
}
\begin{tikzpicture}[bullet/.style={circle,inner sep=1.5pt,fill}]
\pgfmathsetmacro{\rad}{0.3} % arc radius in cm
\draw[-{Stealth[length=4pt]}] (-1,0) -- (5,0) node[bullet,pos=1/6] (O){}
node[bullet,pos=5/6] (X){} node[pos=1,below]{$s$};
\node[below=0pt of O,align=center]{$t=0$\\ $s=0$};
\node[below=0pt of X,align=center]{$t=1$\\ $s=4$};
\draw[cyan,fixed arc arrow/.list={0.15,0.25,...,0.951}]
(0,0.5) node[bullet]{} to ++(4-\rad,0)
arc(-90:90:\rad) node[midway,bullet]{} to ++(-4+2*\rad,0)
arc(-90:-270:\rad) node[midway,bullet] (b2){} to ++(5-\rad,0);
\node[above=\rad*1cm of b2,align=center]{$t=3$\\ $s=0$};
\end{tikzpicture}
\end{document}