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

2
  • I think you might find this post helpful tex.stackexchange.com/questions/236608/…, except for the text-colour and line around the box it seems to do what you are asking.
    – Tina
    Apr 11, 2017 at 13:00
  • Would the box have to be able to break at the end of lines?
    – Bernard
    Apr 11, 2017 at 17:43

1 Answer 1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .