Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying out LaTex and I want to write shell Code in my document. Therefore I took this code from: http://stackoverflow.com/a/742069

\documentclass{report}

\usepackage{color}
\usepackage{xcolor}
\usepackage{listings}

\usepackage{caption}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}

% This concludes the preamble

\begin{document}

\begin{lstlisting}[label=some-code,caption=Some Code]
   NETWORKING=YES

HOSTNAME= f e −19. l o c a l d o m a i n

}
\end{lstlisting}

\end{document}

The problem is that there is a space between every character when I generate a PDF. I would like the code without the space between.You see It at the part HOSTNAME=

Thanks for any help.

share|improve this question
Related: tex.stackexchange.com/questions/21432/… – egreg Feb 22 at 13:34

migrated from stackoverflow.com Feb 22 at 13:29

1 Answer

columns=fullflexible solved the problem.

For example:

\begin{lstlisting}[columns=fullflexible,caption=The Name]

dladm show-phys

\end{lstlisting}

greets

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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