2

I export an English document to PDF using pdflatex on LyX. The resulting PDF is not searchable (although all the external embedded PDFs that I included as graphics are searchable).

Also, when I select and copy text, it appears as "✇❤✐❝❤ ✐s ❞❡✜♥❡❞" when I paste it.

How do I make my generated PDF searchable?

Under "Use LaTeX font encoding:" it says "T1" and the LyX file is:

#LyX 2.0 created this file. For more info see http://www.lyx.org/
\lyxformat 413
\begin_document
\begin_header
\textclass article
\begin_preamble
\usepackage{cancel}
\end_preamble
\use_default_options true
\maintain_unincluded_children false
\language canadian
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100

\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize a4paper
\use_geometry true
\use_amsmath 1
\use_esint 1
\use_mhchem 1
\use_mathdots 1
\cite_engine basic
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\leftmargin 3cm
\topmargin 2cm
\rightmargin 3cm
\bottommargin 2cm
\headheight 1cm
\headsep 1cm
\footskip 1cm
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 2
\paperpagestyle fancy
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Standard
This is some text
\end_layout

\end_body
\end_document

The LaTeX log is:

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) (format=pdflatex 2015.6.21)  30 SEP 2015 22:53
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**newfile1.tex
(./newfile1.tex
LaTeX2e <2011/06/27>
Babel <3.9h> and hyphenation patterns for 12 languages loaded.

(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
) (/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
Package: fontenc 2005/09/27 v1.99g Standard LaTeX package
(/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.def
File: t1enc.def 2005/09/27 v1.99g Standard LaTeX file
LaTeX Font Info:    Redeclaring font encoding T1 on input line 43.
)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty
Package: inputenc 2008/03/30 v1.1d Input encoding file
\inpenc@prehook=\toks14
\inpenc@posthook=\toks15
(/usr/share/texlive/texmf-dist/tex/latex/base/latin9.def
File: latin9.def 2008/03/30 v1.1d Input encoding file
)) (/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty
Package: geometry 2010/09/12 v5.6 Page Geometry
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 1999/03/16 v1.13 key=value parser (DPC)
\KV@toks@=\toks16
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO)
Package ifpdf Info: pdfTeX in PDF mode is detected.
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifvtex.sty
Package: ifvtex 2010/03/01 v1.5 Detect VTeX and its facilities (HO)
Package ifvtex Info: VTeX not detected.
) (/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty
Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional
)
\Gm@cnth=\count87
\Gm@cntv=\count88
\c@Gm@tempcnt=\count89
\Gm@bindingoffset=\dimen103
\Gm@wd@mp=\dimen104
\Gm@odd@mp=\dimen105
\Gm@even@mp=\dimen106
\Gm@layoutwidth=\dimen107
\Gm@layoutheight=\dimen108
\Gm@layouthoffset=\dimen109
\Gm@layoutvoffset=\dimen110
\Gm@dimlist=\toks17
) (/usr/share/texlive/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty
\fancy@headwidth=\skip43
\f@ncyO@elh=\skip44
\f@ncyO@erh=\skip45
\f@ncyO@olh=\skip46
\f@ncyO@orh=\skip47
\f@ncyO@elf=\skip48
\f@ncyO@erf=\skip49
\f@ncyO@olf=\skip50
\f@ncyO@orf=\skip51
) (/usr/share/texlive/texmf-dist/tex/latex/cancel/cancel.sty
Package: cancel 2013/04/12 v2.2 Cancel math terms
) (/usr/share/texlive/texmf-dist/tex/generic/babel/babel.sty
Package: babel 2013/12/03 3.9h The Babel package
(/usr/share/texlive/texmf-dist/tex/generic/babel-english/english.ldf
Language: english 2012/08/20 v3.3p English support from the babel system
(/usr/share/texlive/texmf-dist/tex/generic/babel/babel.def
File: babel.def 2013/12/03 3.9h Babel common definitions
\babel@savecnt=\count90
\U@D=\dimen111
)
\l@canadian = a dialect from \language\l@american 
\l@australian = a dialect from \language\l@british 
\l@newzealand = a dialect from \language\l@british 
))
No file newfile1.aux.
\openout1 = `newfile1.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 20.
LaTeX Font Info:    ... okay on input line 20.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 20.
LaTeX Font Info:    ... okay on input line 20.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 20.
LaTeX Font Info:    ... okay on input line 20.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 20.
LaTeX Font Info:    ... okay on input line 20.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 20.
LaTeX Font Info:    ... okay on input line 20.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 20.
LaTeX Font Info:    ... okay on input line 20.
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex

Package geometry Warning: The marginal notes overrun the paper.
     Add 46.64174pt and more to the right margin.

*geometry* verbose mode - [ preamble ] result:
* driver: pdftex
* paper: a4paper
* layout: <same size as paper>
* layoutoffset:(h,v)=(0.0pt,0.0pt)
* modes: twoside 
* h-part:(L,W,R)=(85.35826pt, 426.79135pt, 85.35826pt)
* v-part:(T,H,B)=(56.9055pt, 731.23584pt, 56.9055pt)
* \paperwidth=597.50787pt
* \paperheight=845.04684pt
* \textwidth=426.79135pt
* \textheight=731.23584pt
* \oddsidemargin=13.08827pt
* \evensidemargin=13.08827pt
* \topmargin=-72.26997pt
* \headheight=28.45274pt
* \headsep=28.45274pt
* \topskip=10.0pt
* \footskip=28.45274pt
* \marginparwidth=121.0pt
* \marginparsep=11.0pt
* \columnsep=10.0pt
* \skip\footins=9.0pt plus 4.0pt minus 2.0pt
* \hoffset=0.0pt
* \voffset=0.0pt
* \mag=1000
* \@twocolumnfalse
* \@twosidetrue
* \@mparswitchtrue
* \@reversemarginfalse
* (1in=72.27pt=25.4mm, 1cm=28.453pt)

[1

{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./newfile1.aux) ) 
Here is how much of TeX's memory you used:
 1517 strings out of 494724
 18826 string characters out of 6174697
 76456 words of memory out of 5000000
 4899 multiletter control sequences out of 15000+600000
 5222 words of font info for 16 fonts, out of 8000000 for 9000
 102 hyphenation exceptions out of 8191
 31i,10n,43p,227b,230s stack positions out of 5000i,500n,10000p,200000b,80000s
 </home/
user/.texmf-var/fonts/pk/ljfour/jknappen/ec/ecrm1000.600pk>
Output written on newfile1.pdf (1 page, 3877 bytes).
PDF statistics:
 22 PDF objects out of 1000 (max. 8388607)
 8 compressed objects within 1 object stream
 0 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)

(Link to pdf)

  • 1
    Since a default \documentclass{article}\begin{document}Hello world!\end{document} typically is searchable and typically copy-pastes just fine, and since adding \usepackage{cancel} does nothing to alter that situation, how are we supposed to guess what in your document makes parts of it unsearchable without any clue as to what is in it? – cfr Oct 1 '15 at 2:13
  • What about fonts? what about encodings? These are likely culprits. But note how I'm guessing and not answering: that's because you have not (yet) provided enough useful information for someone to post an answer.... – jon Oct 1 '15 at 2:17
  • @jon question updated – Sparkler Oct 1 '15 at 2:27
  • @cfr question updated – Sparkler Oct 1 '15 at 2:27
  • When I add "hello there" to your document and compile it in LyX on Ubuntu. It compiles fine and the text is searchable using the Evince PDF reader. Can you post the log from compiling? In LyX, go to Document > LaTeX log and select "Copy to Clipboard". Paste that in here. – scottkosty Oct 1 '15 at 2:42
1

Firstly, you're essentially making the embedded pdfs pictures, hence why they are not searchable.

What you'll want to do is use something like pdfpages to include your files.

For example:

\usepackage{pdfpages}
\includepdf[pages={-}]{yourfile.pdf}

This will include all the pages in the document (as the range character "-" has no beginning or end value). If you want to put only a few pages into your new pdf, then you can use pages={1,2,9} for example.

  • I think you misunderstood me. All embedded PDFs are searchable -- they are embedded as-is, not as pictures. – Sparkler Oct 1 '15 at 1:44
  • Then yes, I must have. So if the embedded pdfs are searchable, what in your generated document is not searchable? The additional text you add that isn't in the embedded documents? – Geodesic Oct 1 '15 at 1:47
  • If that's the case it sounds like some strange behaviour. Can you provide a minimal working example? – Geodesic Oct 1 '15 at 1:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.