summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/doclicense/doclicense.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/doclicense/doclicense.dtx')
-rw-r--r--macros/latex/contrib/doclicense/doclicense.dtx185
1 files changed, 103 insertions, 82 deletions
diff --git a/macros/latex/contrib/doclicense/doclicense.dtx b/macros/latex/contrib/doclicense/doclicense.dtx
index 75e34f64a8..5932dabaa4 100644
--- a/macros/latex/contrib/doclicense/doclicense.dtx
+++ b/macros/latex/contrib/doclicense/doclicense.dtx
@@ -1,21 +1,11 @@
% \iffalse meta-comment
%
-% Copyright (C) 2015-2020 by Robin Schneider <ypid@riseup.net>
+% SPDX-FileCopyrightText: 2015-2021 Robin Schneider <ypid@riseup.net>
%
-% This work may be distributed and/or modified under the
-% conditions of the LaTeX Project Public License, either version 1.3
-% of this license or (at your option) any later version.
-% The latest version of this license is in
-% http://www.latex-project.org/lppl.txt
-% and version 1.3 or later is part of all distributions of LaTeX
-% version 2005/12/01 or later.
+% SPDX-License-Identifier: LPPL-1.3c
%
-% This work has the LPPL maintenance status `maintained'.
-%
-% The Current Maintainer of this work is Robin Schneider.
-%
-% This work consists of the files doclicense.dtx and doclicense.ins
-% and the derived files doclicense.sty and doclicense.pdf.
+% This work consists of all files listed in manifest.txt.
+% For more details about the licensing, refer to the README.md file.
%
% \fi
%
@@ -23,11 +13,18 @@
%<*driver>
\ProvidesFile{doclicense.dtx}
%</driver>
-%<package>%% See file 'doclicense.dtx' for copyright and license.
+%<package>% SPDX-FileCopyrightText: 2015-2021 Robin Schneider <ypid@riseup.net>
+%<package>%
+%<package>% SPDX-License-Identifier: LPPL-1.3c
+%<package>%
+%<package>% This work consists of all files listed in manifest.txt.
+%<package>% For more details about the licensing, refer to the README.md file.
+%<package>% If you don't have those files, you can find them at: https://ctan.org/pkg/doclicense
+%<package>
%<package>\NeedsTeXFormat{LaTeX2e}[1998/12/01]
%<package>\ProvidesPackage{doclicense}
%<*package>
- [2020/09/25 v2.2.1 Support for putting documents under a license]
+ [2021/03/13 v2.3.0 Support for putting documents under a license]
%</package>
%
%<*driver>
@@ -39,8 +36,8 @@
\newcommand{\PackageAuthorEmail}{ypid@riseup.net}
\newcommand{\PackageName}{\PrintPackage{doclicense}}
\newcommand{\PrintPackage}[1]{\textsf{#1}}
-\newcommand{\PrintOptionF}[1]{\emph{#1}} %% ^^A This macro is used for
-%% ^^A explaining any parameter when they first come up in the manual.
+\newcommand{\PrintOptionF}[1]{\emph{#1}} % ^^A This macro is used for
+% ^^A explaining any parameter when they first come up in the manual.
\newcommand{\DescribePara}[1]{\marginpar{\raggedleft\strut\MacroFont\string#1}}
\usepackage[
hyphens,
@@ -56,7 +53,7 @@
eqlist,
}
\usepackage[iso]{isodate}
-%% ^^A https://tex.stackexchange.com/a/95893/32320
+% ^^A https://tex.stackexchange.com/a/95893/32320
\setlength\IndexMin{100pt}
\usepackage[
type={CC},
@@ -138,11 +135,12 @@ 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.3.0}{2021/03/13}{Add option to disable the use of hyperxmp and add compatibility for pdfx. Use \url{https://reuse.software/} for the doclicense source code itself.}
%
%
%
-%% ^^A nag warned about the center environment and it really messes up spacing.
+% ^^A nag warned about the center environment and it really messes up spacing.
%
% \DoNotIndex{\RequirePackage, \DeclareOption, \ProcessOptions}
% \DoNotIndex{\PackageWarning, \MessageBreak}
@@ -193,16 +191,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}
%
@@ -227,23 +231,23 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed
%
% Supported languages:
% ^^A Sorted alphabetically.
-% \begin{eqlist}
-% \item[Brazilian] Added by \href{https://github.com/iagows}{Iago}.
-% \item[Bulgarian] Added by \href{https://github.com/hristo-d-hristov}{hristo-d-hristov}.
-% \item[Catalan] Added by \href{https://github.com/elancha98}{Ernesto Lanchares}.
-% \item[Chinese] Added by \href{https://github.com/sd44}{sd44}. Note that you might need to pass \verb+lang={chinese-utf8}+ or \verb+chinese-gbk+.
-% \item[English] Added by \href{https://me.ypid.de/}{Robin Schneider}.
-% \item[French] Added by \href{https://github.com/ericguirbal}{\'Eric Guirbal}.
-% \item[Galician] Submitted by Email.
-% \item[German] Added by \href{https://me.ypid.de/}{Robin Schneider}.
-% \item[Italian] Added by \href{https://github.com/rig8f}{Filippo Rigotto}.
-% \item[Japanese] Added by \href{https://github.com/cmplstofB}{cmplstofB}.
-% \item[Marathi] Added by \href{https://github.com/NiranjanTambe}{Niranjan}. Note that Niranjan also translated the images which are considered unofficial by the package. Creative Commons has no plans to support additional currencies.
-% \item[Polish] Added by \href{https://github.com/jsbien}{jsbien}.
-% \item[Portuguese] Added by \href{https://github.com/alexandre1985}{Daniel Alexandre Cerqueira Santos}.
-% \item[Russian] Added by \href{https://github.com/bergentroll}{Anton Karmanov}.
-% \item[Spanish] Added by \href{https://github.com/elsudano}{Carlos}. Updated by \href{https://github.com/IgnacioFDM}{IgnacioFDM}.
-% \end{eqlist}
+% \begin{itemize}
+% \item Brazilian
+% \item Bulgarian
+% \item Catalan
+% \item Chinese: Note that you might need to pass \verb+lang={chinese-utf8}+ or \verb+chinese-gbk+.
+% \item English
+% \item French
+% \item Galician
+% \item German
+% \item Italian
+% \item Japanese
+% \item Marathi: Note that Niranjan also translated the images which are considered unofficial by the package. Creative Commons has no plans to support additional currencies.
+% \item Polish
+% \item Portuguese
+% \item Russian
+% \item Spanish
+% \end{itemize}
%
% Image position for \cmd{\doclicenseThis}: right (default) or left.
% \DescribePara{imageposition}
@@ -328,6 +332,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{}}
@@ -545,7 +555,7 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed
% \fi
% \subsection{Declaring the options}
% \begin{macrocode}
-%% Parameters (((
+% Parameters (((
\RequirePackage{kvoptions}
\DeclareStringOption{type}
\DeclareStringOption{modifier}
@@ -556,7 +566,8 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed
\DeclareStringOption[10em]{imagewidth}
\DeclareStringOption[2em]{imagedistance}
\DeclareStringOption{hyphenation}
-%% )))
+\DeclareBoolOption[true]{hyperxmp}
+% )))
% \end{macrocode}
% To test if all parameters are valid the macro |\ProcessLocalKeyvalOptions*|
@@ -568,15 +579,15 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed
% \end{macrocode}
% \subsection{Dependencies}
% \begin{macrocode}
-%% Dependencies (((
+% Dependencies (((
\RequirePackage{xifthen}
\RequirePackage{xstring}
-\RequirePackage{etoolbox} %% \ifcsdef
+\RequirePackage{etoolbox} % \ifcsdef
\RequirePackage{xspace}
\RequirePackage{verbatim}
-%% Custom enumerate list with adjusted labels
-%% that match the license text conventions
+% Custom enumerate list with adjusted labels
+% that match the license text conventions
\newenvironment{doclicense@enumerate}{%
\begin{enumerate}
\renewcommand{\labelenumi}{(\alph{enumi})}%
@@ -597,10 +608,10 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed
}
\AtEndPreamble{%
\@ifpackageloaded{csquotes}{
- %% csquotes has already been loaded so we are fine.
+ % csquotes has already been loaded so we are fine.
}{
\ifcsdef{enquote}{
- %% \enquote is defined but not by csquotes.
+ % \enquote is defined but not by csquotes.
\@ifpackageloaded{biblatex}{
\PackageError{doclicense}{The enquote macro is defined by biblatex}
{This package assumes that the enquote macro is defined by the
@@ -618,32 +629,42 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed
}
}
\@ifpackageloaded{ccicons}{}{\RequirePackage{ccicons}}
- %% For \doclicenseIcon
+ % For \doclicenseIcon
\@ifpackageloaded{graphicx}{}{\RequirePackage{graphicx}}
- %% For \doclicenseImage
+ % For \doclicenseImage
\@ifpackageloaded{hyperref}{}{\RequirePackage{hyperref}}
\@ifpackageloaded{hyperxmp}{
- %% The following options are only defined when the hyperxmp package was loaded.
+ % The following options are only defined when the hyperxmp package was loaded.
\hypersetup{
pdfcopyright = {\doclicenseLongText},
pdflicenseurl = {\doclicenseURL},
}
}{}
}
-\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 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}}
+ }{
+ \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}
% \subsection{Deprecation handling}
% \begin{macrocode}
-%% Deprecation handling (((
+% Deprecation handling (((
\ifthenelse{
\equal{\doclicense@type}{}
}{
@@ -678,12 +699,12 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed
Please explicitly pick a license of your choosing.
}
}{}
-%% )))
+% )))
% \end{macrocode}
% \subsection{Declare variables and macros}
% \begin{macrocode}
-%% Declare variables (((
+% Declare variables (((
\@namedef{doclicense@lang@lic@CC}{Creative Commons}%
\newcommand{\doclicense@baseUrlCC}{https://creativecommons.org}
\newcommand{\doclicense@versionFallback}{}
@@ -703,12 +724,12 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed
}{%
\doclicense@modifier}%
}
-%% )))
+% )))
% \end{macrocode}
% \subsection{User macros}
% \begin{macrocode}
-%% User macros (((
+% User macros (((
\newcommand{\doclicenseType}{\doclicense@type\xspace}
\newcommand{\doclicenseLongType}{}
\newcommand{\doclicenseModifier}{\doclicense@modifier@uppercase\xspace}
@@ -733,7 +754,7 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed
}
\newcommand{\doclicenseIcon}{\doclicense@icon\xspace}
\newcommand{\doclicenseTypeIcon}{\doclicenseType}
-% \newcommand{\doclicenseModifierIcon}{} %% Not directly provided by ccicons.
+% \newcommand{\doclicenseModifierIcon}{} % Not directly provided by ccicons.
\newcommand{\doclicenseImageFileName}{%
doclicense-\doclicense@type-\doclicense@modifier\doclicense@imagemodifier}
\newcommand{\doclicenseImage}[1][]{%
@@ -755,7 +776,7 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed
doclicense-\doclicense@type-\doclicense@modifier-\doclicense@versionUsed-latex}
\newcommand{\doclicenseFullText}{\input{\doclicenseFullTextFileName}}% chktex 27
-\newcommand{\doclicenseLicense}{\doclicenseThis} %% legacy support
+\newcommand{\doclicenseLicense}{\doclicenseThis} % legacy support
\newcommand{\doclicenseThis}{%
\setlength{\doclicense@hsize}{\linewidth-\doclicense@imagewidth-\doclicense@imagedistance}%
\ifthenelse{\equal{\doclicense@imageposition}{left}}{%
@@ -793,7 +814,7 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed
% }
}
}
-%% )))
+% )))
% \end{macrocode}
% \subsection{Language selection}
@@ -801,7 +822,7 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed
% should be stored and changed there. Note that one could also redefine
% macros like \cmd{\doclicenseLongText} if necessary.
% \begin{macrocode}
-%% Language support (((
+% Language support (((
\ifthenelse{\equal{\doclicense@lang}{}}{%
\renewcommand{\doclicense@lang}{\languagename}}{}
\IfFileExists{doclicense-\doclicense@lang.ldf}{%
@@ -818,12 +839,12 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed
\@namedef{doclicense@imagemodifier}{-88x31}% chktex 29
}{}
-%% )))
+% )))
% \end{macrocode}
% \subsection{Internals}
% \begin{macrocode}
-%% Set license (((
+% Set license (((
\newcommand{\doclicense@setVersion}[1][]{%
\ifthenelse{\equal{#1}{}}{}{%
\renewcommand{\doclicense@versionFallback}{#1}
@@ -835,14 +856,14 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed
}
}
\newcommand{\doclicense@set}{%
- %% CC (((
+ % CC (((
\ifthenelse{\equal{\doclicense@type}{CC}}{%
\renewcommand{\doclicenseLongType}{\doclicense@lang@lic@CC\xspace}
\renewcommand{\doclicenseTypeIcon}{\ccLogo\xspace}
\doclicense@setVersion[3.0]
- %% Allow to predefine the following macros in ldf files.
+ % Allow to predefine the following macros in ldf files.
\ifcsdef{doclicense@UrlLangPart}{}{%
\ifthenelse{\equal{\doclicense@lang@lic@CC@code}{}}{%
\edef\doclicense@UrlLangPart{}
@@ -910,7 +931,7 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed
}%
}{}
\IfSubStr{\doclicense@modifier}{nc}{}{
- %% eu (Euro) does only exist for nc (non commercial) so if not nc then reset -eu.
+ % eu (Euro) does only exist for nc (non commercial) so if not nc then reset -eu.
\IfBeginWith{\doclicense@imagemodifier}{-eu}{%
\renewcommand{\doclicense@imagemodifier}{-88x31}% chktex 29
}{}
@@ -929,7 +950,7 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed
}
\setboolean{doclicense@licenseKnown}{true}
- }{}%% )))
+ }{}% )))
\ifthenelse{\not\boolean{doclicense@licenseKnown}}{%
\PackageError{doclicense}{License unknown}{%
Please check the manual of doclicense
@@ -937,7 +958,7 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \printdateTeX{\filed
}%
}{}%
}
-%% )))
+% )))
\doclicense@set%
% \end{macrocode}