Text FormattingColumn alignment using listings package

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

Column alignment using listings package

Post by Singularity »

How can I get columns to align better in the listings package? I do not understand the column discussion in section 2.10 of the listings documentation.

The attached picture is a partial screenshot of the code listing I get from the following MWE. Note that the first character in some of the lines is sticking out to the left. Note the "U" and "W" in lines 2 and 4.

Why are they stickin gout? How do I fix it?

Code: Select all

\documentclass[]{article}
\usepackage{listings}
\begin{document}

\lstdefinestyle{mycode}{basicstyle=\small, % print whole listing small
	numbers=none,%left, numberstyle=\tiny, stepnumber=5, numbersep=5pt,
	frame=single,
	breaklines=true
}

\lstset{
	style=mycode,
	language=Octave,
	caption={plotBetaNew.m},
	label={code:plotBetaNew.m}
}
\lstinputlisting{code/kruskal/plotBetaNew.m}

\end{document}
First character should be in same column
First character should be in same column
Capture.PNG (36.89 KiB) Viewed 2724 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply