
當我發送電子郵件時,我喜歡[recipient]
在主題中包含內容,以便我可以快速識別回覆;注意方括號。據我所知,這曾經可以href
從hyperref
包中使用查找功能,但今天我注意到,%20
當我單擊打開電子郵件用戶端撰寫消息時,我在鏈接預覽中(這是我所期望的)和主題中看到了可見的字元(這我不記得以前有過問題)。
這是 MWE:
% !TEX program = lualatexmk
% !TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage{hyperref}
\begin{document}
Email: \href{mailto:[email protected]?subject=from documentation}{[email protected]}
Email: \href{mailto:[email protected]?subject=something from documentation}{[email protected]}
Email: \href{mailto:[email protected]?subject=[something] from documentation}{[email protected]}
\end{document}
當我懸停時,所有三個都在連結預覽中顯示明確轉義空格(我在 macOS 上使用 TeXShop 和 Preview)。當我點擊前兩個開啟我的電子郵件用戶端時,主題行中的空格正確呈現。但是,引入方括號會使%20
主題行中出現。
是什麼導致了這種行為?我搜尋了這個網站和文檔hyperref
,沒有發現與這個特定問題相關的任何內容。我可能錯過了什麼。
答案1
經過進一步的實驗,似乎將[
和替換]
為%5B
和%5D
分別解決了問題,但我不完全明白為什麼,因為沒有必要將空格替換為%20
。
% !TEX program = lualatexmk
% !TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage{hyperref}
\begin{document}
Email: \href{mailto:[email protected]?subject=from documentation}{[email protected]}
Email: \href{mailto:[email protected]?subject=something from documentation}{[email protected]}
Email: \href{mailto:[email protected]?subject=[something] from documentation}{[email protected]}
Email: \href{mailto:[email protected]?subject=%5Bsomething%5D from documentation}{[email protected]}
\end{document}
根據 Ulrike 的評論和鏈接,這似乎是 Apple PDF 渲染的一個持續存在的問題,這裡的解決方案充其量只是一個解決方法。