The listing I have in my paper is Java Code. When it is displayed through TeX I lose some of the formatting that I did inside my .java files. For example, all of my comments in my code were lined up, but now after incorporating the Java code in TeX the comments are no longer lined up. Here is a visual of this dilemna:

Notice how all the comments are lined up except the first few at the top. Clearly there is room to the right for all of the comments to be shifted.
Here is my TeX code for the listing:
\section{Code}
\lstset{language=Java, basicstyle=\tiny\ttfamily,
linewidth=\textwidth,
numbers=left,
columns=flexible,
numbersep=5pt, % Abstand der Nummern zum Text
tabsize=3,
breaklines=true,
frame=bottomline,
showspaces=false,
showtabs=false,
xleftmargin=17pt,
breakatwhitespace=true,
framexleftmargin=17pt,
framexrightmargin=5pt,
framexbottommargin=4pt,
showstringspaces=false,
literate=%
{Ö}{{\"O}}1
{Ä}{{\"A}}1
{Ü}{{\"U}}1
{ß}{{\ss}}2
{ü}{{\"u}}1
{ä}{{\"a}}1
{ö}{{\"o}}1
}
\lstinputlisting{EncodingScheme.JAVA}
- Are there ways to edit my code inside TeX manually?
- How can I get page-breaks at certain points in the code? For example, if I wanted to see the for-loop that is at the bottom of the page in the picture what would I do?
- Please give all related suggestions to formatting code inside TeX.

Javafile itself tex-time so that 1) the Java source itself isn't altered [permanently?] and 2) the comments line up in the output. – Sean Allred Dec 20 '12 at 18:04lstlistingenvironment, or only when the code is brought in via\lstinputlisting? Can you edit your question to include a few of the lines of code that cause trouble? – G. Poore Dec 23 '12 at 04:17columns=fixedinstead ofcolumns=flexiblein thelstset? From thelistingsdocumentation: "The fixed column format ruins the spacing intended by the font designer, while the flexible formats ruin the column alignment (possibly) intended by the programmer." – cyberSingularity Jan 06 '13 at 01:15