# Tag Info

175

The PDF format supports a feature "ActualText" that is used for copy-paste instead of the actual typeset text. However, it is not supported by all PDF viewers, but Acrobat Reader does support it. \documentclass{article} \usepackage{accsupp} \newcommand*{\copyable}[1]{% \BeginAccSupp{% ActualText=\detokenize{#1},% method=escape, }% #1% \...

43

The PDF format knows a feature "ActualText" that allows to specify a replacement string for copy/paste: \documentclass{article} \usepackage{accsupp} \newcommand*{\Csharp}{% C% \BeginAccSupp{ method=hex, unicode=false, ActualText=23, }% $^\sharp$% \EndAccSupp{}% } \begin{document} \Csharp \end{document} The feature is supported by ...

29

Luatex allows manipulating fonts in the define_font callback. Luaotfload facilitates this even more with an extra hook it installs right after the font loader has finished its job: the luaotfload.patch_font callback. Normally it is used for serious and constructive tasks like setting a couple font dimensions or ensuring backward compatibility in the data ...

23

Here is a hack that uses \ooalign and tikz: \documentclass{article} \usepackage{tikz} \newcommand{\Chash}{\ooalign{\hidewidth\tikz\node[inner sep=0pt,opacity=0]{C\#};\cr C$^\sharp$ \cr}} \begin{document} I know \Chash and else. \end{document} Explain: \ooalign put a transparent C\# over C$^\sharp$ such that you can find it in the PDF. I believe this one ...

23

Unicode mapping based on font encoding Packages cmap or mmap add information about glyph to Unicode conversions into the PDF file based on the used TeX encoding. The hooks into the font loading mechanism of LaTeX and should be used as early as possible, e.g.: \RequirePackage{mmap}% (\usepackage does not work before \documentclass) \documentclass{article} ...

22


9

The problem is fragility: \documentclass{article} \usepackage{accsupp} \renewcommand{\thefootnote}{% \protect\BeginAccSupp{ActualText={}}\arabic{footnote}\protect\EndAccSupp{}% } \begin{document} This is a test\footnote{This is a footnote} \end{document}

9

There is currently no font encoding fully supporting Romanian, I'm afraid. New fonts should be created: not from scratch, but it would be a big job and you'd not have many of them available anyway. The problem is that in the standard encoding OT1, no accented letter is present; with T1 the situation is slightly better because ÂâÎîĂă are present as ...

8

Good question, which includes a thorough analyis! I did not find any official documentation of XeTeX for the equivalent for pdfTeX's \pdfliteral direct. The manual of dvipdfm, some predecessor of XeTeX describes \special{pdf:content ...}. Nothing in xetex-reference.pdf or XeTeX-notes.pdf. In file pgfsys-dvipdfm.def the following "ugly hack" can be found: \...

8

You have one obvious problem in your code: You set numberstyle to make it non-copyable and then you reset it with fancy font stuff. Any option is overwritten at a later use. The effects do not add up. So you need that one line: numberstyle=\tiny\color{codegray}\noncopynumber. A true MWE showing how to apply your macro would be \documentclass{article} \...

7

I found a solution to the leading whitespace! Edit: Actually, it doesn't work in Adobe reader. It works in SumatraPDF. Thanks to Daniel and cgnieder for their comments above. As described by Martin Monperrus you can use the accsupp package to differentiate text that you copy-paste from the type-set text. Note that the linked page is not usable out of the ...

7

This is what I get when compiling your example (by the way, loading xunicode is not required), copying from the PDF viewer and pasting here fi ff tt The Minion Pro font I'm using is the one in Adobe Reader. Here's a picture where the characters have been selected: The viewer is Skim, but also Adobe Reader gives the expected result. Here's an example of ...

7

The indentation of the first line for all paragraphs in scope can be set by (see Menke's answer): \setlength{\parindent}{0pt} \hangindent has to be repeated for each paragraph. \everypar helps: \everypar{\setlength{\hangindent}{2.5em}} But caution is needed, because LaTeX uses \everypar quite often itself, e.g. in \section and friends. An alternative is ...

7

I'm using glyphtounicode support file (even with Czech/Slovak related IL2 font encoding) from TeX Live for some time now, I cannot test it with MiKTeX, unfortunately. We run: pdflatex mal-sk.tex pdftotext -enc UTF-8 mal-sk.pdf The result is: 1 ľščťžýáíéäúôň, it shows the page number and the document content. I enclose the code. Please, try it if it fits ...

7

First, I fully agree with Jesse Knight: Whoever made this requirement at your faculty is a sadist But if you use LuaTeX you can destroy the glyph to unicode mapping in the PDF file by creating a special font feature: % lualatex -shell-escape minted.tex \begin{filecontents*}{test.rb} # this should not be copyable def hello "world" end \end{...

6

As requested, an example using package accsupp that works for pdfTeX, the dvipdfm family (dvipdfm, dvipdfmx, XeTeX). In principle it could work for dvips, but from the documentation of accsupp: 1.3.3 Option dvips Package option dvips and its alias dvipsone write pdfmark specials in the output. Unhappily these pdfmark operators are ignored by ...

6

I suggest you to add the following lines to your preamble: \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} It worked perfectly with me. I am on mac OS (Texmaker also) and I couldn't try on windows. Edit: As suggested by @egreg , adding \usepackage{lmodern} might help.

Only top voted, non community-wiki answers of a minimum length are eligible