In order to avoid the selection of a part of a pdf, I use this command:
\usepackage{accsupp}
\DeclareRobustCommand\squelch[1]{%
\BeginAccSupp{method=plain,ActualText={}}#1\EndAccSupp{}}
For elements in the same page it works, but for elements that are in 2 or more pages, only those that are in the first page are unselectable.
\documentclass{article}
\usepackage{accsupp}
\DeclareRobustCommand\squelch[1]{%
\BeginAccSupp{method=plain,ActualText={}}#1\EndAccSupp{}}
\begin{document}
\squelch{
\section{Sec}
\paragraph{Par}
\newpage
\paragraph{par}
}
\end{document}
How can I improve the \squelch
function?
atbegshi
package (named after the command AtBeginShipout), which hooks to the event that LaTeX completes the current page (i.e., 'shipout'). With this you could insert code to end the pdf marked content operator and immediately start a new one on the next page. You would also need manually implement the operator at the start and end of your to-be-squelched fragment, which could be in the middle of the page [...] – Marijn Feb 28 '19 at 10:13accsupp
, which would be a big task, and it might not even work in the end. You could try to file a feature request for the package to include multi-page functionality - or decide that (non-)selectability is not so important after all. – Marijn Feb 28 '19 at 10:17