Yes, it is possible with TikZ
. You can do this in two ways:
- by including the code directly in the text.
- by creating a LaTeX command named
autour
which contains the TikZ
code.
Here is an example of two possibilities that have different parameters in order to visually show their effects.
\documentclass{article}
\usepackage{tikz}
\newcommand{\autour}[1]{\tikz[baseline=(X.base)]\node [draw=red,fill=gray!40,semithick,rectangle,inner sep=2pt, rounded corners=3pt] (X) {#1};}
\begin{document}
Quick brown fox \tikz[baseline=(X.base)]\node [draw=black,fill=cyan!20,thick,rectangle,inner sep=3pt, rounded corners=4pt] (X) {jumped}; over the lazy dog.
\bigskip
Quick brown fox \autour{jumped} over the lazy dog.
\end{document}
Alternative with tcolorbox
A simple adaptation of the code on page 16 of the manual indicated by @CarlaTeX in its commentary.
\documentclass{article}
\usepackage{tcolorbox}
\newtcbox{\entoure}[1][red]{on line,
arc=3pt,colback=#1!10!white,colframe=#1!50!black,
before upper={\rule[-3pt]{0pt}{10pt}},boxrule=1pt,
boxsep=0pt,left=2pt,right=2pt,top=1pt,bottom=.5pt}
\begin{document}
Quick brown fox \entoure{jumped} over the lazy dog.
Quick brown fox \entoure[blue]{jumped} over the lazy dog.
\end{document}
tcolorbox
package documentation at the bottom of page 16.