TransWikia.com

Side-by-side layout only on some lines of listing

TeX - LaTeX Asked by user1953221 on August 14, 2021

How is the following achieved?

code

I’ve done the blue parts with escapeinside:

documentclass{article}
usepackage{listings}

lstset{numbers=left}

begin{document} 

% this achieves the first two lines
begin{lstlisting}[escapeinside={(*}{*)}]
  (*{texttt{emp}}*)
  barrier b = new barrier(2);
end{lstlisting}

end{document}

but adding a table in the same way seems like a bad idea. I’m not sure how else to do the || parts within a listing.

Alternatively this could be a bunch of nested tables with formatting applied manually… is there a better way, making use of listings, so I don’t have to reinvent e.g. line numbers?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP