How can i bold just one line in this code?
\begin{lstlisting}
//Algoritmo 2
int f2 ( n ):
local i , j , r =0;
para i = 1 a n -1
para j = i +1 a n
r = r + 2;
cont++;
retorna r ;
\end{lstlisting}
I just want to bold cont++
I tried to use \textbf
but no success..
Best Answer
The best way to do this would be to use the
escapeinside
command, like this:However, depending on what else you've put in your
\lstset
, this approach may or may not work. In particular, it's common to put code listings inmonospaced font
, and if so, you'll have to use one of the solutions to this question to get a monospaced bold font.