这是我的代码和结果图。我希望两端的椭圆更小。我该怎么做?
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, positioning, decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}
\tikzstyle{every node}=[inner sep=0mm, outer sep=0mm];
\foreach \x/\y in {1/1, 2/2, 3/1, 4/2, 5/1}
\node[fill=black!30, circle] (m\x) at ({1.5*\x}, 0) {$m_{\y}$};
\foreach \x in {1,2,3,4}
\draw[decorate, decoration={coil,segment length=1.055mm}] (m\x) -- node[yshift=3mm] {$K$} (m\the\numexpr\x+1\relax);
\draw[|<->|] ($ (m2) + (0, -0.4) $) -- node[below] {$d$} ($(m3) + (0, -0.4) $);
\draw (m1) -- +(-0.4, 0) node[left] {$\tiny\cdots$} % how can i make it prettier?
(m5) -- +(0.4,0) node[right] {$\tiny\cdots$}; % here too
\end{tikzpicture}
\end{document}
答案1
数学模式无法识别“常规”字体大小,但有等效的“数学大小”——\scriptstyle
和\scriptscriptstyle
。
示例的这个修订版更改了三行:
- 将使用 的两行
\tiny
替换为 ,\scriptstyle
并在相应的一侧留出一个细小的空格; - 删除行首的分号
\tikzstyle
,以消除恼人的错误消息。
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, positioning, decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}
\tikzstyle{every node}=[inner sep=0mm, outer sep=0mm] %% <--
\foreach \x/\y in {1/1, 2/2, 3/1, 4/2, 5/1}
\node[fill=black!30, circle] (m\x) at ({1.5*\x}, 0) {$m_{\y}$};
\foreach \x in {1,2,3,4}
\draw[decorate, decoration={coil,segment length=1.055mm}] (m\x) -- node[yshift=3mm] {$K$} (m\the\numexpr\x+1\relax);
\draw[|<->|] ($ (m2) + (0, -0.4) $) -- node[below] {$d$} ($(m3) + (0, -0.4) $);
\draw (m1) -- +(-0.4, 0) node[left] {$\scriptstyle\cdots\,$} %% <--
(m5) -- +(0.4,0) node[right] {$\scriptstyle\.\cdots$}; %% <--
\end{tikzpicture}
\end{document}