In a dictionary a headword can consist of special characters like in this example : Eyja·fjalla··jök|ull. I would like to achieve that the user in PDF reader in PDF file can search for Eyjafjallajökull (the headword without the special characters).
2 Answers
Very naive, but easy to generalize. Final definition should have two parameters and take maximum of two lengths.
\documentclass[11pt]{article}
\usepackage{color}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
\newlength\eyja
\settowidth{\eyja}{Eyjafjallajökull}
In a dictionary a headword can consist of special characters like in this example
\makebox[\eyja]{\color{white}Eyjafjallajökull}\hspace{-\eyja}Eyja·fjalla··jök|ull.
I would like to achieve that the user in PDF reader in PDF file can search for
Eyjafjallajökull (the headword without the special characters).
\end{document}
Alas, I cannot add the resulting PDF here. Tested only under Acrobat Reader.
Updated: - Preview in Evince.
-
-
It works in Evince too. If I understand it correctly, I should set the width each time new headword appears, so the box corresponds to the width of the headword.– chejnikDec 12, 2013 at 7:28
-
2If you just want searchable and are okay with the headword being slightly off (in terms of the highlighted parts when you search), you can just use
\rlap{\color{white}Original Word}Head-word-with-symbols
instead of the\makebox
incantation. This way you also don't need to measure the lengths. Dec 12, 2013 at 14:29 -
accsupp
does allow for this:
\documentclass{article}
\usepackage{accsupp}% http://ctan.org/pkg/accsupp
\begin{document}
\BeginAccSupp{ActualText=Eyjafjallajokull}
Eyja$\cdot$fjalla$\cdot\cdot$j{\"o}k$\vert$ull
\EndAccSupp{}
\end{document}
While the selection might not be as expected, the search works (in Adobe Reader, at least).
-
1
-