When I use listings package as is, line numbers appear in the margin and the listing lines start at the margin. I know a workaround of putting each listing into a minipage with \noindent, but it is tedious.

It there a global setting that could push the line numbers right to begin at the margin?

  • Welcome to TeX.SE... Sorry to ask that, can you elaborate your question? please...
    – MadyYuvi
    Sep 18, 2020 at 12:14
  • Did you already take a look at tex.stackexchange.com/q/340876/134144?
    – leandriis
    Sep 18, 2020 at 13:28
  • \lstset{numbers=left, xleftmargin=1.5em}, where you set xleftmargin=... to a value that suits you
    – Nico
    Sep 18, 2020 at 14:23


You must log in to answer this question.

Browse other questions tagged .