2

Nowadays websites show inline computer-code/files in a nice fancy way, with a background color, and rounded box around it, see e.g. the example below.

How can I reproduce this in Latex?

Thanks

Link of the screenshot below.

enter image description here

robert
  • 1,285
  • I think you might find this post helpful http://tex.stackexchange.com/questions/236608/customize-stackoverflow-like-source-code-box-using-tcolorbox-extrude-with-const, except for the text-colour and line around the box it seems to do what you are asking. – Tina Apr 11 '17 at 13:00
  • Would the box have to be able to break at the end of lines? – Bernard Apr 11 '17 at 17:43

1 Answers1

6

You can try with a tcbox

\documentclass{article}

\usepackage[most]{tcolorbox}
\usepackage{lmodern}

\newtcbox{\code}[1][]{%
     size=fbox,
    tcbox raise base, nobeforeafter, 
    enhanced, colframe=gray,
    colback=gray!30, boxrule=1pt,
    fontupper=\ttfamily,
    #1}

\begin{document}

the \code{parent} section of the POM. The \code[colupper=red!70!black]{spring-boot-starter-parent} is a special \dots \code[colupper=blue!70]{dependency-management} section

\end{document}

enter image description here

Ignasi
  • 136,588