3

So, it's a strange question: I know that LaTeX has some problems with the copy-paste from a PDF which, sometimes, need thing like the package cmap. But at this point I never needed such thing, as my PDF generated with PDFLatex was always crystal clear.

But currently I am working on a thesis (with a large number of packages) and, strangely, the texts in the generated PDF are difficult to select.

The point that make my question different from the classic one is that the problem seems to happen only with certain editors (like Sumatra PDF) and not with other editor (like Adobe Reader), for the same PDF, which is very strange: if the problem was a character problem like ligatures and special characters, it should appear for every reader.

What am I missing?

edit :

Some precision and illustration.

The problem : on the phrase (in french sorry):

"La robotique voit aujourd'hui l'apparition de nouveaux usages, apportant de >nouvelles contraintes et appelant donc à de nouvelles techniques : on >cherche par exemple à pouvoir déployer des robots dans les espaces publics >ou encore dans les foyers."

A copy from adobe give the good result. A copy from sumatra give :

La r ob ot i q u e v oi t au j ou r d ’ h u i l ’ ap p ar i t i on d e n ou v e au x u s age s , ap p or t an t d e n ou v e l l e s c on t r ai n t e s e t ap p e l an t d on c à d e n ou v e l l e s t e c h n i q u e s : on c h e r c h e p ar e x e m p l e à p ou v oi r d é p l oy e r d e s r ob ot s d an s l e s e s p ac e s p u b l i c s ou e n c or e d an s l e s f oy e r s .

And it give when i do the selection : copy.

We see the holes in the selected text.

Ideally i want to make my pdf selectable in every editor. It's not a general problem in sumatra as it suceed to open other pdf, so it dhould be possible to fix i guess.

The packages in my tex (sorry, it's a big document with a lot of package):

\pdfobjcompresslevel 0
\documentclass[a4paper,12pt,oneside,final, DIV=12, listof=totoc, bibliography=totoc, toc=bibliography, open=right, chapterprefix=true]{scrbook}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage[greek,english,french]{babel}
\def\frenchtablename{Tableau}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{pdfpages}
\usepackage{xspace}
\newcommand{\g}[1]{\og #1 \fg}

\definecolor{usccardinal}{rgb}{0.0, 0.0, 0.4}
\usepackage[final]{hyperref}
\usepackage{footnotehyper}
\usepackage{footnotebackref}
\usepackage{tablefootnote}

\usepackage{enumitem}
\setuptoc{toc}{totoc}
\usepackage{etoc, blindtext}

\newlength\tocrulewidth
\setlength{\tocrulewidth}{0.5pt}

\newcommand{\chaptertoc}[1][Chaptertoc]{%
\begingroup
\textbf{Sommaire du chapitre :} 
\parindent=0em
\etocsettocstyle{\rule{\linewidth}{\tocrulewidth}\vskip0.5\baselineskip}{\rule{\linewidth}{\tocrulewidth}}
\localtableofcontents 
\endgroup
}

\makeatletter
\renewcommand*\@pnumwidth{2em}
\makeatother

\rmfamily % initialise la famille de font pour les deux commandes suivantes, sinon ce n'est fait qu'au begin document
\DeclareFontShape{T1}{lmr}{b}{sc}{<->ssub*cmr/bx/sc}{}
\DeclareFontShape{T1}{lmr}{bx}{sc}{<->ssub*cmr/bx/sc}{}

\usepackage[backend=biber,natbib=true, style=authoryear, autopunct=false, uniquename=false, uniquelist=false, mincitenames=1,maxcitenames=2,bibencoding=utf8, maxbibnames=99]{biblatex} % On utilise biblatex à la place de bibtex, ce qui permet une meilleure compatibilité avec koma-script. Pour ne pas s'embeter on lui demande de mimer le comportement de natbib, ce qui permet d'avoir la commande citep.
\usepackage{csquotes}
\addbibresource{biblio.bib} % on précise la source biblio

\setlength\bibitemsep{1.5\itemsep}

\DeclareCiteCommand{\cite}
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \printtext[bibhyperref]{\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\cite}
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \printtext[bibhyperref]{\usebibmacro{citeyear}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\parencite}[\mkbibparens]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
    \printtext[bibhyperref]{\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\parencite}[\mkbibparens]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
    \printtext[bibhyperref]{\usebibmacro{citeyear}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\footcite}[\mkbibfootnote]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
  \printtext[bibhyperref]{ \usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\footcitetext}[\mkbibfootnotetext]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \printtext[bibhyperref]{\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\textcite}
  {\boolfalse{cbx:parens}}
  {\usebibmacro{citeindex}%
   \printtext[bibhyperref]{\usebibmacro{textcite}}}
  {\ifbool{cbx:parens}
     {\bibcloseparen\global\boolfalse{cbx:parens}}
     {}%
   \multicitedelim}
  {\usebibmacro{textcite:postnote}}

\DeclareCiteCommand{\longcite}
  {\usebibmacro{prenote}}%
  {\usebibmacro{citeindex}%
   \defcounter{maxnames}{99}%
   \printtext[bibhyperref]{\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

  \DeclareCiteCommand*{\longcite}
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \defcounter{maxnames}{99}%
   \printtext[bibhyperref]{\usebibmacro{citeyear}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\longparencite}[\mkbibparens]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
    \defcounter{maxnames}{99}%
    \DeclareNameAlias{labelname}{given-family}%
    \printtext[bibhyperref]{\usebibmacro{cite}}}%
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\longparencite}[\mkbibparens]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
    \defcounter{maxnames}{99}%
    \DeclareNameAlias{labelname}{given-family}%
    \printtext[bibhyperref]{\usebibmacro{citeyear}}}%
  {\multicitedelim}
  {\usebibmacro{postnote}}  

\RedeclareSectionCommand[beforeskip=0pt,afterskip=5\baselineskip]{chapter}
\setkomafont{chapterprefix}{\Large\mdseries}
%
\renewcommand*{\chapterformat}{%
  \chapappifchapterprefix{\nobreakspace}\thechapter\autodot%
  \IfUsePrefixLine{%
    \par\nobreak\vspace{-\parskip}\vspace{-.2\baselineskip}%
    \rule{0.9\textwidth}{.5pt}%trace une ligne
  }{\enskip}%
}


\renewcommand{\chapterlineswithprefixformat}[3]{%
  \ifstr{#2}{}{#2#3\par\bigskip\hrule}{#2#3}%
  %
}

\renewcommand*{\sectionformat}{%
  \thesection\enskip
  \textcolor{RoyalBlue!50}{\rule[-\dp\strutbox]{2pt}{\baselineskip}}\enskip
}

\addtokomafont{section}{\clearpage\phantomsection}

\usepackage[automark, headsepline, footsepline,plainfootsepline, plainheadsepline]{scrlayer-scrpage}
\clearpairofpagestyles

\ihead[]{}
\ofoot[\pagemark]{\pagemark} 
\ifoot[Nils Beaussé]{Nils Beaussé} 
\pagestyle{scrheadings}

\usepackage{bookmark}

\usepackage{lipsum}
\usepackage{graphicx}
\graphicspath{ {images/} }
\usepackage[format=plain, font=small, labelfont=bf, textfont=it]{caption}
\usepackage{floatrow}
\usepackage{pifont}
\usepackage{placeins}
\usepackage{wrapfig}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{import}
\usepackage{subcaption}

\definecolor{bleu_defaut}{RGB}{31, 119, 180}

\DeclarePairedDelimiter\abs{\lvert}{\rvert}%
\DeclarePairedDelimiter\norm{\lVert}{\rVert}%
\makeatletter
\let\oldabs\abs
\def\abs{\@ifstar{\oldabs}{\oldabs*}}
%
\let\oldnorm\norm
\def\norm{\@ifstar{\oldnorm}{\oldnorm*}}
\makeatother

\DeclareMathOperator{\e}{e}
\usepackage[french,onelanguage,noend]{algorithm2e}
\usepackage{amsmath,eqparbox,xintexpr}
\usepackage{nccmath}

\newcommand{\norme}[1]{\left\Vert #1\right\Vert}

\makeatletter
\newcommand*\addsubsec{\secdef\@addsubsec\@saddsubsec}
\newcommand*{\@addsubsec}{}
\def\@addsubsec[#1]#2{\subsection*{#2}\addcontentsline{toc}{subsection}{#1}
  \if@twoside\ifx\@mkboth\markboth\markright{#1}\fi\fi
}
\newcommand*{\@saddsubsec}[1]{\subsection*{#1}\@mkboth{}{}}
\makeatother

\definecolor{bleuNuit}{rgb}{0.0, 0.0, 0.6}
\definecolor{rougepr}{rgb}{0.6, 0.0, 0.0}

\date{\today}

\sloppy

\newcommand*{\tg}[1]{\textgreek{#1}}

\newcommand{\sebrace}[1]{%
    \ifcase#1\or\or%
        \newcommand\NumOfStruts{\mathstrut\\}%
    \or 
        \newcommand\NumOfStruts{\mathstrut\\\mathstrut\\}%
    \or
        \newcommand\NumOfStruts{\mathstrut\\\mathstrut\\\mathstrut\\}%
    \or
        \newcommand\NumOfStruts{\mathstrut\\\mathstrut\\\mathstrut\\\mathstrut\\}%
    \or
        \newcommand\NumOfStruts{\mathstrut\\\mathstrut\\\mathstrut\\\mathstrut\\\mathstrut\\}%
    \fi
    \raisebox{\xinttheiexpr [1](0.5*((#1)-1))\relax\normalbaselineskip}[0pt][0pt]{%
        $\left\{\begin{array}{@{}c@{}} \NumOfStruts\mathstrut\end{array}\right.$
    }
}

\newcommand{\sebracein}[1]{%
    \ifcase#1\or\or%
        \newcommand\NumOfStruts{\mathstrut\\}%
    \or 
        \newcommand\NumOfStruts{\mathstrut\\\mathstrut\\}%
    \or
        \newcommand\NumOfStruts{\mathstrut\\\mathstrut\\\mathstrut\\}%
    \fi
    \raisebox{\xinttheiexpr [1](0.5*((#1)-1))\relax\normalbaselineskip}[0pt][0pt]{%
        \left\{\begin{array}{@{}c@{}} \NumOfStruts\mathstrut\end{array}\right.
    }
}

\renewcommand{\contentsname}{Table des matières}

\usepackage[float=false]{scrhack}

\usepackage{siunitx}
\sisetup{
  locale=FR,
  detect-all,
  output-decimal-marker={,},
  group-minimum-digits = 3,
  group-separator={\,},
  number-unit-product={\,},
  group-digits = integer,
  inter-unit-product=\ensuremath{{\cdot}}
}

EDIT : NEW MINIMAL EXAMPLE :


%%%%%%%%%%% LOT OF PACKAGES AND DEFINITIONS %%%%%%%%%%
\pdfobjcompresslevel 0

\documentclass[a4paper,12pt,oneside,final, DIV=12, listof=totoc, bibliography=totoc, toc=bibliography, open=right, chapterprefix=true]{scrbook}

\usepackage[greek,english,french]{babel}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[final]{hyperref}
\usepackage{amssymb}

%%%%%%%%%%% LOT OF PACKAGES AND DEFINITIONS END %%%%%%%%%%

%%%%%%%%%%% BEGENNING OF THE WORK ON FOOTNOTES %%%%%%%%%%

%%%%%%% some package %%%%%%%
\KOMAoptions{DIV=last}

%%%%%% begin %%%%%%%
\begin{document}
\frontmatter
%%%%%% TEST %%%%%%

\chapter{TEST}
\section{Introduction}

EEEEEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEE

EEEEEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEE


\end{document}

Give :

E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E

if selected on certain viewer like the last version of sumatra.

Note that this seem to not be a problem of accentuation as

ÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉ EEEEEEEEEEEEEEEEE

EEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEE

Give :

É É É É É É É É É É É É É É É É E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E

  • 1
    no pdfviewer can be different. I just had an example where sumatra copied a mathematical c and the adobe reader a mathematical b (which was correct). But without more data about the fonts and the chars involved it is not possible to say more. – Ulrike Fischer Mar 18 at 21:10
  • @UlrikeFischer: I think you meant "No. Pdfviewers can be different". – Peter Grill Mar 18 at 21:35
  • Hum Ok, the font is a classical latin modern T1, nothing exotic here ... – Nils Beaussé Mar 19 at 2:30
  • Ok, @UlrikeFischer : I have precised my problem with some illustration, image and with the begenning of the document ;) – Nils Beaussé Mar 19 at 10:37
  • Make a small but complete example. It should be easy to use only one of the offending paragraphs as body and to remove unnecessy stuff from the preamble. – Ulrike Fischer Mar 19 at 10:55
1

So finally, to resume the discussions in the comments and on other site : It appears that this is not a latex problem. But a SumatraPDF bug that seems to have been introduced between the 3.1.2 and the 3.2.

I have opened an issue on the github of sumatra_pdf and the bug have been reproduced and it is currently tracked by the collaborator of the soft.

Feel free to participate on the github page of the bug : https://github.com/sumatrapdfreader/sumatrapdf/issues/1505

| improve this answer | |

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.