Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [copy-paste]

{copy-paste} is about copying text and other elements from one place (often a PDF file) and allowing it to be pasted. Searching for text (in a PDF file) is a process closely related to copying because both use the OCR (optical character recognition) layer in the PDF file.

Filter by
Sorted by
Tagged with
87 votes
12 answers
66k views

Is it possible to produce a PDF with un-copyable text?

Is it possible to produce a PDF with un-copyable text? I mean, when you want to copy text from the PDF, you can't copy it or what you copy is nonsense characters.
warem's user avatar
  • 3,249
114 votes
6 answers
21k views

What are good ways to make pdflatex output copy-and-pasteable?

One frequent aspect of pdflatex output that could be improved is to what extent one can select text output from the generated pdf-file and copy-and-paste it. This is essentially an issue of having the ...
Lover of Structure's user avatar
30 votes
4 answers
16k views

How to make listings code indentation remain unchanged when copied from PDF?

So I am using listings package for code examples. But there is a problem. When I copy the code examples from the final PDF document, they are usually not the same - the indentation is gone, there are ...
user avatar
182 votes
3 answers
17k views

Making equations copyable in pdf

I would like to write a .pdf, where my readers could copy the rendered formulae and paste them directly in their TeX documents. And the copied text would automatically be: \int x\sin ax\;\mathrm{d}x ...
Jonas's user avatar
  • 3,353
44 votes
2 answers
3k 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 ...
Jake's user avatar
  • 233k
44 votes
1 answer
5k views

Make ligatures in Linux Libertine copyable (and searchable)

I'm currently working on an essay written in LaTeX form. I'm facing problems with ligatures - in my pdf output (rendered using pdftex) opened in Adobe Reader I get X's and V's when copy-pasting words ...
Doggie52's user avatar
  • 924
9 votes
2 answers
3k views

How to copy/paste multiple spaces from lstlistings?

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 ...
maurera's user avatar
  • 391
76 votes
4 answers
6k views

Is there a LaTeX trick to prevent a PDF viewer from copying the line number?

A PDF output is obtained by compiling the following code. \documentclass{article} \usepackage{xcolor} \usepackage{listings} \lstset { language={[LaTeX]TeX}, numbers=left, ...
kiss my armpit's user avatar
64 votes
1 answer
6k views

Small-caps, old-style numbers, and some ligatures produce odd symbols in PDF copy text?

This is a problem I've had consistently with XeLaTeX. Here's a small example: \documentclass{article} \usepackage{fontspec} \setmainfont[Ligatures=TeX,Numbers={OldStyle,Proportional}]{Minion Pro} \...
Chel's user avatar
  • 6,120
30 votes
1 answer
5k 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 ...
mhucka's user avatar
  • 595
14 votes
2 answers
2k views

What can cause generated PDF document whose text are not correctly copyable?

I was wondering why some PDF documents compiled from some LaTeX code does not make its text correctly copyable, i.e. what you can get is nonsense text? For example, this pdf document (I don't have the ...
Tim's user avatar
  • 5,773
6 votes
1 answer
2k views

How to configure tcblisting with minted to allow copy/paste from listing with whitespace characters?

This answer from a similar question gets very close to a final copy/paste solution, but does not work for me as it does not select whitespace. I am asking a new question as the linked one is several ...
Kenneth E. Bellock's user avatar
4 votes
2 answers
2k views

Included PDF image has invisible, but selectable text

I am currently facing some problem when I tried to import a PDF as a graphic. The PDF with some original text beside was first cropped to remove the text and then imported using \includegraphics. ...
Tee Zhen Wei's user avatar
32 votes
1 answer
3k views

Is it possible to prevent some part of text (headers, footers) from selection?

I'm looking for a solution that will allow me to prevent some parts of the final pdf file (header, footer) from being selected and copied. It is to allow easier quoting of longer parts of texts from ...
DrOmader's user avatar
  • 625
21 votes
3 answers
3k views

How can I make source code included with minted copyable?

Is it possible to make source code with minted copyable? Here is a minimal example how I include source code (completely, with minimal java code, on GitHub): \documentclass{beamer} \usepackage[utf8]{...
Martin Thoma's user avatar
  • 18.9k
15 votes
1 answer
641 views

Can we get maths in PDFs that can be copy-pasted and screen-read?

Mathematics in PDFs can be cumbersome for any purpose but reading or printing. In particular, copying mathematics in order to use it in another document, and screen-reading for visually impaired ...
Raphael's user avatar
  • 6,003
3 votes
0 answers
1k views

How make a LaTeX document that generates a PDF from which copy-paste works correctly for empty lines and leading space indentation?

We are writing a PDF document in LaTeX that contains various installation instructions and other technology text. Our idea is that the user reads various instructions in Serif font and then there's ...
Geek's user avatar
  • 31
24 votes
2 answers
8k views

Cannot copy text from the simplest PDF file?

Consider the following code: \documentclass{article} \begin{document} We define multiplication by $$v_1x = 0,\quad v_2x = v_1,\quad v_1y = -v_1,\quad v_2y = v_1$$ \end{document} which looks ...
Phil-ZXX's user avatar
  • 1,757
19 votes
2 answers
4k views

How to fix missing or incorrect mappings from glyphtounicode.tex

glyphtounicode.tex has been described as the best solution for generating copy-and-pasteable symbols. However, I find that various symbols that I need to use do not paste as the appropriate Unicode ...
Lover of Structure's user avatar
14 votes
1 answer
1k views

How to produce unicode copyable alternative text? (with accsupp)

In the following example, I can't manage to make accsupp store the unicode alternative text. The resulting PDF looks as expected but the copyable text is not the correct one. I tried this with ...
alfC's user avatar
  • 14.4k
11 votes
1 answer
10k views

Problem copying text from pdf - spaces being stripped

I have the following minimal working example: \documentclass{book} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \begin{document} é canção \end{document} I need to use the utf8 argument ...
Weslei's user avatar
  • 4,035
9 votes
1 answer
6k views

How to copy contents of one file to another?

So I have a .txt-file and I need to import the data line per line. That works like it should. I need however to adapt the contents loaded into a command an write it to another .txt file that later ...
Didii's user avatar
  • 1,323
36 votes
1 answer
7k views

Copy to clipboard feature in PDF output

Is it possible to have a clickable "copy to clipboard" feature in a PDF document generated by LaTeX? Ideally in the form of a macro that also allows for graphical elements to be embedded inside it (...
1010011010's user avatar
  • 6,367
18 votes
5 answers
23k views

Text copied from pdf is missing spaces, or has extra ones

When I create a pdf with pdflatexand copy text from that pdf (using Adobe Reader DC on Windows 10), some of the spaces are missing. Here's an MWE: \documentclass{article} \usepackage{newtxtext} \...
bers's user avatar
  • 5,434
18 votes
1 answer
3k views

Can we make ligatures copy-and-pastable? [duplicate]

Is there a straightforward way to make ligatures more copy-and-pastable? I know that by using \usepackage[t1]{fontenc} that many glyphs like accented and umlauted characters become copy-and-pastable ...
alex.jordan's user avatar
  • 2,179
13 votes
4 answers
10k views

Incompatibilities of cmap with fontenc/hyperref?

The following code doesn't compile (with pdflatex) \documentclass{article} \usepackage{cmap} \usepackage[T1]{fontenc} \usepackage[pdfa=true]{hyperref} \begin{document} Hello. \end{document} ...
Lover of Structure's user avatar
5 votes
1 answer
6k views

Copyable math formulas

I'm curious whether there is a package that allows to copy math formulas correctly. For example, this one should highlight like so but, not like so And if I copy one, I should get: ∫₃⁵ (x/(1-x²)) ...
antshar's user avatar
  • 4,527
1 vote
1 answer
248 views

Getting correct searchable text for Devanagari text

Consider this fairly minimal document, which AFAIK is the recommended way of typesetting Devanagari-script Sanskrit-language text: \documentclass{article} \usepackage{fontspec} \usepackage{...
ShreevatsaR's user avatar
  • 45.7k
29 votes
2 answers
6k views

Copy from PDF without line breaks at end of each line

When I produce the PDF, open it and copy the paragraph into notepad, there is a forced line break at the end of every line in the PDF. Is there a way to get over this, so that I can copy the paragraph ...
Dominik Teiml's user avatar
17 votes
1 answer
16k views

Protect text in PDF from being copied [duplicate]

Possible Duplicate: PDF with un-copyable text What is the most effective ways to protect text in a PDF from being copied with Ctrl+C? I know about standard PDF copy protection, and also know ...
u17's user avatar
  • 4,976
16 votes
1 answer
1k views

Can PDF search find words with ligatures in XeLaTeX-documents?

Is there some way allow PDF search to find words with ligatures? I use XeLaTeX. \documentclass{book} \begin{document} Prefix. \end{document} In the resulting pdf file, searching for the word "...
srking's user avatar
  • 1,125
15 votes
1 answer
2k views

Hyphens at end of line disappear upon pasting, even if they were present in the input

When I paste text from pdflatex output, there are two things about hyphens that I would like to change: Hyphens paste as "hyphen-minus" (U+002D, "-"), but I would prefer the newer Unicode character "...
Lover of Structure's user avatar
13 votes
4 answers
5k 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 ...
Yossi Farjoun's user avatar
13 votes
1 answer
5k views

Copying LaTeX from a PDF

Is there a way to copy from a PDF to a LaTeX document? Whenever I do it, it copies in with weird symbols in the place of LaTeX commands for example: $$f:\mathbb{R}\rightarrow \mathbb{R}$$ copies in ...
hmmmm's user avatar
  • 1,125
13 votes
1 answer
24k views

Copy pasting of underscore

When I use \textunderscore to print an underscore "_" character, the copy-paste functionality of Adobe Acrobat Reader does not appear to work properly. For instances, when I copy test_case from ...
willem's user avatar
  • 2,341
12 votes
2 answers
7k 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=...
Mqrius's user avatar
  • 191
11 votes
1 answer
464 views

Make a command to mark a text and class them for text analyze

Sorry for my English, I'm French and it's my first post on this forum, but I'm a frequent visitor of this forum, thanks for all ;) My problem is this : I'm working with transcriptions of 35 ...
Zouib's user avatar
  • 857
6 votes
1 answer
587 views

'fj' ligatures are not correctly mapped with 'glyphtounicode' using Alegreya font

Inputting glyphtounicode when compiling with pdflatex makes sure that various ligatures in the output are copy- and searchable. With the Alegreya package, however, the ligatures for fj and ffj aren't ...
Sverre's user avatar
  • 20.8k
6 votes
2 answers
2k views

Unwanted space around punctuation in copied & pasted listing

When I compile the .tex file below into .pdf using rubber -d mwe.tex and try to copy & paste the contents of the listing, I get spaces around . characters that were not present in the original ...
god's user avatar
  • 159
5 votes
1 answer
835 views

How can I preclude copying & pasting of listings?

When I include code snippets in my documents, my lazier readers, i.e. students :), are often tempted to just copy and paste those snippets instead of typing them themselves. However, there are risks ...
jub0bs's user avatar
  • 59.2k
5 votes
2 answers
1k views

Cannot copy letters with diacritics from pdflatex PDF

I have problem with copying text from PDF file. I am using these packages in my document: \usepackage[slovak]{babel} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} However when I generate ...
peto1234's user avatar
  • 333
4 votes
3 answers
2k views

How to reuse code

This might have been asked before, but I am not sure what to search for. I am often in the situation that I want to print identical portions of text (or images, tables, etc) on a single A4 page in ...
user1583209's user avatar
3 votes
1 answer
107 views

How to make text look different in PDF compared to copy-paste [duplicate]

Is there a way to make text written in LateX look like something in the pdf document, but different if you copy-paste it? Here is an example of what I would like: In the pdf document: there is 10 km ...
Kevin's user avatar
  • 73
2 votes
0 answers
174 views

Quoting from the same document?

How to quote from the same document? For example SECTION 3. Explanation Before discussing the main theorem, let's quote it's statement. Theorem 7.1. (Main lemma) 1 + 1 = 2 ... SECTION 7. Appendix ...
Student's user avatar
  • 215
1 vote
1 answer
475 views

How do I paste codepoints outside of the basic multilingual plane with accsupp or \pdfglyphtounicode?

As described in the answers to this question, the accsupp package can be used to have symbols paste as arbitrary Unicode codepoints. For example you might want to write something like the following, ...
Lover of Structure's user avatar
1 vote
0 answers
156 views

Using \EveryShipout corrupts the copyable text

This is a strange bug. I'm using the textpos package (which in turn uses the everyshi package) to place text at a certain position on the page. Consider this document: % !TEX TS-program = lualatex \...
ShreevatsaR's user avatar
  • 45.7k
1 vote
2 answers
1k views

Can I copy text with syntax highlighting

Is there a way to copy LaTeX text out of TeXstudio with syntax highlighting? Will include some macros and small portions of LaTeX in a presentation (Powerpoint) and want to get it as readable as ...
Fabian Deitelhoff's user avatar
0 votes
1 answer
991 views

How can I make the copied-pasted text from an pdflatex output still readable/compilable by pdflatex?

The issue I compile a latex document which contains accents ("é" for instance), then I copy the text from the pdf generated by pdflatex. Then, I paste this text to my latex file. The resulting file ...
Colas's user avatar
  • 6,832
39 votes
2 answers
2k views

Making “C♯” on my resume searchable

As discussed on How to make the correct hash-symbol in C Sharp, I chose to render the name of the C# language on my resume as C$^\sharp$ I'd like to keep that typographical touch. But I'm afraid that ...
Alex Jasmin's user avatar
34 votes
1 answer
3k views

Make hyphenated words in PDF searchable

Is there a way to make hyphenated words in a PDF generated by LuaTeX searchable? If the MWE below is converted to a PDF, searching for "lexicon" (in Acrobat X for example) will not find the word since ...
Till A. Heilmann's user avatar