I'm trying to incorporate tikz nodes within running text, but have them align nicely with the text surrounding them. My MWE is:
% !TEX program = xelatex
\documentclass{scrbook}
\usepackage{tikz}
\begin{document}
Some text \tikz \node[rectangle,rounded corners=0.5mm,text=white,fill=black!65,inner sep=2pt] {\scriptsize{}foo}; more text.
\end{document}
This produces:
I would like to shift the node down so that the baseline of "foo" aligns with the baseline of the surrounding text. There's quite a bit of information on aligning relative to other nodes, but really all I need to do is shift it down vertically by a set amount, but I can't figure out how.
What is the easiest/best way for me to shift the entire node down so that baselines align?


Some text \tikz[baseline] \node[yshift=1mm,rectangle,rounded corners=0.5mm,text=white,fill=black!65,inner sep=2pt] {\scriptsize{}foo}; more text.– Kent Boogaart Feb 20 '18 at 11:26anchor=basealso does not work, at least not on its own. – Kent Boogaart Feb 20 '18 at 11:35anchor=base– CarLaTeX Feb 20 '18 at 12:44