I want to fit the "N-1" into the box below if possible; if I use the solution \text{-}
, namely 3/{N\text{-}1}
, it gives me an error: Undefined control sequence: } (followed by: )
Is there a way to fix?
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, positioning}
\def\d{0.7cm}
\tikzset{
>=latex,
font=\sffamily,
mybox/.style={rectangle, fill=white, thin, draw, outer sep=0, minimum width = \d, minimum height = \d, inner sep=0},
}
\begin{document}
\begin{tikzpicture}
\foreach\k/\s in {
0/1, 3/{N-1}, 4/{N}
}{
\node[mybox] (bc\k) at ($(-\k*\d, 0)$) {$S_{\s}$};
}
\end{tikzpicture}
\end{document}
\text
isn't defined. Use\textup
instead of\text
and it will work.font=\sffamily\small