使用以下代码从答案这个问题\mu
,我怎样才能减少和+
/-
符号 之间的间距\i
?
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{verbatim}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{frame}[t]
\frametitle{che}
\begin{tikzpicture}[scale=.86, transform shape]
\draw [thick](0,0) -- (9.,0);
\begin{scope}[xshift=-1.cm, yshift=0cm]
\foreach[count=\j] \i in {-4,...,4}
{\ifnum\i=0
\draw[very thick] (\j*1.134,.15) -- ++(0,-.3) node[yshift=-.4cm]{$\mu$}coordinate(\i);
\else
\ifnum\i>0
\def\plusign{+}
\else
\def\plusign{}
\fi
\draw[very thick] (\j*1.134,.2) -- ++(0,-.4) node[yshift=-.35cm]{\footnotesize$\mu\plusign\i\sigma$}coordinate(\i);
\fi}
\end{scope}
\end{tikzpicture}
\end{frame}
\end{document}
答案1
您想使用\scriptstyle
而不是\footnotesize
。
\documentclass{beamer}
\usepackage{verbatim}
\usepackage{tikz}
\usepackage{pgfplots}
\beamertemplatenavigationsymbolsempty
\begin{document}
\begin{frame}[t]
\frametitle{che}
\begin{tikzpicture}[scale=.86, transform shape]
\draw [thick](0,0) -- (9.,0);
\begin{scope}[xshift=-1.cm, yshift=0cm]
\foreach[count=\j] \i in {-4,...,4}{
\ifnum\i=0
\draw[very thick] (\j*1.134,.15) -- ++(0,-.3)
node[yshift=-.4cm]{$\mu$}coordinate(\i);
\else
\ifnum\i>0
\def\plusign{+}
\else
\def\plusign{}
\fi
\draw[very thick] (\j*1.134,.2) -- ++(0,-.4)
node[yshift=-.35cm]{$\scriptstyle\mu\plusign\i\sigma$}coordinate(\i);
\fi
}
\end{scope}
\end{tikzpicture}
\end{frame}
\end{document}
或者,\footnotesize
使用
\footnotesize\medmuskip=0mu$\mu\plusign\i\sigma$
答案2
您可以添加负空格(并确保它们出现在减号之后)。
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{verbatim}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{frame}[t]
\frametitle{che}
\begin{tikzpicture}[scale=.86, transform shape]
\draw [thick](0,0) -- (9.,0);
\begin{scope}[xshift=-1.cm, yshift=0cm]
\foreach[count=\j] \i in {-4,...,4}
{\ifnum\i=0
\draw[very thick] (\j*1.134,.15) -- ++(0,-.3)
node[yshift=-.4cm]{$\mu$}coordinate(\i);
\else
\ifnum\i>0
\def\plusign{\!+\!\i}
\else
\pgfmathtruncatemacro{\mi}{-\i}
\def\plusign{\!-\!\mi}
\fi
\draw[very thick] (\j*1.134,.2) -- ++(0,-.4)
node[yshift=-.35cm]{\footnotesize$\mu\plusign\sigma$}coordinate(\i);
\fi}
\end{scope}
\end{tikzpicture}
\end{frame}
\end{document}