3

I was wondering if there was some way to make it so that when you click on certain text in a latex document, it is immediately copied. I am trying to make an address book for myself and it would be nice if I could just click the email addresses or postal codes instead of having to highlight and copy since it can be quite finicky.

\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage[svgnames]{xcolor}
\usepackage[most]{tcolorbox}
\geometry{vmargin = 1cm, hmargin = 1cm}

\begin{document} \begin{tcbitemize}[raster force size = false, raster columns =3, ,raster column skip = 4mm, size=small,colframe=Silver,colback=yellow!10!white] \tcbitem \textbf{Example 1}\ Example1@texmail.com

\vspace{5mm}

1234 Road Pkwy,\ Moonview, ZZ\ B4H 4H4 \tcbitem \textbf{Example 2}\ Example2@texmail.com

\vspace{5mm}

4321 RR Rd,\ Sunview, ZZ\ B5H 5H5

\tcbitem \textbf{Example 3}\ Example3@texmail.com

\vspace{5mm}

2143 Ave Blvd,\ Retrograde, UV\ 54321 \end{tcbitemize}

\end{document}

enter image description here

Marijn
  • 37,699
Infimum
  • 43
  • 1
    You can double-click the e-mail address to select it and then press ctrl-c (or right-click and copy), and triple-click the postal code (or the street address for example) to select the whole line. Isn't that an easy way already? – Marijn Oct 15 '22 at 15:36
  • Oh thanks! I didn't know about the triple click thing. That works! I also just wanted to see what the limitations of latex are. If this too much for latex, that is fine. – Infimum Oct 16 '22 at 01:35
  • You can use JavaScript within a PDF to do things like copying to the clipboard, see https://tex.stackexchange.com/questions/444917/the-tikz-game-package-a-tex-sx-project/444956 for an example of the general approach, or https://tex.stackexchange.com/questions/117141/hide-latex-parts-through-javascript for a more convenient syntax using the insdljs package. However, this does not work in all PDF viewers, Adobe Reader is more or less the only reader that supports this fully. – Marijn Oct 16 '22 at 09:44

0 Answers0