0

So I want to have some nice listings for a manual I'm writing. The instructions should be copied to the ubuntu terminal in which a bunch of them can be ran after each other.

I fixed that, but now I've run into the problem that lstlisting keeps adding weird white spaces, as you can see in the image below.

enter image description here

This is my lstdefinestyle:

\lstdefinestyle{ubuntuterminal}{
    language=bash,
    basicstyle=\ttfamily,
    escapeinside={*@}{@*},
    autogobble=true,
    keywords={sudo},
    showstringspaces=false,
    keywordstyle=\color[RGB]{94 109 45},%\color[RGB]{0 151 189},
    keywords=[2]{apt-get},% define keywords 
    keywordstyle=[2]{\color[RGB]{0 151 189}},
    morecomment=[l]{//},
    breaklines=true;
    breakatwhitespace = true,
    breakindent       = 0pt,
    postbreak=\raisebox{-.2ex}[0ex][0ex]{\color{black}\large\ensuremath{\hookrightarrow\space}},
    tabsize=4,
    numbers=left,
    numbersep=5pt,
    columns=fullflexible
    numberstyle=\numberwithprompt,
}

And this is how I call it in the latex code:

Make sure the pc is fully up to date.
\begin{lstlisting}[style=ubuntuterminal]
    sudo apt-get update
    sudo apt-get upgrade
\end{lstlisting}

Please help me fix this :)

1
  • Welcome to TeX.SX! Please help us (and also you) and add a minimal working example (MWE), that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass and ending with \end{document}.
    – Bobyandbob
    Sep 2 '17 at 10:59
1

Okay, this might sound rather stupid, answering my own question after a couple of minutes, but I found the problem.

In my lstdefinestyle I forgot to end the columns= line with a , which resulted in this line doing absolutely nothing. So for anyone who wants to use this:

\lstdefinestyle{ubuntuterminal}{
    language=bash,
    basicstyle=\ttfamily,
    escapeinside={*@}{@*},
    autogobble=true,
    keywords={sudo},
    showstringspaces=false,
    keywordstyle=\color[RGB]{94 109 45},%\color[RGB]{0 151 189},
    keywords=[2]{apt-get},% define keywords 
    keywordstyle=[2]{\color[RGB]{0 151 189}},
    morecomment=[l]{//},
    breaklines=true;
    breakatwhitespace = true,
    breakindent       = 0pt,
    postbreak=\raisebox{-.2ex}[0ex][0ex]{\color{black}\large\ensuremath{\hookrightarrow\space}},
    tabsize=4,
    numbers=left,
    numbersep=5pt,
    columns=fullflexible,
    numberstyle=\numberwithprompt,
}
1
  • 1
    Nothing is stupid about finding own errors.
    – Skillmon
    Sep 2 '17 at 11:24

Your Answer

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

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