2

Many dictionaries insert a \cdot between syllables of a word, as shown below:

aardvark

These dots can be helpful in making sense of complex words, and in some cases essential: without explicitly marking syllable divisions, you could not easily tell that Ai (an ancient city) is two syllables.

Unfortunately, these dots mean one cannot simply Ctrl+F and search for "aardvark." This doesn't matter if the document is printed, but easy searching is a major advantage of electronic formats, and it would be a shame to have to give that up.

Is there a way to configure LaTeX or the pdf so that the above text could be found with a simple text search (so the search function "skipped over" the \cdot)?

It seems this could be done if LaTeX had a way to make "hidden" characters that show up on the screen but not in the text that is searched? Is there another way to approach this?

  • Welcome! A minimal document which demonstrates how you are producing the text and how you are configuring other key aspects of the document would make it easier for people to help you. There is the layer stuff you can do for PDF. You could, I guess, fake it by overlaying the dot and increasing the kerning. (I guess the search would not see the kerning as a character as it doesn't usually.) – cfr Mar 23 '16 at 23:52
2

There is one way that is reader-specific. accsupp works well with Adobe Reader:

enter image description here

\documentclass{article}

\usepackage{accsupp,xstring}

\makeatletter
\newcommand{\@syllable}{$\cdot$}
\newcommand{\setsyllable}[1]{\renewcommand{\@syllable}{#1}}
\newcommand{\dict}[1]{%
  \StrSubstitute{#1}{|}{}[\@ActualText]% Strip syllable symbol |
  \StrSubstitute{#1}{|}{\@syllable}[\@VisualText]% Replace syllable
  \BeginAccSupp{ActualText=\@ActualText}\@VisualText\EndAccSupp{}%
}
\makeatother

\begin{document}

\dict{Aard|vark}

\setsyllable{:}

\dict{Aar|dv|ark}

\setsyllable{-}

\dict{A|a|r|d|v|a|r|k}

\end{document}

This does not work with Sumatra.

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.