0

I'm using TexMaker with PDFLatex. My problem is that the code lines in the listing

    ress := 'articles';
    test := 'something';
    test := 'somethingarticles';
    test := 'arrtticclleess';

are showed as

    ress := ' articles ';
    test := 'something';
    test := 'somethingarticles';
    test := ' arrtticclleess ';

in the pdf file. For defining the listings I use this code:

\lstset{
    literate=%
    {Ö}{{\"O}}1
    {Ä}{{\"A}}1
    {Ü}{{\"U}}1
    {ß}{{\ss}}1
    {ü}{{\"u}}1
    {ä}{{\"a}}1
    {ö}{{\"o}}1
    {~}{{\textasciitilde}}1,
    float=hbp,
    basicstyle=\footnotesize,
    identifierstyle=\color{colIdentifier},
    keywordstyle=\color{colKeys},
    stringstyle=\color{colString},
    commentstyle=\color{colComments},
    backgroundcolor=\color{hellgelb},
    columns=flexible,
    tabsize=2,
    frame=single,
    extendedchars=true,
    showspaces=false,
    showstringspaces=false,
    numbers=left,
    numberstyle=\tiny,
    breaklines=true,
    breakautoindent=true,
    captionpos=b,
}
\lstdefinelanguage{al}{
    sensitive=true,
    upquote=true,
    morecomment=[l]{//},
    morecomment=[s]{/*}{*/}, 
    morestring=[b]',
    alsodigit={-,*},
    morekeywords={
        local,var,procedure,temporary,begin,end,exit,if,else,then,repeat,
        until,case,of}
}

How can this inconsistent behaviour happen?? And how can I fix it?

1
1

Thanks to the related feature from stackexchange. I found the answer here:

Phantom spaces in listings (pdf)

I had to change the following line in the \lstset{

columns=flexible,

to

columns=fullflexible,

to get the spaces away. But what I still don't understand is the different behaviour before (sometimes spaces, sometimes not). Can someone explain it to me?

1

Not the answer you're looking for? Browse other questions tagged or ask your own question.