我一直在使用 Tikz,并使用该代码创建了以下图表:
\documentclass{article}
\usepackage{tikz}
\usepackage{amssymb}
\usetikzlibrary{arrows}
\begin{document}
\begin{center}
\begin{tikzpicture}
\draw [fill=white!60!white,opacity=1] (-2.99,5.98) -- (2.99,5.98) -- (0,0) -- cycle;
\draw [fill=white!30!white,opacity=1,] (0,6) circle (2.99cm and 0.6cm) node [above] {$A_T$};
\draw [fill=blue!60!white,opacity=1] (-1.49,2.98) -- (1.49,2.98) node [left=1cm, below = 1.5 cm] {\color{blue} $V_0$} -- (0,0) -- cycle;
\draw [fill=blue!30!white,opacity=1,] (0,3) circle (1.49cm and 0.3cm);
\draw (0,0) -- (0,3) [line width = 1.3pt] node [left, below = 1cm] {$h_0$};
\draw (0,3) -- (-1.49, 3) [line width = 1.3pt] node [right = 1cm, above] {$r_0$};
\draw (3mm,6mm) arc [start angle=50, end angle=126, radius = 5mm, line width = 2pt] node [above = 6pt, right] {$\theta$};
\end{tikzpicture}
\end{center}
\end{document}
我真的不擅长使用它,而且它的编码可能很糟糕。我一直在尝试更改文本并使其变大,以便于阅读。此外,我一直试图将 h_0 的文本定位在中间和左侧,但它只考虑一个参数。我做错了什么?
有人能帮我编辑一下文本吗?谢谢
答案1
也许是这个?
\documentclass{article}
\usepackage{tikz}
\usepackage{amssymb}
\usetikzlibrary{arrows}
\begin{document}
\begin{center}
\begin{tikzpicture}
\draw [fill=white!60!white,opacity=1] (-2.99,5.98) -- (2.99,5.98) -- (0,0) -- cycle;
\draw [fill=white!30!white,opacity=1,] (0,6) circle (2.99cm and 0.6cm) node [above] {$A_T$};
\draw [fill=blue!60!white,opacity=1] (-1.49,2.98) -- (1.49,2.98) -- (0,0) -- cycle;
\node[font=\color{blue}] at (-0.4,1.7) {$V_0$};
\draw [fill=blue!30!white,opacity=1,] (0,3) circle (1.49cm and 0.3cm);
\draw[line width = 1.3pt] (0,0) -- node[right] {$h_0$} (0,3) -- node[above] {$r_0$} (-1.49, 3) ;
\draw (3mm,6mm) arc [start angle=50, end angle=126, radius = 5mm, line width = 2pt] node[near end,above] {$\theta$};
\end{tikzpicture}
\end{center}
\end{document}
如果您想增加字体大小,您可以将选项font=\Large
(或任何其他字体开关)传递给节点。
沿着一条路径,您可以放置多个节点,并且可以使用多个修改器控制沿路径的位置:midway
,,,(还有更多可能性;请参阅 PGF 手册):near start
near end
pos=<value>
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{center}
\begin{tikzpicture}
\coordinate (a) at (0,0);
\coordinate (b) at (7,6);
\draw
(a) --
node[midway] {midway}
node[near end] {near end}
(b)
node[near start] {near start}
node[pos=0.333] {pos=0.333};
\begin{scope}[xshift=4cm]
\coordinate (a) at (0,0);
\coordinate (b) at (7,6);
\draw
(a) --
node[midway,left] {midway, left}
node[near end,right] {near end, right}
(b)
node[near start,below=8pt] {near start,below=8pt}
node[pos=0.333,above=6pt] {pos=0.333,above=6pt};
\end{scope}
\end{tikzpicture}
\end{center}
\end{document}