From 1a4e868d5d2310c7095fdbf374723553c4fc088c Mon Sep 17 00:00:00 2001 From: "Marei (peiTeX)" Date: Tue, 9 Mar 2021 20:14:08 +0100 Subject: [PATCH 1/2] add hyperxmp option --- doclicense/doclicense.dtx | 58 +++++++++++++++++++++++++++------------ doclicense/doclicense.sty | 25 ++++++++++++----- 2 files changed, 59 insertions(+), 24 deletions(-) diff --git a/doclicense/doclicense.dtx b/doclicense/doclicense.dtx index 7afb149..f2291ea 100644 --- a/doclicense/doclicense.dtx +++ b/doclicense/doclicense.dtx @@ -138,6 +138,7 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed % \changes{2.1.0}{2020/07/26}{Fix regression: Proper language default image variants (Euro variants for example) was broken and the US variant was always used. This bug was introduced in v2.0.0. Documentation fixes. Added Marathi translation.} % \changes{2.2.0}{2020/09/18}{Add Japanese and Bulgarian translation. Add hint how to use Chinese to docs. Load hyperxmp by default when it is installed. Before, doclicense just suggested to load it and made use of the package when the user did.} % \changes{2.2.1}{2020/09/25}{Fix compatibility issue with newer versions of hyperxmp (bug confirmed with Tex Live 2020) resulting in an compile error by loading hyperxmp and hyperref in the order the packages expect it.} +% \changes{2.2.2}{2021/03/xx}{Add option to disable the use of of hyperxmp + add compatibilty for pdfx.} % % @@ -193,16 +194,22 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed % % This will explicitly set the license to \doclicenseNameRef. % -% If the \PrintPackage{hyperxmp} package is installed, it will be loaded and the options -% \PrintOptionF{pdflicenseurl} and \PrintOptionF{pdfcopyright} will be set -% by \PackageName{} to the corresponding values -% (\enquote{\url{\doclicenseURL}} and \enquote{\doclicenseLongText{}}). -% This embeds license metadata into the PDF which proper PDF readers can show. -% For example Evince shows it in the \enquote{Document License} tab under -% \enquote{Properties}. You may check this manual for how your PDF reader -% handles such metadata. -% If the package is not installed, a warning will be emitted to allow you to -% install the package as needed. +% With the default settings and if the \PrintPackage{hyperxmp} package is +% installed, it will be loaded and the options \PrintOptionF{pdflicenseurl} +% and \PrintOptionF{pdfcopyright} will be set by \PackageName{} to the +% corresponding values (\enquote{\url{\doclicenseURL}} and +% \enquote{\doclicenseLongText{}}). This embeds license metadata into the PDF +% which proper PDF readers can show. For example Evince shows it in the +% \enquote{Document License} tab under \enquote{Properties}. You may check +% this manual for how your PDF reader handles such metadata. +% +% In case you are using other package to manipulate the metadata which is +% incompatible to the use of hyperxmp, e.\,g. \PrintPackage{pdfx} you can use +% the \PrintOptionF{hyperxmp=false} to disable this automatism. If +% \PrintPackage{pdfx} is loaded before \PrintPackage{doclicense} or if +% \PrintPackage{hyperxmp} is not installed this automatism is disabled. +% In these cases a warning is emitted to inform you about the reasons. +% The warning will not show up if \PrintOptionF{hyperxmp} is set to false. % % \section{Package options} % @@ -328,6 +335,12 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed % |]{doclicense}| % \end{quote} % +% This option allows to disable the automatic loading of \PrintPackage{hyperxmp} +% \DescribePara{hyperxmp} +% it's initialized to true. This might also be used to suppress the warning if +% \PrintPackage{hyperxmp} is not available or \PrintPackage{pdfx} was loaded before +% \PrintPackage{doclicense}. +% % \section{Macros} % \DescribeMacro{\doclicenseType} % Expands to the type as set in the package options. Example: \enquote{\doclicenseType{}} @@ -556,6 +569,7 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed \DeclareStringOption[10em]{imagewidth} \DeclareStringOption[2em]{imagedistance} \DeclareStringOption{hyphenation} +\DeclareBoolOption[true]{hyperxmp} %% ))) % \end{macrocode} @@ -630,14 +644,24 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed } }{} } -\IfFileExists{hyperxmp.sty}{ - \@ifpackageloaded{hyperxmp}{}{\RequirePackage{hyperxmp}} -}{ - \PackageWarning{doclicense}{% - The hyperxmp package is missing so no license metadata can be embedded - into the PDF. Consider installing hyperxmp.% chktex 13 +\ifdoclicense@hyperxmp + \@ifpackageloaded{pdfx}{% + \PackageWarning{doclicense}{% + The pdfx package was detected. Therefore my mechanism to add license + metadata won't work. Ensure to setup \string\Copyright\space and + corresponding settingsto your xmpdata-File. + } + }{ + \IfFileExists{hyperxmp.sty}{ + \@ifpackageloaded{hyperxmp}{}{\RequirePackage{hyperxmp}} + }{ + \PackageWarning{doclicense}{% + The hyperxmp package is missing so no license metadata can be embedded + into the PDF. Consider installing hyperxmp.% chktex 13 + } + } } -} +\fi %% ))) % \end{macrocode} diff --git a/doclicense/doclicense.sty b/doclicense/doclicense.sty index c13b967..901d51d 100644 --- a/doclicense/doclicense.sty +++ b/doclicense/doclicense.sty @@ -16,6 +16,7 @@ \DeclareStringOption[10em]{imagewidth} \DeclareStringOption[2em]{imagedistance} \DeclareStringOption{hyphenation} +\DeclareBoolOption[true]{hyperxmp} %% ))) \ProcessLocalKeyvalOptions* @@ -82,14 +83,24 @@ } }{} } -\IfFileExists{hyperxmp.sty}{ - \@ifpackageloaded{hyperxmp}{}{\RequirePackage{hyperxmp}} -}{ - \PackageWarning{doclicense}{% - The hyperxmp package is missing so no license metadata can be embedded - into the PDF. Consider installing hyperxmp.% chktex 13 - } +\ifdoclicense@hyperxmp + \@ifpackageloaded{pdfx}{% + \PackageWarning{doclicense}{% +The pdfx package was detected. Therefore my mechanism to add license +metadata won't work. Ensure to setup \string\Copyright\space and +corresponding settingsto your xmpdata-File. } + }{ + \IfFileExists{hyperxmp.sty}{ + \@ifpackageloaded{hyperxmp}{}{\RequirePackage{hyperxmp}} + }{ + \PackageWarning{doclicense}{% + The hyperxmp package is missing so no license metadata can be embedded + into the PDF. Consider installing hyperxmp.% chktex 13 + } + } + } +\fi %% ))) %% Deprecation handling ((( From 9d84d31b8a57a39370dd99bc65b84f7655d1586a Mon Sep 17 00:00:00 2001 From: Robin Schneider Date: Tue, 9 Mar 2021 21:04:19 +0100 Subject: [PATCH 2/2] Improve spelling --- doclicense/doclicense.dtx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doclicense/doclicense.dtx b/doclicense/doclicense.dtx index f2291ea..4ad54da 100644 --- a/doclicense/doclicense.dtx +++ b/doclicense/doclicense.dtx @@ -138,7 +138,7 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed % \changes{2.1.0}{2020/07/26}{Fix regression: Proper language default image variants (Euro variants for example) was broken and the US variant was always used. This bug was introduced in v2.0.0. Documentation fixes. Added Marathi translation.} % \changes{2.2.0}{2020/09/18}{Add Japanese and Bulgarian translation. Add hint how to use Chinese to docs. Load hyperxmp by default when it is installed. Before, doclicense just suggested to load it and made use of the package when the user did.} % \changes{2.2.1}{2020/09/25}{Fix compatibility issue with newer versions of hyperxmp (bug confirmed with Tex Live 2020) resulting in an compile error by loading hyperxmp and hyperref in the order the packages expect it.} -% \changes{2.2.2}{2021/03/xx}{Add option to disable the use of of hyperxmp + add compatibilty for pdfx.} +% \changes{2.2.2}{2021/03/xx}{Add option to disable the use of hyperxmp and add compatibilty for pdfx.} % % @@ -335,9 +335,9 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed % |]{doclicense}| % \end{quote} % -% This option allows to disable the automatic loading of \PrintPackage{hyperxmp} +% This option allows to disable the automatic loading of \PrintPackage{hyperxmp}. % \DescribePara{hyperxmp} -% it's initialized to true. This might also be used to suppress the warning if +% It's initialized to true. This might also be used to suppress the warning if % \PrintPackage{hyperxmp} is not available or \PrintPackage{pdfx} was loaded before % \PrintPackage{doclicense}. % @@ -647,10 +647,10 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed \ifdoclicense@hyperxmp \@ifpackageloaded{pdfx}{% \PackageWarning{doclicense}{% - The pdfx package was detected. Therefore my mechanism to add license - metadata won't work. Ensure to setup \string\Copyright\space and - corresponding settingsto your xmpdata-File. - } + The pdfx package was detected. Therefore the mechanism to add license + metadata won't work. Ensure to setup \string\Copyright\space and + corresponding settings to your xmpdata-file. + } }{ \IfFileExists{hyperxmp.sty}{ \@ifpackageloaded{hyperxmp}{}{\RequirePackage{hyperxmp}}