![我在制作此图时遇到了问题](https://linux22.com/image/342085/%E6%88%91%E5%9C%A8%E5%88%B6%E4%BD%9C%E6%AD%A4%E5%9B%BE%E6%97%B6%E9%81%87%E5%88%B0%E4%BA%86%E9%97%AE%E9%A2%98.png)
我怎样才能在乳胶中绘制这样的图片?
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings}
\begin{document}
\begin{tikzpicture}[every node/.style={draw,outer sep=0pt,thick},place/.style={circle,,thick,
inner sep=0pt,minimum size=6mm}]
\tikzstyle{spring}=[thick,decorate,decoration={zigzag,pre length=0.3cm,post length=0.3cm,segment length=6}]
\tikzstyle{damper}=[thick,decoration={markings,
mark connection node=dmp,
mark=at position 0.5 with
{
\node (dmp) [thick,inner sep=0pt,transform shape,rotate=-90,minimum width=15pt,minimum height=3pt,draw=none] {};
\draw [thick] ($(dmp.north east)+(2.5pt,0)$) -- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$);
\draw [thick] ($(dmp.north)+(0,-5pt)$) -- ($(dmp.north)+(0,5pt)$);
}
}, decorate]
\tikzstyle{ground}=[fill,pattern=north east lines,draw=none,minimum width=0.75cm,minimum height=0.3cm]
\begin{scope}[xshift=7cm]
\node (ground) [ground,anchor=north,minimum width=2cm] {};
\draw (ground.north east) -- (ground.north west);
\node (M) [yshift=-3cm,minimum width=1cm, minimum height=1cm] {$m$};
\draw [spring] (ground.south) -- (M.north);
\node (Pendul) at ( 1,-6) [place] {m};
\draw [thick] (M.south) -- (Pendul.north west);
\end{scope}
\end{tikzpicture}
\end{document}
我得到了这个:
它看起来不太好。我该如何编辑并添加更多细节?
答案1
您的tikzpicture
选项使得无法添加文本,因此我将其限制在一个范围内。(您的原始范围没有执行任何操作。)顺便问一下,那是 1 还是 l?
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings}
\begin{document}
\begin{tikzpicture}
\begin{scope} [every node/.style={draw,outer sep=0pt,thick},place/.style={circle,,thick,
inner sep=0pt,minimum size=6mm}]
\tikzstyle{spring}=[thick,decorate,decoration={zigzag,pre length=0.3cm,post length=0.3cm,segment length=6}]
\tikzstyle{damper}=[thick,decoration={markings,
mark connection node=dmp,
mark=at position 0.5 with
{
\node (dmp) [thick,inner sep=0pt,transform shape,rotate=-90,minimum width=15pt,minimum height=3pt,draw=none] {};
\draw [thick] ($(dmp.north east)+(2.5pt,0)$) -- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$);
\draw [thick] ($(dmp.north)+(0,-5pt)$) -- ($(dmp.north)+(0,5pt)$);
}
}, decorate]
\tikzstyle{ground}=[fill,pattern=north east lines,draw=none,minimum width=0.75cm,minimum height=0.3cm]
\node (ground) [ground,anchor=north,minimum width=2cm] {};
\draw (ground.north east) -- (ground.north west);
\node (M) [yshift=-3cm,minimum width=1cm, minimum height=1cm] {$m$};
\draw [spring] (ground.south) -- (M.north);
\node (Pendul) at ( 1,-6) [place] {m};
\draw [thick] (M.south) -- (Pendul);
\end{scope}
\path (ground.south) -- (M.north) node[midway,right=1mm] {$k$};
\draw (M.east) ++(5mm,0) -- +(5mm,0) coordinate[midway] (temp);
\draw[-latex] (temp) -- +(0,-5mm) node[midway,right] {$x$};
\draw ($(M.south)!.5!(Pendul)$) node[above right] {$l$};
\draw ($(M.south)!.5!(Pendul)$) -- +(1cm,0) node[below, xshift=5mm] {Massless Rod};
\draw[dashed] (M.south) -- +(0,-1cm) node[below] {$\theta$};
\end{tikzpicture}
\end{document}