[Tex/LaTex] I just want to have the text in the pdf the same way I have it in the editor

copy/pasteformattingline-breaking

I want to paste from the clipboard a plain text copied from a text editor (line wordpad++, vim, notepad etc), and I want TeX to respect the same line break formatting that the editor has. This works great between most text editors, however if I copy a text to a TeX editor and compile it, then it does not respect the line breaks.

Of course I can put \\ or \linebreak or whatever other typesetting function, but I don't want that. Also simple ASCII symbols like the ampersand must also be escaped (\&) I just want to have the text in my .pdf the same way I have it in my editor, without further editing it in my TeX editor.

Is there any function|style setting that can help me?

Notice I also need word wrap for the quoted text.

Best Answer

The listings package also allows for setting content verbatim. Here's an example, using language=TeX (which should be fine if you have plain text):

enter image description here

\documentclass{article}
\usepackage{listings}% http://ctan.org/pkg/listings
\begin{document}
\begin{lstlisting}[language=TeX]
Lorem ipsum dolor sit amet, consectetur 
adipiscing elit. Fusce pulvinar risus 
eu neque porttitor a ultrices magna 
malesuada. Mauris ullamcorper, elit at 
euismod fermentum, mi velit imperdiet 
est, in auctor orci lorem eu velit. 
Integer venenatis accumsan mollis. Cras 
in eros metus, id euismod ante. Class 
aptent taciti sociosqu ad litora 
torquent per conubia nostra, per inceptos 
himenaeos. Vivamus nisl tortor, eleifend 
at vestibulum sit amet, scelerisque 
a lacus. Aenean tempus nibh eu ante 
fringilla laoreet. Pellentesque et diam 
sem, sed venenatis turpis. Aenean ac 
euismod dui. Vivamus faucibus elit non 
dolor tincidunt non pulvinar felis 
sagittis. Mauris mi massa, malesuada id 
vestibulum et, tincidunt ac nibh. 
Donec in orci eros, eu accumsan odio. 
Curabitur ipsum nunc, dictum vitae 
faucibus non, aliquet quis leo. Nullam 
nisi diam, rhoncus sagittis semper non, 
pharetra et eros. Etiam a metus nulla, non 
egestas leo.
\end{lstlisting}
\end{document}​​​​​​
Related Question