summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/doclicense
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-05-28 21:57:48 +0000
committerKarl Berry <karl@freefriends.org>2020-05-28 21:57:48 +0000
commit67fd1c9167e900c706ca88c2cca1541cde8940f9 (patch)
treeeb5e750293501e5c74d28367463e96a62c2d64a6 /Master/texmf-dist/source/latex/doclicense
parent62000f907f3cbdc7e91cf5ce275d4d588e40b04b (diff)
doclicense (28may20)
git-svn-id: svn://tug.org/texlive/trunk@55318 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/doclicense')
-rw-r--r--Master/texmf-dist/source/latex/doclicense/doclicense.dtx226
1 files changed, 146 insertions, 80 deletions
diff --git a/Master/texmf-dist/source/latex/doclicense/doclicense.dtx b/Master/texmf-dist/source/latex/doclicense/doclicense.dtx
index 3d262e9942f..2713f14acf0 100644
--- a/Master/texmf-dist/source/latex/doclicense/doclicense.dtx
+++ b/Master/texmf-dist/source/latex/doclicense/doclicense.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2015-2019 by Robin Schneider <ypid@riseup.net>
+% Copyright (C) 2015-2020 by 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
@@ -27,7 +27,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1998/12/01]
%<package>\ProvidesPackage{doclicense}
%<*package>
- [2020/04/12 v1.10.1 Support for putting documents under a license]
+ [2020/05/27 v2.0.0 Support for putting documents under a license]
%</package>
%
%<*driver>
@@ -40,7 +40,7 @@
\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 documentation.
+%% ^^A explaining any parameter when they first come up in the manual.
\newcommand{\DescribePara}[1]{\marginpar{\raggedleft\strut\MacroFont\string#1}}
\usepackage[
hyphens,
@@ -60,6 +60,10 @@
%% ^^A https://tex.stackexchange.com/a/95893/32320
\setlength\IndexMin{100pt}
\usepackage[
+ type={CC},
+ modifier={by-sa},
+ version={4.0},
+ % imagemodifier={-80x15},% chktex 29
hyphenation={RaggedRight},
]{doclicense}
\GetFileInfo{doclicense.dtx}
@@ -129,6 +133,9 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \filedate.}}
% \changes{1.9.0}{2019/04/07}{Added Catalan, Galician, Chinese and Portuguese translation. Detect and give hint when enquote macro is already defined. Fix LaTeX Error: Too deeply nested.}
% \changes{1.10.0}{2019/06/05}{Added Brazilian translation. Update Chinese and Portuguese translation. Do not use enumitem for list label customization (beamer compatibility).}
% \changes{1.10.1}{2020/04/12}{Fix image for CC-BY-NC EU. Fix URL for CC-PDDC. Improve wording for catalan language.}
+% \changes{2.0.0}{2020/05/27}{Add 80x15 version of CC images which can be used with the imagemodifier option. Fix slight color offset for all CC images caused by bad image conversion. Thanks to rodrigoalcarazdelaosa for reporting. Fix \cmd{\doclicenseThis} support for twocolumn layouts. Thanks to Nao Pross. Soft require package options "type", "modifier" and "version" now. Defaults are deprecated. This will become a package error in an upcoming major version of the package, with the earliest release in 2021-07 to give people time to migrate. Remove Creative Commons PD which has been replaced by CC-zero as of 2010-10-11. Update example license used for examples in manual to CC-BY-SA-4.0.}
+%
+
%
%% ^^A nag warned about the center environment and it really messes up spacing.
%
@@ -158,25 +165,13 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \filedate.}}
% \tableofcontents
%
% \section{Introduction}
-% The \PrintPackage{doclicense} package allows you to put your document under a
+% The \PackageName{} package allows you to put your document under a
% license and include a link to read about the license or include an icon or
% image of the license. Currently, only \doclicenseLongType is supported but this
% package is designed to handle all kinds of licenses. See \nameref{sec:contributing}.
%
% \section{Usage}
-% Just load the package(s) placing
-% \begin{quote}
-% |\usepackage{| \\
-% |% babel,| \\
-% |% hyperref,| \\
-% |% hyperxmp,| \\
-% | doclicense,| \\
-% |}|
-% \end{quote}
-% in the preamble of your \LaTeXe{} source file. This will select the default
-% license which is \doclicenseNameRef, currently. Please always set your
-% license explicitly as package options like so:
-%
+% Just load the package
% \begin{quote}
% |\usepackage{| \\
% |% babel,| \\
@@ -186,15 +181,17 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \filedate.}}
% |\usepackage[| \\
% | type={CC},| \\
% | modifier={by-sa},| \\
-% | version={3.0},| \\
+% | version={4.0},| \\
% |]{doclicense}|
% \end{quote}
+% in the preamble of your \LaTeXe{} source file and change the package options
+% to the license you want to put the document under.
%
% This will explicitly set the license to \doclicenseNameRef.
%
% If the \PrintPackage{hyperxmp} package is loaded, then the options
% \PrintOptionF{pdflicenseurl} and \PrintOptionF{pdfcopyright} will be set
-% by \PrintPackage{doclicense} to the corresponding values
+% by \PackageName{} to the corresponding values
% (\enquote{\url{\doclicenseURL}} and \enquote{\doclicenseLongText{}}).
%
% \section{Package options}
@@ -250,20 +247,24 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \filedate.}}
% Select different variations of license images.
% \DescribePara{imagemodifier}
-% For example, Creative Commons provides sometimes more than one image for one version.
+% For example, Creative Commons provides more than one image for one version.
% See the \href{https://creativecommons.org/about/downloads}{download page}.
% You will note that there are by-nc.eu and by-nc which only differ in the money unit.
-% By default the by-nc image would be used but you can change this with:
+% Based on the loaded language, the money unit is set to a suitable default. You can change this with:
% \begin{quote}
% |\usepackage[| \\
% | imagemodifier={-eu},| \\
% |]{doclicense}|
% \end{quote}
%
-% Note that if French or German is set as language then \enquote{-eu} will be used as
-% default for this option.
+% Also, there is 80x15 which uses letters instead of icons for the modifiers in the image.
+% \begin{quote}
+% |\usepackage[| \\
+% | imagemodifier={-80x15},| \\
+% |]{doclicense}|
+% \end{quote}
%
-% Currently supported are \enquote{-eu} and \enquote{-us}.
+% If this is not given, we default to 88x31.
%
% This option allows you to specify
% \DescribePara{hyphenation}
@@ -282,9 +283,9 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \filedate.}}
% usually one or two full line and one half full line so avoiding hyphenations
% might look better compared to justified text.
%
-% \enquote{RaggedRight} is also the setting used for this documentation.
+% \enquote{RaggedRight} is also the setting used for this manual.
% \cmd{\doclicenseThis} did not produce a hyphenation in case of this
-% documentation but \TeX{} did fill up the first text line to it’s full width
+% manual but \TeX{} did fill up the first text line to it’s full width
% by adding additional space between words. This has been be avoided by setting
% the following option for this document:
%
@@ -414,6 +415,14 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \filedate.}}
%
% \doclicenseThis
%
+% And here is how it looks with the imagemodifier option set to \enquote{-80x15}:
+%
+% \makeatletter
+% \renewcommand{\doclicense@imagemodifier}{-80x15}
+% \doclicenseThis
+% \renewcommand{\doclicense@imagemodifier}{-88x31}
+% \makeatother
+%
% \section{Supported licenses}
% \label{sec:supported-licenses}
%
@@ -426,21 +435,43 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \filedate.}}
% \subsection{CC (Creative Commons)}
%
% \makeatletter
+% ^^A Reverse sorted.
+% \begin{eqlist}
+% \item[CC0-1.0] \@nameuse{doclicense@lang@lic@CC@zero@1.0}
+% \item[CC-BY-4.0] \@nameuse{doclicense@lang@lic@CC@by@4.0}
+% \item[CC-BY-3.0] \@nameuse{doclicense@lang@lic@CC@by@3.0}
+% \item[CC-BY-SA-4.0] \@nameuse{doclicense@lang@lic@CC@by-sa@4.0}
+% \item[CC-BY-SA-3.0] \@nameuse{doclicense@lang@lic@CC@by-sa@3.0}
+% \item[CC-BY-ND-4.0] \@nameuse{doclicense@lang@lic@CC@by-nd@4.0}
+% \item[CC-BY-ND-3.0] \@nameuse{doclicense@lang@lic@CC@by-nd@3.0}
+% \item[CC-BY-NC-4.0] \@nameuse{doclicense@lang@lic@CC@by-nc@4.0}
+% \item[CC-BY-NC-3.0] \@nameuse{doclicense@lang@lic@CC@by-nc@3.0}
+% \item[CC-BY-NC-SA-4.0] \@nameuse{doclicense@lang@lic@CC@by-nc-sa@4.0}
+% \item[CC-BY-NC-SA-3.0] \@nameuse{doclicense@lang@lic@CC@by-nc-sa@3.0}
+% \item[CC-BY-NC-ND-4.0] \@nameuse{doclicense@lang@lic@CC@by-nc-nd@4.0}
+% \item[CC-BY-NC-ND-3.0] \@nameuse{doclicense@lang@lic@CC@by-nc-nd@3.0}
+% \end{eqlist}
+% \makeatother
+%
+% \section{Retired licenses}
+%
+% Licenses get updated and sometimes fully replaced.
+% This section clarifies how \PackageName{} handles this.
+%
+% If there is consensus that the old license has no valid use case anymore and
+% it is possible and allowed for everyone compiling a document to update the
+% license, then the old license will be removed from \PackageName{} in the next
+% major version.
+%
+% Otherwise, \PackageName{} will keep supporting it to ensure that documents
+% using those licenses can still be compiled in the future.
+%
+% List of retired licenses:
+%
+% \makeatletter
+% ^^A Reverse sorted.
% \begin{eqlist}
-% \item[zero@1.0] \@nameuse{doclicense@lang@lic@CC@zero@1.0}
-% \item[pd@1.0] \@nameuse{doclicense@lang@lic@CC@pd@null}
-% \item[by@3.0] \@nameuse{doclicense@lang@lic@CC@by@3.0}
-% \item[by-sa@3.0] \@nameuse{doclicense@lang@lic@CC@by-sa@3.0}
-% \item[by-nd@3.0] \@nameuse{doclicense@lang@lic@CC@by-nd@3.0}
-% \item[by-nc@3.0] \@nameuse{doclicense@lang@lic@CC@by-nc@3.0}
-% \item[by-nc-sa@3.0] \@nameuse{doclicense@lang@lic@CC@by-nc-sa@3.0}
-% \item[by-nc-nd@3.0] \@nameuse{doclicense@lang@lic@CC@by-nc-nd@3.0}
-% \item[by@4.0] \@nameuse{doclicense@lang@lic@CC@by@4.0}
-% \item[by-sa@4.0] \@nameuse{doclicense@lang@lic@CC@by-sa@4.0}
-% \item[by-nd@4.0] \@nameuse{doclicense@lang@lic@CC@by-nd@4.0}
-% \item[by-nc@4.0] \@nameuse{doclicense@lang@lic@CC@by-nc@4.0}
-% \item[by-nc-sa@4.0] \@nameuse{doclicense@lang@lic@CC@by-nc-sa@4.0}
-% \item[by-nc-nd@4.0] \@nameuse{doclicense@lang@lic@CC@by-nc-nd@4.0}
+% \item[CC-PDDC] Copyright-Only Dedication
% \end{eqlist}
% \makeatother
%
@@ -488,11 +519,11 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \filedate.}}
% \begin{macrocode}
%% Parameters (((
\RequirePackage{kvoptions}
-\DeclareStringOption[CC]{type}
-\DeclareStringOption[by-sa]{modifier}
+\DeclareStringOption{type}
+\DeclareStringOption{modifier}
\DeclareStringOption{version}
\DeclareStringOption{lang}
-\DeclareStringOption{imagemodifier}
+\DeclareStringOption[-88x31]{imagemodifier}% chktex 29
\DeclareStringOption[right]{imageposition}
\DeclareStringOption[10em]{imagewidth}
\DeclareStringOption[2em]{imagedistance}
@@ -511,13 +542,13 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \filedate.}}
% \begin{macrocode}
%% Dependencies (((
\RequirePackage{xifthen}
+\RequirePackage{xstring}
\RequirePackage{etoolbox} %% \ifcsdef
\RequirePackage{xspace}
\RequirePackage{verbatim}
-%% )))
%% Custom enumerate list with adjusted labels
-%% that match the license text convetions
+%% that match the license text conventions
\newenvironment{doclicense@enumerate}{%
\begin{enumerate}
\renewcommand{\labelenumi}{(\alph{enumi})}%
@@ -574,6 +605,46 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \filedate.}}
%% )))
% \end{macrocode}
+% \subsection{Deprecation handling}
+% \begin{macrocode}
+%% Deprecation handling (((
+\ifthenelse{
+ \equal{\doclicense@type}{}
+}{
+ \PackageWarning{doclicense}{%
+ "type" package option missing. % chktex 18
+ This option is now required and the fallback to "CC" is deprecated. % chktex 18
+ In an upcoming major version of doclicense, this will be a package error.
+ Please explicitly pick a license of your choosing.
+ }
+ \renewcommand{\doclicense@type}{CC}
+}{}
+
+\ifthenelse{
+ \equal{\doclicense@modifier}{}
+}{
+ \PackageWarning{doclicense}{%
+ "modifier" package option missing. % chktex 18
+ This option is now required and the fallback to "by-sa" is deprecated. % chktex 18
+ In an upcoming major version of doclicense, this will be a package error.
+ Please explicitly pick a license of your choosing.
+ }
+ \renewcommand{\doclicense@modifier}{by-sa}
+}{}
+
+\ifthenelse{
+ \equal{\doclicense@version}{}
+}{
+ \PackageWarning{doclicense}{%
+ "version" package option missing. % chktex 18
+ This option is now required and the fallback is deprecated. % chktex 18
+ In an upcoming major version of doclicense, this will be a package error.
+ Please explicitly pick a license of your choosing.
+ }
+}{}
+%% )))
+
+% \end{macrocode}
% \subsection{Declare variables and macros}
% \begin{macrocode}
%% Declare variables (((
@@ -588,7 +659,7 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \filedate.}}
}
\newcommand{\doclicense@icon}{%
\PackageError{doclicense}{Icon not defined}
- {Please check the documentation of doclicense to see what you can do about it.}%
+ {Please check the manual of doclicense to see what you can do about it.}%
}
\newcommand{\doclicense@modifier@uppercase}{\texorpdfstring{%
\MakeUppercase{\doclicense@modifier}%
@@ -645,11 +716,11 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \filedate.}}
}
\newcommand{\doclicenseFullTextFileName}{%
doclicense-\doclicense@type-\doclicense@modifier-\doclicense@versionUsed-latex}
-\newcommand{\doclicenseFullText}{\input{\doclicenseFullTextFileName}}
+\newcommand{\doclicenseFullText}{\input{\doclicenseFullTextFileName}}% chktex 27
\newcommand{\doclicenseLicense}{\doclicenseThis} %% legacy support
\newcommand{\doclicenseThis}{%
- \setlength{\doclicense@hsize}{\textwidth-\doclicense@imagewidth-\doclicense@imagedistance}%
+ \setlength{\doclicense@hsize}{\linewidth-\doclicense@imagewidth-\doclicense@imagedistance}%
\ifthenelse{\equal{\doclicense@imageposition}{left}}{%
\begin{center}
\begin{minipage}{\doclicense@imagewidth}
@@ -697,13 +768,14 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \filedate.}}
\ifthenelse{\equal{\doclicense@lang}{}}{%
\renewcommand{\doclicense@lang}{\languagename}}{}
\IfFileExists{doclicense-\doclicense@lang.ldf}{%
- \input{doclicense-\doclicense@lang.ldf}
+ \input{doclicense-\doclicense@lang.ldf}% chktex 27
}{%
\PackageWarning{doclicense}{%
No language definition for \doclicense@lang found.
- Please add one and submit a patch. Using English as fallback.}
+ Please add one and submit a patch. Using English as fallback.
+ }
\renewcommand{\doclicense@lang}{english}
- \input{doclicense-\doclicense@lang.ldf}
+ \input{doclicense-\doclicense@lang.ldf}% chktex 27
}
\ifthenelse{\equal{\doclicense@imagemodifier}{-us}}{%
\@namedef{doclicense@imagemodifier}{}
@@ -751,46 +823,39 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \filedate.}}
}
\ifthenelse{\equal{\doclicense@modifier}{by}}{%
\renewcommand{\doclicense@icon}{\ccby}
- \renewcommand{\doclicense@imagemodifier}{}
}{}
\ifthenelse{\equal{\doclicense@modifier}{by-sa}}{%
\renewcommand{\doclicense@icon}{\ccbysa}
- \renewcommand{\doclicense@imagemodifier}{}
}{}
\ifthenelse{\equal{\doclicense@modifier}{by-nd}}{%
\renewcommand{\doclicense@icon}{\ccbynd}
- \renewcommand{\doclicense@imagemodifier}{}
}{}
\ifthenelse{\equal{\doclicense@modifier}{by-nc}}{%
\renewcommand{\doclicense@icon}{\ccbync}
- \ifthenelse{\equal{\doclicense@imagemodifier}{-eu}}{%
+ \IfBeginWith{\doclicense@imagemodifier}{-eu}{%
\renewcommand{\doclicense@icon}{\ccbynceu}
}{}
- \ifthenelse{\equal{\doclicense@imagemodifier}{-jp}}{%
+ \IfBeginWith{\doclicense@imagemodifier}{-jp}{%
\renewcommand{\doclicense@icon}{\ccbyncjp}
}{}
}{}
\ifthenelse{\equal{\doclicense@modifier}{by-nc-sa}}{
\renewcommand{\doclicense@icon}{\ccbyncsa}
- \ifthenelse{\equal{\doclicense@imagemodifier}{-eu}}{%
+ \IfBeginWith{\doclicense@imagemodifier}{-eu}{%
\renewcommand{\doclicense@icon}{\ccbyncsaeu}
}{}
- \ifthenelse{\equal{\doclicense@imagemodifier}{-jp}}{%
+ \IfBeginWith{\doclicense@imagemodifier}{-jp}{%
\renewcommand{\doclicense@icon}{\ccbyncsajp}
}{}
}{}
\ifthenelse{\equal{\doclicense@modifier}{by-nc-nd}}{
\renewcommand{\doclicense@icon}{\ccbyncnd}
- \ifthenelse{\equal{\doclicense@imagemodifier}{-eu}}{%
- \renewcommand{\doclicense@icon}{\ccbyncndeu}
- }{}
- \ifthenelse{\equal{\doclicense@imagemodifier}{-jp}}{%
+ \IfBeginWith{\doclicense@imagemodifier}{-jp}{%
\renewcommand{\doclicense@icon}{\ccbyncndjp}
}{}
}{}
\ifthenelse{\equal{\doclicense@modifier}{zero}}{%
\renewcommand{\doclicense@icon}{\cczero}
- \renewcommand{\doclicense@imagemodifier}{}
\doclicense@setVersion[1.0]
\edef\doclicenseURL{%
\doclicense@baseUrlCC/%
@@ -799,33 +864,34 @@ corresponds to \PackageName\nobreakspace\fileversion, dated \filedate.}}
\doclicense@versionUsed\doclicense@UrlLangPart}
}{}
\ifthenelse{\equal{\doclicense@modifier}{pd}}{
- \renewcommand{\doclicense@icon}{\ccpd}
- \renewcommand{\doclicense@imagemodifier}{}
- \doclicense@setVersion[null]
- \edef\doclicenseURL{%
- \doclicense@baseUrlCC/%
- licenses/publicdomain%
- \doclicense@UrlLangPart}
+ \PackageError{doclicense}{CC PD license removed as of version 2.0.0}{
+ Creative Commons PD has been replaced by CC-zero.
+ Please update your license choice.
+ }%
}{}
+ \IfSubStr{\doclicense@modifier}{nc}{}{
+ %% eu (Euro) does only exist for nc (non commercial) so if not nc then reset -eu.
+ \ifthenelse{\equal{\doclicense@imagemodifier}{-eu}}{%
+ \renewcommand{\doclicense@imagemodifier}{}
+ }{}
+ }
\ifcsdef{doclicense@lang@lic@\doclicense@type%
@\doclicense@modifier @\doclicense@versionUsed}{}{%
- \PackageError{doclicense}{License long name not defined}%
- {%
- Please check the documentation of doclicense
- to see what you can do about it.%
- }%
+ \PackageError{doclicense}{License long name not defined}{%
+ Please check the manual of doclicense
+ to see what you can do about it.%
+ }%
}
\setboolean{doclicense@licenseKnown}{true}
}{}%% )))
\ifthenelse{\not\boolean{doclicense@licenseKnown}}{%
- \PackageError{doclicense}{License unknown}%
- {%
- Please check the documentation of doclicense
- to see what you can do about it.%
- }%
+ \PackageError{doclicense}{License unknown}{%
+ Please check the manual of doclicense
+ to see what you can do about it.%
+ }%
}{}%
}
%% )))