This question is related to a previous question regarding machine readability of a PDF generated using moderncv.
I'm trying add some hidden description within the PDF, so the information is not visible or printable on the PDF, but it's there on the copy-paste text extraction or through pdftotext. So far, the best way has been through transparency, using the transparent package. However, I'm getting errors when I try to add transparent characters within some macros.
! Undefined control sequence.
\transparent ...n@ =\z@ \def \x {0}\else \edef \x
{\strip@pt \dimen@ }\edef ...
followed by the line that calls the macro where I'm trying to put transparent chars.
I'm using pdflatex. Here's my MWE (non-working, because of the errors):
\documentclass{article}
\usepackage{transparent}
\begin{document}
\section{First example}
Hello \texttransparent{0}{THIS IS FUNNY~}world
\section{Second example}
Hello \makebox[0pt]{\texttransparent{0}{THIS IS FUNNY~}}world
%the next line gives error
\section{Third \makebox[0pt]{\texttransparent{0}{ERROR~}}example}
This one gives error
%the next line gives error
\section{\texorpdfstring{Fourth \makebox[0pt]{\texttransparent{0}{ERROR~}}example}{Fourth example}}
Also error
\end{document}
Like I said at the beginning, my issue is with the moderncv macros and transparency. But I hope that understanding/fixing the errors in this MWE will help me address the ones on my document. Do I need to patch the section macro from article?. Or call the transparency in a different way
As always, thanks to the community for its help.
protectwill work on my actual document withmoderncvmacros? – phollox Jul 19 '18 at 11:59\protectis part of the LaTeX kernel and is designed for this kind situation, so I guess it will work if the use case is similar. If it doesn't, you can always post a question and link to this one. – Phelype Oleinik Jul 19 '18 at 12:07