1

I'm having an issue where if I copy words out of a PDF (generated with XeLaTeX) where the text copied out includes random Greek characters.

\documentclass[12pt,a4paper,english]{report}
% setup encoding
\usepackage[utf8]{inputenc}
%set language
\usepackage[british,english]{babel}
\usepackage[T1]{fontenc}
\usepackage{lmodern,cmap}
%setup font
\usepackage{fontspec}
\setmainfont{Calibri}

\begin{document}
{\large A dissertation submitted in partial fulfilment of\\
the requirements for the degree of\\}
\end{document}

(I've omitted text for simplicity).

Generating a PDF for the above and copying out the body, gives the following string:

A dissertaƟon submiƩed in parƟal fulĮlment of the requirements for the degree of

If I remove the font inclusion, then copy paste works fine, so I've reason to believe it's an issue with how I'm using the font? Anyone got any ideas

4

Don't use inputenc, lmodern, cmap and fontenc with XeLaTeX or LuaLaTeX. But beside this it is a problem with the ligatures. They are not correctly mapped to unicode entries with XeLaTeX. With LuaLaTeX it works:

\documentclass[12pt,a4paper,english]{report}
\usepackage[british,english]{babel}

\usepackage{fontspec}
\setmainfont{Calibri.ttf}

\begin{document}
{\large A dissertation submitted in partial fulfilment of\\
the requirements for the degree of\par}
\end{document} 

XeLaTeX:

A disserta􀆟on submi􀆩ed in par􀆟al fulfilment of the requirements for the degree of

LuaLaTeX

A dissertation submitted in partial fulfilment of the requirements for the degree of

  • Wonderful! Thank you, removing those packages and changing over to LuaLaTeX as per your recommendation resolved my issue! – Peter Reid Mar 1 at 17:55

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.