1

I'm not 100% sure whether this is a question for this site, but as the base of the code it tex I'll post it here.

I have a simple file:

\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\begin{document}

Test for searching \textbackslash{}untilmore

Test for searching \textbackslash{}until

Test for searching \textbackslash{}unti

\end{document}

When I create a pdf from this with pdflatex and sear in the pdf file for:

  • \unti I get 3 matches
  • \until I get NO matches

Used latex version: This is pdfTeX,Version 3.14159265-2.6-1.40.21 (MiKTeX 20.12)

Used reader: Adobe acrobatReader DC Version 2020.013.20074

The resulting image of the pdf file:

enter image description here

Any idea what might be the problem here?

3
  • Which PDF viewer do you use to search in the PDF? I tried with SumatraPDF (v3.1.2 on Win10) and got three hits for \unti and two for \until.
    – moewe
    Jan 17, 2021 at 13:45
  • I'm using Adobe acrobatReader DC Version 2020.013.20074 (added this to the question now as well)
    – albert
    Jan 17, 2021 at 13:47
  • Using sumatra I get 2 matches for \until. The same with chrome. Jan 17, 2021 at 13:48

1 Answer 1

1

The PDF has (for the first line)

  • string T

  • relative move

  • string est

  • relative move

  • string for

  • relative move

  • string searc

  • relative move

  • string hing

  • relative move

  • string \un

  • relative move

  • string tilmore

Where the relative moves come from TeX inter word spaces and inter-letter kerns.

So whether a PDF reader finds \until depends on the heuristics of that reader determining what constitutes a word.

In xpdf \unti is found three times and \until is found twice.

7
  • Sorry I don't get this. I also tried a small file where I removed everything except once \until but still nothing found (in acroreader).
    – albert
    Jan 17, 2021 at 13:57
  • @albert tex adds a kern (small negative space) between n and t in the font you are using, so the string \until is not in the PDF but rather the two strings \un and til this is essentially identical to the PDF you would get from input of two words except words have a larger positive space and inter-letter kerns have a smaller (and in this case negative) space. But there is no definite rule here, the pdf reader has to guess which spaces to ignore when searching. Jan 17, 2021 at 14:00
  • I understand that acroreader might see 2 words un and til but it is a bit strange that searching for until so without the ` does succeed as well as \unti`. Might of course be some weird (?) heuristic.
    – albert
    Jan 17, 2021 at 14:04
  • 2
    @albert yes seems to be acroread specific perhaps seeing the \ it decided not to ignore small spaces looking for natural language words and uses some "literal code" heuristic instead. I really can't guess what it is doing. Jan 17, 2021 at 14:07
  • 1
    Using advanced search in acrobat I get two hits for \ until. ( A space between the \ and the u) Jan 17, 2021 at 14:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .