包含 Windows 文档路径的二维码

包含 Windows 文档路径的二维码

在我的 LaTeX 文档中,我需要在各个位置放置多个二维码。二维码应包含文件路径,格式为 Z:\01 Customer\Projectname A\04 Picture。我打算使用 将路径定义为新命令\newcommand{\qrpicpath}{Z:\01 Customer\Projectname A\04 Picture},然后使用 将其输出为二维码\qrcode*{\qrpicpath}

但是,QR 码中的空格消失了。输出结果类似 Z:\01Customer\ProjectnameA\04Picture

\documentclass{article}
\usepackage{qrcode}

\newcommand{\qrpicpath}{\detokenize{Z:\01 Customer\Projectname A\04 Picture}}

\begin{document}
  \qrcode*{\qrpicpath}
\end{document}

我怎么解决这个问题?

答案1

这似乎有效:

\documentclass{article}
\usepackage{qrcode}
\ExplSyntaxOn
\newcommand\rescan{\tl_set_rescan:Nnn}
\ExplSyntaxOff
\rescan \qrpicpath{\catcode`\ =12 \catcode`\\=12}{Z:\01 Customer\Projectname A\04 Picture}
\begin{document}
  \qrcode*{\qrpicpath}
\end{document}
<QR code requested for "Z:\01 Customer\Projectname A\04 Picture" in version 0-M
.>

相关内容