I am currently trying to insert a batch file programming code in my report. I am using the code listing. I am not able to add new lines to format my code! I have following code example yet:

 ä\colorbox{white}{\color{RoyalBlue}\texttt{Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.}}ä

The output is like this in a single line which I don't prefer: Microsoft Windows Version 6.2.9200 2012 Microsoft Corporation. All rights reserved.

The output I desire should be:

Microsoft Windows [Version 6.2.9200]

(c) 2012 Microsoft Corporation. All rights reserved.

I have tried to use inserting newline by using \\, \newline etc. after first line, nothing helped me. Any suggestion from you are welcome. Please note that latex's code listing(Supported languages) doesn't support Batch file programming language syntax.

  • 1
    Please, take a look at tex.stackexchange.com/questions/49021/…
    – user13907
    Aug 16, 2013 at 13:11
  • You cannot have line breaks inside a \colorbox
    – daleif
    Aug 16, 2013 at 13:39
  • 2
    Close voters: the question here is different from the linked one. The cause here is the box, as daleif observes, rather than anything to do with using a verbatim environment (which is escaped here).
    – Joseph Wright
    Aug 16, 2013 at 14:26

1 Answer 1


Surely there are better methods, but what about using a \parbox?



  \parbox{3.9in}{\color{blue}\texttt{Microsoft Windows [Version 6.2.9200]\\\\
   (c) 2012 Microsoft Corporation. All rights reserved.}}}ä


enter image description here

P.S. I've changed the colors only just to emphasize the result.

  • Hello karlkoeller, Is it possible to preserve white spaces in \parbox before a line starts. I am unable to ident the code.
    – ρss
    Aug 16, 2013 at 18:44
  • @pss You'd better ask another question for this, providing a minimal working example (MWE) starting with \documentclass{...} and ending with \end{document} so to reproduce your situation. BTW: you have enough reputation now to upvote answers and questions, when you like them. Aug 16, 2013 at 18:51
  • done it here tex.stackexchange.com/questions/128582/…
    – ρss
    Aug 16, 2013 at 18:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .