# How to improve machine-readability of a CV created in LaTeX with moderncv?

Some background story. I recently send my CV to a free online evaluation. The reply showed that although the document looked visually appealing, it was bad for ATS (Applicant Tracking System). These software packages match the content of the CV with the job offer and based on that filter most applicants. It turns out the PDF output of LaTeX is quite terrible for this. The evaluation recommended submitting resumes in .doc Word files.

After some research, I managed to fix most problems (ligatures, encoding, etc.). I'm basically using this format for my CV:

EDITED: Added some extra commands and partial solutions

\documentclass[10pt,letterpaper,sans]{moderncv}

%% ModernCV themes
\moderncvstyle{classic}
\moderncvcolor{black}
\moderncvicons{awesome}

%% Character encoding
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

%% Improve text-only output
\usepackage{xpatch}
\input{glyphtounicode}
\pdfgentounicode=1
\def\labelitemi{--} % Bullet list with a dash
% EDIT: modify cventry to add invisible colons (:) between year and content
\xpatchcmd{\cventry}{#2}{#2{\makebox[0pt]{\transparent{0}:}}}
{}{\typeout{===>Failure in patching \\cventry}}
% EDIT: redefined \social to add some description with transparency
\RenewDocumentCommand{\social}{O{}O{}m}{%
\ifthenelse{\equal{#2}{}}%
{%
\protect\makebox[0pt]{\protect\texttransparent{0}{www.github.com/}}
}

\usepackage[margin=1.75cm]{geometry}

%% Personal data
\firstname{Mickey}
\familyname{Mouse}
\phone{+1~(555)~123~4567}
\email{mickey@disney.com}

\begin{document}

% CURRICULUM VITAE
\newpage
\makecvtitle
\onehalfspacing

\section{\texorpdfstring{\faStar~Professional Summary}{Professional Summary}}
\cvlistitem{I'm a talking mouse, please hire me.}

\section{\texorpdfstring{\faIndustry~Experience}{Experience}}
\cventry{1940-present}{Cartoon character}{Walt Disney Company}{Animation Division}{}{}
\cventry{1950-present}{Company Mascot}{Walt Disney}{Worldwide}{}{I Hate the Pixar Lamp}

\cvlistitem{I can talk, please hire me.}

\section{\texorpdfstring{\faWrench~Skills}{Skills}}
\cvlistitem{I can talk, please hire me.}

\section{\texorpdfstring{\faTrophy~Awards}{Awards}}

\end{document}


Sorry for the long and cheesy example. I use the \texorpdfstring bit to avoid putting the symbol before the section name into the PDF bookmarks. However, these symbols are text chars, and parsed into the pdf text when I use pdftotext and also into the ATS software (which I asume uses something similar pdftotext). So my goal for now is to improve the output of pdftotext, so it is fully readable, and with as much "format" as possible (basically paragraph spacing between sections).

The lines \input{glyphtounicode} and \pdfgentounicode=1 removed some glyphs from the output, but not all of them, and I'm still getting incorrect symbols in front of the phone number, the email and the linkedin URL. \def\labelitemi{--} fixed the problem with the standard bullet item from moderncv (comment this line, compile the document and pass the pdf through pdftotext to see what I'm talking about). As you can see, ditching the extra symbols I put into the section titles won't completely solve my issue.

What I would like to do is typeset all those moderncvicons as images, if possible, or in some other way so they are visible in the pdf, but not readable as text from pdftotext or manual copy-paste. Also, I would like to add some hidden text, not visible in the pdf but accessible to pdftotext, to label accordingly the phone number and email address, and ideally show the full URL address to the linkedin/twitter profile. I don't mind tweaking the commands of moderncv in order to achieve this, or creating new commands from scratch.

The third level of complexity (I think) would be adding extra vertical space (one extra line) between \cventry entries and some separator between the year and the rest of the content, but only in the text-only output. I would like the PDF to stay more or less the same.

Is this doable? Or should I switch to .doc Word files?

BOUNTY:

I still need several stuff to consider this problem solved

1. I need a way to hide characters from the text-only version, but still visible on the pdf. Basically, the opposite of transparent. I need to apply this still unknown method to hide the twitter symbol, the email symbol and the phone symbol, and also the symbols at the beginning of each section.

2. I need to format properly the output of the transparent characters, because they seem to be added into a separate line (check the output of pdftotext)

• This will not answer your question, but I highly recommend you check out JSON Resume. I love LaTeX, but the idea of standardized resume schema, separate from formatting (with many options) seems like the future :D – Jesse Knight Jul 26 '18 at 2:44
• Thanks. I'll take a look. Definitely a completely different direction but quite interesting – phollox Jul 26 '18 at 18:35

Why is your PDF not properly searchable? The answer is at or closer to one of two extremes. Either, you have a searchable PDF and your CV content is rotten by reference to what search engines attempt to find OR you have solid content in your CV but your PDF is improperly encoded for searching as a standard PDF. The former problem will NOT be solved by switching to Word. You have to spend time structuring your CV with proper keywords and phrasing. The latter problem will be solved by switching to Word.

When you have the second problem and you still want to use LaTeX, I suggest that you avoid all icons and bullet items and lines and colors in your encoding. Also take out all non-PDF standard fonts. Stick to the basic bare minimum. For example, pull up your PDF in Adobe and check the fonts to see that they are within the 14 standard.

• Thanks for the point of view. The problem lies in the middle of those two extremes. ATS software are kind of a black box. I don't know how they work. I know the keywords they look are the ones in the job posting. However, they were not being recognized, due to the PDF encoding. I do want to keep using LaTeX. I like the visual appeal of the moderncv output. I will probably end up exporting the text to Word anyways. But still, I want to know if what I want is possible. – phollox Jul 10 '18 at 2:48
• The ATS software does not care about the visual appeal of your CV. Create a stripped down, bare bones CV using the article or report class. Use standard font encodings at only one size with no italics, bold, or underlines. Avoid all visual tweaks (separator lines and bullet icons). Finally, use a local app on your computer to search the PDF form of your CV and discover whether you have any problems. – Jeffrey J Weimer Jul 10 '18 at 13:22
• Again, you are right. ATS couldn't care less about the appeal. It only looks for content. Text. I could send a .txt file and that will work perfect. But ATS is the filter stage. Passing that stage mean that a human will read the CV, taking an average of 6-7 seconds before going to the next CV of ATS approved pile. Hence, I need to stand out of this pile for the human, but being ATS friendly at the same time. As I said, Word is probably the way to go. But I'm curious, and I'm learning to patch commands and macros in the meantime – phollox Jul 10 '18 at 13:37

I finally have something that more or less satisfy my requirements. I ended up using the package accsupp according to recommendations.

I also had to switch to lualatex from pdflatex for compilation of the .tex file. lualatex seems to handle better the encoding and substitution of glyphs from fontawesome, and there are no errors in the output of pdftotext. You will need to make sure the fontawesome fonts are readable by lualatex. In Linux, I created symbolic links in one on my system font directories to the .tfm and .otf files related to fontawesome within the texlive installation and updated the system font cache.

Using lualatex also meant ditching the transparent package, and instead, using accsupp everywhere.

\documentclass[10pt,letterpaper,sans]{moderncv}

\usepackage[margin=1.75cm]{geometry}
\usepackage{setspace}

%% ModernCV themes
\moderncvstyle[right]{classic}
\moderncvcolor{black}
\moderncvicons{awesome}

%% Character encoding
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

%% Improve text-only output
\def\labelitemi{--} % Bullet list with a dash
\usepackage{xpatch}
\usepackage{accsupp}

% Patch cventry - Add linebreak before and separator: after
\xpatchcmd{\cventry}{#2}{%
\protect\BeginAccSupp{%
method=pdfstringdef=true,ActualText=\unichar{"000A}#2:}%
#2\protect\EndAccSupp{}}%
{\typeout{===>Success in patching \\cventry}}
{\typeout{===>Failure in patching \\cventry}}

% Remove glyphs from text version and add description
\protect\BeginAccSupp{ActualText=}%
\protect\EndAccSupp{}}%

\renewcommand*{\fixedphonesymbol}{%
\protect\BeginAccSupp{ActualText=Telephone:}%
{{\faPhone}~}%
\protect\EndAccSupp{}}%

\renewcommand*{\emailsymbol}{%
\protect\BeginAccSupp{ActualText=Email:}%
{{\small\faEnvelopeO}~}%
\protect\EndAccSupp{}}%

% Define mySection, which removes symbols from text version
\newcommand{\mySection}[2]{%
\BeginAccSupp{method=pdfstringdef,ActualText=\unichar{'000A}#2:}%
\section{\texorpdfstring{#1~#2}{#2}}%
\EndAccSupp{}%
}

\newcommand{\mycvitem}[1]{%
\BeginAccSupp{method=pdfstringdef,ActualText={\unichar{"000A}#1:}}%
\cvitem{}{\textbf{#1}}%
\EndAccSupp{}}

\RenewDocumentCommand{\social}{O{}O{}m}{%
\ifthenelse{\equal{#2}{}}{%
{\protect\BeginAccSupp{method=pdfstringdef,
\protect\unichar{"000A}}}%
{\protect\BeginAccSupp{method=pdfstringdef,
\protect\unichar{"000A}}}%
{\protect\BeginAccSupp{method=pdfstingdef,
ActualText=\protect\unichar{"000A}www.github.com/#3%
\protect\unichar{"000A}}%
}

%% Personal data
\firstname{John}
\familyname{Doe}
\phone{+1~(555)~123~4567}
\email{mickey@disney.com}

\begin{document}

% CURRICULUM VITAE
\newpage
\makecvtitle
\onehalfspacing

\mySection{\faStar}{Professional Summary}
\cvlistitem{I'm a talking mouse, please hire me.}

\mySection{\faIndustry}{Experience}
\cventry{1940-present}{Cartoon character}{Walt Disney Company}{Animation Division}{}{}
\cventry{1950-present}{Company Mascot}{Walt Disney}{Worldwide}{}{I Hate the Pixar Lamp}

\cvlistitem{I can talk, please hire me.}

\mySection{\faWrench}{Skills}
\mycvitem{Languages}
\cvlistitem{I can talk, please hire me.}

\mySection{\faTrophy}{Awards}

It's messy. I know. But it works (at least on my side). Patching the actual cvitem might produce undesired results because this command is used within the definition of cvlistitem. That's why I defined mycvitem. Hope this helps at least someone.