I know the question has been asked several times, but I was trying to specify some text in bold in my lstlisting environment.
While this was working perfectly with %\lstset{morecomment=[s][\bfseries]{@@}{@@}}
, I was trying to make the listings changes local to that environment only. According to the listings package documentation, optional arguments to lstlistings
must be passed via square brackets. But as my command has already square brackets in it, I need to surround these brackets by curly brackets.
Despite I'm correctly following the recommendations, the following small working example doesn't compile and crashes with this error File ended while scanning use of \lst@Delim@delim
.
\documentclass{report}
\usepackage{listings}
\begin{document}
\begin{lstlisting}[{morecomment=[s][keywordstyle]{@@}{@@}}]
Some test loru
@@ hello world @@
lorem ipsum
\end{lstlisting}
\end{document}
Also (and maybe this would require me to ask a dedicated question for that), the two characters @@
are displayed in the rendered version of the text. I don't want these two characters to appear.
Finally, the rendered bold version, here after with some Objective-C code, isn't bold enough for me. I already tried several tricks with some additional packages, but I'm not satisfied of the results. Do I need to change the font? If so, what monospace font do you recommend me instead of the default one I'm using?
\ttfamily\fontseries{dk}\selectfont
should give you "Latin Modern Typewriter Dark" which contrasts well (at the same width) with\ttfamily\fontseries{lt}\selectfont
, the "Light" variant. Details (pdf). I had the option of using colour highlighting and used the rather nice condensed variant (no bold).