0

This is the listing that I have created. I want to highlight eg. lines 8,9 and 10. Using and escaped \colorbox didnt work to my expectations because it altered the style of the code making the font smaller thus messing up the alignment of the code.

\begin{lstlisting}[breaklines,caption=Output of disassemble main]
(gdb) disassemble 
Dump of assembler code for function main:
0x08048344 <main+0>:    lea    0x4(%esp),%ecx
0x08048348 <main+4>:    and    $0xfffffff0,%esp
0x0804834b <main+7>:    pushl  -0x4(%ecx)
0x0804834e <main+10>:   push   %ebp
0x0804834f <main+11>:   mov    %esp,%ebp
0x08048351 <main+13>:   push   %ecx
0x08048352 <main+14>:   sub    $0x10,%esp
0x08048355 <main+17>:   movl   $0x57,-0x10(%ebp)
0x0804835c <main+24>:   movl   $0x3,-0xc(%ebp)}
0x08048363 <main+31>:   mov    -0xc(%ebp),%eax
0x08048366 <main+34>:   add    -0x10(%ebp),%eax
0x08048369 <main+37>:   mov    %eax,-0x8(%ebp)
0x0804836c <main+40>:   mov    $0x0,%eax
0x08048371 <main+45>:   add    $0x10,%esp
0x08048374 <main+48>:   pop    %ecx
0x08048375 <main+49>:   pop    %ebp
0x08048376 <main+50>:   lea    -0x4(%ecx),%esp
0x08048379 <main+53>:   ret    
End of assembler dump.


\end{lstlisting}

Is there a package where I can comfortably tell it to highlight some lines I feed into it ?

  • Have you looked at tex.stackexchange.com/questions/15237/…? – TeXnician Apr 17 '17 at 12:02
  • I am quite new to latex, so I cant quite follow through with the answers – zython Apr 17 '17 at 12:09
  • there surely has to be an easier way of doing this, right ? – zython Apr 17 '17 at 12:34
  • none of the provided answers from the other threads work, without breaking the compilation or the style of the document – zython Apr 17 '17 at 15:46
  • Then you should ask a new question which clearly shows what you want (best with picture) and what you have tried (as full MWE, meaning with documentclass etc.). You could also edit this question and then try to reopen it. – TeXnician Apr 17 '17 at 15:49