所以我试着画一张 tikz 图片
因此begin{document}
,我写道
\begin{figure}[h!]
\centering
\resizebox{0.4\textwidth}{!}{\input{ball_MSD.tikz}\unskip}
\caption{Mass Spring Damper system at $t=t_1$}
\end{figure}
ball_MSD.tikz
我已经把
\usetikzlibrary{calc,patterns,
decorations.pathmorphing,
decorations.markings}
\begin{tikzpicture}[
force/.style={>=latex,draw=blue,fill=blue},
displacement/.style={>=latex,draw=brown,fill=brown},
plane/.style={draw=black,fill=blue!10},
]
\tikzstyle{spring}=[minimum width = 1cm,decorate,decoration={zigzag, pre length=0.2cm,post length=0.2cm,segment length=3}]
\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=0.5cm,minimum height=0.25cm,draw=none] {};
\draw [thick] ($(dmp.north east)+(2pt,0)$) -- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$);
\draw [thick] ($(dmp.north)+(0,-5pt)$) -- ($(dmp.north)+(0,5pt)$);
}}, decorate]
\node[name=s,shape=rectangle,fill=black!30, minimum height=1cm, minimum width=2cm] at (0cm,1.5cm) {};
\draw[plane] (-2cm,0) to (2cm,0);
\draw[force,->] (s.center) -- ++(0cm,-2.5cm) node[right, near end] {$F_w=mg$};
\draw[spring] ($(s.south) - (0.75cm,0)$) -- ($(0,0) - (0.75cm,0)$);
\draw[damper] ($(s.south) + (0.75cm,0)$) -- ($(0,0) + (0.75cm,0)$);
\end{tikzpicture}
尽管我已将代码居中,但是却tikzpicture
向右移动,而却caption
没有。
没有错误消息并且我正在使用该类memoir
。