5
votes
1answer
44 views

Apostrophe breaks comments in lstlisting

I defined a command to simplify the writing of code listings of (pseudo-) C code: \lstdefinestyle{c}{ language=C, basicstyle=\small\sffamily, numbers=left, numberstyle=\tiny, frame=L, ...
3
votes
1answer
72 views

Verbatim environment with gray background color and italics

I want a verbatim environment with gray background color and italics(bold fonts may be used also). The \lstlisting can set background but can't set italics. The \mdframed combined with \alltt can ...
3
votes
1answer
69 views

Use textit in listing

How can I use \textit in a listing? \documentclass[a4paper]{article} \begin{document} \begin{lstlisting}[label=test] Some code. \textit{This should be italic.} Some code. \end{lstlisting} ...
2
votes
1answer
336 views

Latex Listing Format Error

I'm having some difficulty with getting the listings package to properly format code snippets. In particular, it does not consistently bold keywords and italicize comments. The code I am currently ...
16
votes
5answers
11k views

Using bold/italic text inside listings?

How can I use bold text inside a code listing? I wanted to make some parts of the code bold.