3

Using the following code from the answer to this question, how can I reduce the space between \mu and the +/- signs and \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}

enter image description here

1

You want to use \scriptstyle instead of \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}

enter image description here

Alternatively, with \footnotesize,

\footnotesize\medmuskip=0mu$\mu\plusign\i\sigma$
1

You could just add negative spaces (and also make sure that they appear after the minus).

\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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.