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 at 12:14
  • Did you already take a look at tex.stackexchange.com/q/340876/134144? – leandriis Sep 18 at 13:28
  • \lstset{numbers=left, xleftmargin=1.5em}, where you set xleftmargin=... to a value that suits you – Nico Sep 18 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.