Quantcast
Channel: Active questions tagged copy-paste - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 70

How to copy/paste multiple spaces from lstlistings?

$
0
0

This is a continuation of a question that I asked already: How to copy/paste from lstlistings?.

The solution presented there does not work if the text within the lstlistings environment contains consecutive spaces. Consecutive spaces get copied as a single space. See the following example:

\documentclass[letterpaper]{article}\usepackage{amsmath}\usepackage{graphicx}\usepackage{fancyhdr}\usepackage{amsfonts}\usepackage{amssymb}\usepackage[lmargin=2.5cm,rmargin=2.5cm,tmargin=1.5cm,bmargin=3.5cm]{geometry}\usepackage{listings}  % Environment meant for source code (useful for word-wrapping verbatim text)\lstset{language=[LaTeX]TeX,breaklines=true} % Word wrap within listings environment\begin{document}\lstset{basicstyle = \verbatim@font}\begin{lstlisting}There are no spaces in here []There is one spaces in here [ ]There are two spaces in here [  ]\end{lstlisting}\end{document}

The the contents get copied/pasted such that the third line only contains one space, when it should contain two. Does anyone know how to fix this?

There are no spaces in here []There is one spaces in here [ ]There are two spaces in here [ ]

Thank you


Viewing all articles
Browse latest Browse all 70

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>