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

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

$
0
0

A PDF output is obtained by compiling the following code.

\documentclass{article}\usepackage{xcolor}\usepackage{listings}\lstset{    language={[LaTeX]TeX},        numbers=left,        numbersep=1em,        numberstyle=\tiny,    frame=single,    framesep=\fboxsep,    framerule=\fboxrule,    rulecolor=\color{red},    xleftmargin=\dimexpr\fboxsep+\fboxrule\relax,    xrightmargin=\dimexpr\fboxsep+\fboxrule\relax,    breaklines=true,    basicstyle=\small\tt,    keywordstyle=\color{blue},    commentstyle=\color[rgb]{0.13,0.54,0.13},    backgroundcolor=\color{yellow!10},    tabsize=2,    columns=flexible,    morekeywords={maketitle},}\begin{document}\begin{lstlisting}\documentclass{article}\usepackage{listings}\title{Sample Document}\author{John Smith}\date{\today}\begin{document}\maketitleHello World!% This is a comment.\end{document}\end{lstlisting}\end{document}

I attempted to copy the code only inside Acrobat Reader. Unfortunately, the line numbers also got copied as shown on the following screen shot.

enter image description here

The line numbers are useful, but readers want not to copy them.

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


Viewing all articles
Browse latest Browse all 70

Trending Articles



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