From 70c8a5bc7e02060cdcc968932976d1fb4fc0e699 Mon Sep 17 00:00:00 2001 From: Joseph Wright Date: Sat, 28 Dec 2024 09:07:57 +0000 Subject: [PATCH] Add \version support to code part of sources (fixes #764) --- siunitx-code.tex | 4 ++++ siunitx.dtx | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/siunitx-code.tex b/siunitx-code.tex index f392a617..9560c80a 100644 --- a/siunitx-code.tex +++ b/siunitx-code.tex @@ -49,6 +49,10 @@ \ExplSyntaxOff \NewDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}} \NewDocumentCommand\foreign{m}{\textit{#1}} +\NewDocumentCommand\version{m}{\ensuremath{#1}} +\ExpandArgs{c}\NewDocumentCommand{version (pdfstring context)}{m}{#1} +\pdfstringdefDisableCommands{% + \ExpandArgs{Nc}\DeclareCommandCopy\version{version (pdfstring context)}} % Standard settings \EnableDocumentation diff --git a/siunitx.dtx b/siunitx.dtx index 566d5190..e0c6fb45 100644 --- a/siunitx.dtx +++ b/siunitx.dtx @@ -28,6 +28,10 @@ \documentclass{l3doc} % Additional commands needed in this source \ProvideDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}} +\ProvideDocumentCommand\version{m}{\ensuremath{#1}} +\ExpandArgs{c}\ProvideDocumentCommand{version (pdfstring context)}{m}{#1} +\pdfstringdefDisableCommands{% + \ExpandArgs{Nc}\DeclareCommandCopy\version{version (pdfstring context)}} % The next line is needed so that \GetFileInfo will be able to pick up % version data \usepackage{siunitx}