6

Given the following minimal example:

\documentclass{article}
\begin{document}
$a \star b$.
\end{document}

This produces the desired output in the PDF file.

However, my problem is that if I search in the PDF file (with CTRL-F) for the questionmark character "?" (without quotation marks), that this specific star symbol is found by the search engine as if it were a questionmark (although it is a star).

This is annoying, because I like to search my final PDF for questionmarks in order to find outdated labels/citations etc. quickly. If there are lots of symbols like \star, that are found as "false positives", this workflow gets tedious and error prone.

Question: Is there a way to fix this issue? I want to use symbols like \star in my document but I don't want to find them in the final PDF when searching for questionmarks.

3

1 Answer 1

9

You can try glyphtounicode:

\documentclass{article}
\input glyphtounicode
\pdfgentounicode=1
\begin{document}
$a \star b$.
\end{document}
4
  • 3
    +1: Is there a reference for glyphtounicode somewhere? May 31, 2019 at 10:07
  • 1
    @Dr.ManuelKuehner See the pdftex documentation. May 31, 2019 at 10:10
  • That seems to work, thank you.
    – SampleTime
    May 31, 2019 at 10:11
  • 2
    @SampleTime Possible alternative: The pdftex manuals states, that the ctan.org/pkg/cmap package has the same effect (LATEX users could load the cmap package to achieve the same effect.). But I think that Ulrike's approach is more general and safer (see tex.stackexchange.com/questions/451235). May 31, 2019 at 10:27

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.