I'm generating a LaTeX document as so:
\documentclass{article}
\usepackage[letterpaper, margin=0.75in]{geometry}
\usepackage[tocindentauto]{tocstyle}
\usetocstyle{standard}
\usepackage{parskip}% http://ctan.org/pkg/parskip
\usepackage[hidelinks]{hyperref}
\usepackage{spverbatim}
\usepackage{listings}
...
\subsubsection{HEADER\_SNTP\_POLL\_FAILURE}
Request function: \verb#SNTP_POLL_FAILURE#
Assignments: \begin{lstlisting}
msg = some_interesting_function_call(&etc)
\end{lstlisting}
The difficulty I'm having is twofold:
- The header is not searchable. If a user searches for "HEADER_SNTP_POLL_FAILURE" they do not get a hit on the subsubsection header. However, "SNTP_POLL_FAILURE" does get a hit, on the "Request function" text inside the \verb.
- If a user searches for "some_interesting_function_call" they will not get a hit on the lstlisting. And if I copy the text out of the PDF and into a terminal, it comes out like this: s ome i n t e r e s t i n g f u n c t i o n c a l l This makes the code listing pretty useless, as it makes using the document as a reference pretty awkward.
How can I solve this? I want the listings to be useful as a copy-and-paste source, and I want to be able to search for symbols in the listings and in section headings.