I would like to hightlight a piece of code in the middle of a body of text. I would like it to appear similar to the inline heightlight in markdown.
I want it to look like this: tensorflow.keras.optimizers
You can use the listing
and tcolorbox
packages:
\documentclass{article}
\usepackage{xspace}
\usepackage{tcolorbox}
\tcbuselibrary{listings}
\newtcblisting{foo}{
listing only,
nobeforeafter,
after={\xspace},
hbox,
tcbox raise base,
fontupper=\ttfamily,
colback=lightgray,
colframe=lightgray,
size=fbox
}
\begin{document}
text
\begin{foo}
code
\end{foo}
text
\end{document}