Linked Questions

0
votes
0answers
37 views

Must PDF always eat source code indentation? [duplicate]

The packages listings and minted present source code inline. My publication target is PDF. From my own documents as well as from the documentation for those two packages, copying and pasting the ...
29
votes
4answers
7k views

Phantom spaces in listings (pdf)

I have a problem with SQL code in a PDF document. For code representation I'm using the listings package. Everything works perfect until I copy-paste that code from the created PDF document. I get ...
41
votes
2answers
2k views

Viewer-independent copyable spaces at the beginning of a line?

I need to include a couple of Python code listings, where the indentation of the lines (using some number of spaces) is significant. I would like for the code listings to be copyable, so the spaces at ...
27
votes
1answer
3k views

How to make text copy in PDF previewers ignore lineno line numbers?

I'm using lineno for a document. I have it configured to put line numbers in the margins of the document. I generate PDF using pdflatex. Here's the problem: when people copy a region of text in a ...
12
votes
4answers
3k views

Problems with copy and paste from PDF using lstlisting

I'm using lstlisting to create course notes from which I am hoping that code can be copy&paste'd I've already implemented the suggestions in Phantom spaces in listings (pdf) to make sure that ...
23
votes
1answer
3k views

How to make listings code correct copyable from PDF and with hyperlink

If I generate listings code with line numbers and copy the result from the PDF I can not use it again as tex code. First the line numbers are included which they should not, second spaces are included ...
10
votes
2answers
5k views

Copy-pasting leading whitespace and blank lines in listings package (pdf) [duplicate]

I'm trying to use the listings package to typeset some code in a PDF document, in a way that allows me to copy-paste the resulting code. This mostly works well, if basicstyle=\ttfamily,columns=...
3
votes
1answer
204 views

Is it possible to not copy numeration using lstlisting?

Please consider the following MWE: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[spanish]{babel} \usepackage{color} \usepackage{enumitem} \usepackage{listings} \definecolor{...
3
votes
0answers
684 views

How to keep indentations in Python code copied from LaTeX PDF?

I tried to include Python 3.6 code in a LaTeX PDF document which should be easily be copied to save to a file or to try the Python code. Although, \begin{verbatim} for row in range(1,9): for col ...
2
votes
0answers
444 views

Is it possible to get the leading spaces in copy/paste from PDF?

Using this solution Only Select Code without Line Numbers I allow the listings to be copyable from PDF w/o the line numbers and many extra spaces. But that also removes the leading spaces used for ...
0
votes
1answer
234 views

Use Dev-C++ style to write code using listings package

I would like to write this piece of code using listings package: However I have some problems: I cannot set the grouper symbol; The 0 does not have the diagonal slash. The size of the code has to ...
0
votes
0answers
65 views

How to remove indent characters when copying from PDF document using listings package

I am pretty sure I read something about this before, but I can not find it. Mark it as a duplicate if so please. I am coding inside lstlisting environment using SPACEBAR for separate words and TAB ...