I have modified the \texttt{} command based on this answer to give the rendered text a highlight:
\let\OldTexttt\texttt
\renewcommand{\texttt}[1]{\OldTexttt{\hl{#1}}}
I am not experienced in TeX, so I don't really know what the command does and what side effects it has. All I know is that it has added the highlight. There are obviously some problems because a rendered text with a dash in it is missing its last character.
Source code (minimal working example /as requested/):
\documentclass[12pt,oneside,final]{fithesis2}
\usepackage[czech]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{soul}
\usepackage{xcolor}
\definecolor{gray}{rgb}{0.95,0.95,0.95}
\sethlcolor{gray}
\let\OldTexttt\texttt
\renewcommand{\texttt}[1]{\OldTexttt{\hl{#1}}}
\begin{document}
\texttt{game-server.js}
\end{document}
If needed, fithesis2 is downloadable from the website of our university by clicking on Soubory třídy fithesis2 jako ZIP, cca 880 KiB.
Compiled PDF:
I have tried to remove the \texttt{} modification and it fixed the problem with the missing character, but I would actually like to keep the highlight. Removing \usepackage[czech]{babel} also helps but I guess I need that line because I'm writing in Czech. (?)
Removing the \texttt{} modification also breaks line-breaking which now doesn't happen inside the text rendered by \texttt{} at all, so now I'm left with some lines going over the right edge.
How to do it so that I can have all of it - the highlight, working line-breaking and dashes possible?
Thank you.



soulwithbabel-czech. – egreg May 10 '16 at 17:16