
我認為我可以處理 LaTeX,但用它畫畫確實有問題。我在處理 TikZ 時遇到一些問題。作為練習,我想畫下圖:
也許有人可以告訴我如何用 LaTeX 繪製這個(不一定有框架)?最好的情況是比這個大一點。會非常有幫助,因為我不知道該怎麼做。
答案1
我會走以下路:
- 定義三個點的座標(例如
(0,0)
、(1.5,1)
和(4,2)
)。 - 對於每個座標,繪製一個小實心圓,並在其下方放置一個帶有數學公式的節點。
- 將最終公式放在最後一個座標上方。
- 繪製曲線。這是最困難的部分,因為將座標與曲線路徑連接需要指定控制點(如果繪製為貝塞爾曲線)或每個中間座標處曲線的傳入和傳出角度。我會選擇第二種解決方案。
所以,程式碼可以是
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (1.5,1);
\coordinate (C) at (4,2);
\foreach \coor/\formula in {A/{x=\phi(0;x)},B/{y=\phi(t;x)},C/{\phi(s;x)}} {
\fill (\coor) circle (2pt);
\node[below right, inner xsep=-1ex] at (\coor) {$\formula$};
}
\node[above] at (C) {$\phi(t+s;x)$};
\draw (A) to[in=190] (B) to[out=10, in=220] (C);
\end{tikzpicture}
\end{document}
請注意,應仔細選擇 處的角度(B)
,以便該點的曲線平滑。曲線以 190 度進入 (B),並以 10 度離開,因此兩個方向共線。
答案2
一種稍微不同的處理方式,將路徑指定為貝塞爾曲線,並將點沿曲線定位在所需的「時間」處。此外,還quotes
使用了該庫(和node contents
金鑰),因此需要最新PGF
版本。
\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{quotes}
\begin{document}
\begin{tikzpicture}[mark at/.style={shape=circle, fill, inner sep=1pt, node contents=, pos=#1}]
\draw (0,0) .. controls ++(60:2) and ++(220:2) .. (4,2)
node [mark at=0, "$x=\varphi(0;x)$" below]
node [mark at=1, "$\varphi(s;y)$" below right,
"$\varphi(t+s;x)$" above]
node [mark at=0.3, "$y=\varphi(t;x)$" below right];
\end{tikzpicture}
\end{document}
答案3
使用純 TeX。我試著讓它盡可能短。
\input tikz
\tikz[dot/.style={draw,fill,circle,inner sep=1pt}]{
\draw
(0,0) node[dot,label={below:$x=\phi(0;x)$}] {} .. controls ++(0.7,0.8) ..
(1.5,1) node[dot,label={below:$y=\phi(t;x)$}] {} .. controls ++(1,0.2) ..
(4,2) node[dot,label={below:$\phi(s;x)$},label={above:$\phi(t+s;x)$}] {};
}
\bye
答案4
使用 PSTricks 只是為了好玩。我使用一組非分段函數來更優雅。
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot,pst-eucl}
\def\x[#1]{#1}
\def\y[#1]{(#1-4)^3/30+2}
\begin{document}
\begin{pspicture}[algebraic,PointNameSep=12pt](8,4)
\psparametricplot{1}{7}{\x[t]|\y[t]}
\pstGeonode[
PointName={x=\varphi(0;x),y=\varphi(t;x),\varphi(s;y)},
PosAngle={-90,-90,-45},
]
(*1 {\y[x]}){A}
(*4 {\y[x]}){B}
(*7 {\y[x]}){C}
\uput{6pt}[90](C){$\varphi(t+s;x)$}
\end{pspicture}
\end{document}