How do I center text within a listing in Latex?
Or another way not using listing. (Need a box with monospace font)
The answer given at tex.stackexchange is:
...which still leaves me wondering:
Using a frame around the code, e.g. using
What does the
I don't have an answer for the listing package on top of my head, but you could try the following:
That produces a box with 90% of the line width, with text of width 85% of line width.
If you want it centered you just put
If you prefer the box without a frame, simply change