I know there are several approaches to highlight a piece of code
with TeX. I tried the following
\documentclass[a4paper,11pt,naustrian]{article}
\usepackage[left=2.5cm, right=2.5cm, top=4.3cm, bottom=2cm, headheight=2.3cm]{geometry} % for margins on a A4paper
\usepackage{fontspec}
\usepackage[shorthands=off,bidi=basic]{babel}
\setmainfont{Open Sans}
\usepackage{parskip}
\usepackage[font=small]{caption} % small font, an additional line as space after figure
\usepackage[dvipsnames, table]{xcolor}
\usepackage{luacolor,lua-ul} %for usage of style attributes - background color
\begin{document}
\newcommand{\code}[1]{ \highLight[{[HTML]{D3D3D3}}]{\texttt{#1}}}
* Die Kapiteln können nur dann in der Lasche \code{Bearbeiten} gesehen werden, wenn der Benutzer im Gesamtdokument die Berechtigung \code{Zugang} hat.
\end{document}
Which produces the following result:
The major problem with this result is that the colored background doesn't start at the word boundary. In first word it includes a space which in the second not. I can remove the space
in the command code
but than the background color starts directly with the preceding word.
Is this a problem from lua-ul
? Or how to define it more precisely to wrap the word boundaries?
Running lualatex 1.13.2
. The above screenshot was made with lua-ul
0.1.2 but is in a different form still not correct in 0.1.3. Therefore I thought it might be a more general issue.