summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/doclicense
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-02-07 23:06:57 +0000
committerKarl Berry <karl@freefriends.org>2015-02-07 23:06:57 +0000
commite403fce86352a3e5e4e88a69797f92d56d9092e5 (patch)
tree17ea799aced6e396b6e394f067b659c17a507757 /Master/texmf-dist/source/latex/doclicense
parent37dec022fdcd75249dbaba944c4e3105b7b31323 (diff)
doclicense (7feb15)
git-svn-id: svn://tug.org/texlive/trunk@36228 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/doclicense')
-rw-r--r--Master/texmf-dist/source/latex/doclicense/doclicense.dtx148
1 files changed, 100 insertions, 48 deletions
diff --git a/Master/texmf-dist/source/latex/doclicense/doclicense.dtx b/Master/texmf-dist/source/latex/doclicense/doclicense.dtx
index b65058b2678..b73701f25ec 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 by Robin Schneider <ypid23@aol.de>
+% Copyright (C) 2015 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,11 +27,12 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1998/12/01]
%<package>\ProvidesPackage{doclicense}
%<*package>
- [2015/02/06 v0.8 Set and print the license of a document]
+ [2015/02/07 v0.9 Set and print the license of a document]
%</package>
%
%<*driver>
\documentclass[english]{ltxdoc}
+\setlength{\parindent}{0pt}
\newcommand{\PackageURL}{https://github.com/ypid/latex-packages/tree/master/doclicense}
\newcommand{\PackageCTANURL}{https://www.ctan.org/pkg/doclicense}
\newcommand{\PackageAuthor}{Robin Schneider}
@@ -50,6 +51,7 @@
hypdoc,
nameref,
xspace,
+ eqlist,
}
\GetFileInfo{doclicense.dtx}
\hypersetup{
@@ -102,6 +104,8 @@ corresponds to \PackageName~\fileversion, dated \filedate.}}
%
% \changes{0.7}{2015/02/05}{Initial version}
% \changes{0.8}{2015/02/06}{Added support for CC-zero and CC-pd and small improvements}
+% \changes{0.9}{2015/02/07}{Added list of supported licenses to docu and added option imagemodifier.
+% Also renamed macro \cmd{\doclicenseLicense} to \cmd{\doclicenseThis}} %
%
% \DoNotIndex{\RequirePackage, \DeclareOption, \ProcessOptions}
% \DoNotIndex{\PackageWarning, \MessageBreak}
@@ -121,7 +125,7 @@ corresponds to \PackageName~\fileversion, dated \filedate.}}
% \phantomsection
% \addcontentsline{toc}{section}{\abstractname}
% \begin{abstract}
-% The \PackageName{} package can calculate the age in years. \\
+% Make it easy to set your documents under a certain license. \\
% Information site on CTAN: \url{\PackageCTANURL} \\
% Example on Stackexchange: \url{https://tex.stackexchange.com/a/226788/32320} \\
% Fork me on GitHub: \url{\PackageURL} \end{abstract}
@@ -129,8 +133,6 @@ corresponds to \PackageName~\fileversion, dated \filedate.}}
% \tableofcontents
%
% \section{Introduction}
-% Make it easy to set your documents under a certain license.
-%
% The \PrintPackage{doclicense} 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
@@ -159,10 +161,12 @@ corresponds to \PackageName~\fileversion, dated \filedate.}}
% The first parameter is \enquote{\PrintOptionF{type}}. \DescribePara{type}
% This sets the license type. Like in this example, the type can be
% \enquote{CC} to cover all the \doclicenseLongType licenses.
+% Please make sure that the type is all uppercase. See the \nameref{sec:supported-licenses} section for a complete list.
%
% The \DescribePara{modifier} next parameter is \enquote{\PrintOptionF{modifier}} which allows to
% select different subclasses of a license. In this
% example it is \enquote{by-sa}.
+% Please make sure that the type is all lowercase. See the \nameref{sec:supported-licenses} section for a complete list.
%
% As \DescribePara{version} there can be more than one version of a license, the version can also be set.
%
@@ -177,74 +181,108 @@ corresponds to \PackageName~\fileversion, dated \filedate.}}
% Default image width for the license image.
% \DescribePara{imagewidth}
%
+% This options was added to support variations in the license images.
+% \DescribePara{imagemodifier}
+% For example, Creative Commons provides sometimes more than one image for one version.
+% See the \href{https://creativecommons.org/about/downloads}{donwload 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:
+% \begin{quote}
+% |\usepackage[imagemodifier={-eu}]{romanbarpagenumber}|
+% \end{quote}
+%
+% Note that if German is set as language then \enquote{eu} will be used as
+% default for this option.
+%
% \section{Macros}
% \DescribeMacro{\doclicenseType}
-% Expands to the type as set in the package options. For this document this
-% macro expands to: \enquote{\doclicenseType{}}
+% Expands to the type as set in the package options. Example: \enquote{\doclicenseType{}}
%
% \DescribeMacro{\doclicenseLongType}
-% Same as \cmd{\doclicenseType} expect that it expands to the long license
-% type. For this document, it looks like this: \enquote{\doclicenseLongType{}}
+% Same as \cmd{\doclicenseType} except that it expands to the long license
+% type. Example: \enquote{\doclicenseLongType{}}
%
% \DescribeMacro{\doclicenseModifier}
-% Expands to the modifier as set in the package options. For this document this
-% macro expands to: \enquote{\doclicenseModifier{}}
+% Expands to the modifier as set in the package options. Example: \enquote{\doclicenseModifier{}}
%
% \DescribeMacro{\doclicenseVersion}
-% Expands to the version as set in the package options. For this document this
-% macro expands to: \enquote{\doclicenseVersion{}}
+% Expands to the version as set in the package options. Example: \enquote{\doclicenseVersion{}}
+%
+% \DescribeMacro{\doclicenseURL}
+% Expands to the official URL about the license. Note that it expands to the
+% raw URL string without the use of \cmd{\href} or similar. If you want the
+% link to be clickable then you can use \cmd{\href} or \cmd{\url} from the
+% \PrintPackage{hyperref} package or just read on because the following macros
+% can also do this for your. Example:
+% \enquote{\doclicenseURL{}}
%
% \DescribeMacro{\doclicenseName}
-% Expands to the short name of the license. For this document this macro
-% expands to: \enquote{\doclicenseName{}}
+% Expands to the short name of the license. Example: \enquote{\doclicenseName{}}
%
% \DescribeMacro{\doclicenseLongName}
-% Expands to the long name of the license. For this document this macro expands
-% to: \enquote{\doclicenseLongName{}}
+% Expands to the long name of the license. Example: \enquote{\doclicenseLongName{}}
%
% \DescribeMacro{\doclicenseNameRef}
-% Same as \cmd{\doclicenseName} expect that it links to the URL of the license.
-% For this document, it looks like this: \enquote{\doclicenseNameRef{}}
+% Same as \cmd{\doclicenseName} except that it links to the URL of the license.
+% Example: \enquote{\doclicenseNameRef{}}
%
% \DescribeMacro{\doclicenseLongNameRef}
-% Same as \cmd{\doclicenseLongName} expect that it links to the URL of the
-% license. For this document, it looks like this:
+% Same as \cmd{\doclicenseLongName} except that it links to the URL of the
+% license. Example:
% \enquote{\doclicenseLongNameRef{}}
%
-% \DescribeMacro{\doclicenseURL}
-% Expands to the official URL about the license. Note that it expands to the
-% raw URL string without the use of \cmd{\href} or similar. If you want the
-% link to be clickable then you can use \cmd{\href} or \cmd{\url} from the
-% \PrintPackage{hyperref} package. For this document the macro expands to:
-% \enquote{\doclicenseURL{}}
-%
% \DescribeMacro{\doclicenseText}
% Expands to a localized text which states that this document is licensed under
-% the license. For this document this macro expands to:
+% the license. Example:
% \enquote{\doclicenseText{}}
%
+% \DescribeMacro{\doclicenseLongText}
+% Same as \cmd{\doclicenseText} except that it uses the long name of the license.
+% Example: \enquote{\doclicenseLongText{}}
+%
% \DescribeMacro{\doclicenseIcon}
-% Expands to a icon of the license. For this document this macro expands to:
+% Expands to a icon of the license. Example:
% \enquote{\doclicenseIcon{}}. This macro is based on the
% \PrintPackage{ccicons} package.
%
% \DescribeMacro{\doclicenseImage}
% This is kind of similar with \cmd{\doclicenseIcon} but it will typeset an
-% bigger pictogram of the license. For this document this macro expands to:
+% bigger pictogram of the license. Example:
% \enquote{\doclicenseImage}
%
% Note that you can change the image size with the \oarg{imagewidth} parameter
% like this:
% \enquote{\doclicenseImage[imagewidth=2em]}
%
+% \begin{quote}
+% |\doclicenseImage[imagewidth=2em]|
+% \end{quote}
+%
% The images are bundled with the \PackageName package.
%
-% \DescribeMacro{\doclicenseLicense}
-% And last but not least there is the \cmd{\doclicenseLicense} macro which will
+% \DescribeMacro{\doclicenseThis}
+% And last but not least there is the \cmd{\doclicenseThis} macro which will
% typeset the \cmd{\doclicenseText} next to the \cmd{\doclicenseImage} in a
-% \enquote{minipage} environment. This will look like the following.
-%
-% \doclicenseLicense
+% \enquote{minipage} environment. This will look like the following:
+%
+% \doclicenseThis
+%
+% \section{Supported licenses}
+% \label{sec:supported-licenses}
+% \subsection{CC (Creative commons)}
+%
+% \makeatletter
+% \begin{eqlist}
+% \item[by@3.0] \csname doclicense@lang@lic@CC@by@3.0\endcsname
+% \item[by-sa@3.0] \csname doclicense@lang@lic@CC@by-sa@3.0\endcsname
+% \item[by-nd@3.0] \csname doclicense@lang@lic@CC@by-nd@3.0\endcsname
+% \item[by-nc@3.0] \csname doclicense@lang@lic@CC@by-nc@3.0\endcsname
+% \item[by-nc-sa@3.0] \csname doclicense@lang@lic@CC@by-nc-sa@3.0\endcsname
+% \item[by-nc-nc@3.0] \csname doclicense@lang@lic@CC@by-nc-nd@3.0\endcsname
+% \item[zero@1.0] \csname doclicense@lang@lic@CC@zero@1.0\endcsname
+% \item[pd@1.0] \csname doclicense@lang@lic@CC@pd@1.0\endcsname
+% \end{eqlist}
+% \makeatother
%
% \section{Contributing}
% \label{sec:contributing}
@@ -285,6 +323,7 @@ corresponds to \PackageName~\fileversion, dated \filedate.}}
\DeclareStringOption[by-sa]{modifier}
\DeclareStringOption{version}
\DeclareStringOption{lang}
+\DeclareStringOption{imagemodifier}
\DeclareStringOption[10em]{imagewidth}
%% }}}
@@ -304,7 +343,8 @@ corresponds to \PackageName~\fileversion, dated \filedate.}}
\newboolean{doclicense@licenseKnown}
\newlength{\doclicense@hsize}
\newcommand{\doclicense@longName}{%
- \csname doclicense@lang@lic@\doclicense@type @\doclicense@modifier @\doclicense@versionUsed\endcsname
+ \csname doclicense@lang@lic@\doclicense@type @\doclicense@modifier%
+ @\doclicense@versionUsed\endcsname
}
\newcommand{\doclicense@icon}{%
\PackageError{doclicense}{Icon not defined}
@@ -320,7 +360,8 @@ corresponds to \PackageName~\fileversion, dated \filedate.}}
\newcommand{\doclicenseLongType}{}
\newcommand{\doclicenseModifier}{\MakeUppercase{\doclicense@modifier}\xspace}
\newcommand{\doclicenseVersion}{\doclicense@versionUsed\xspace}
-\newcommand{\doclicenseName}{\doclicense@type~\doclicense@modifier~\doclicense@versionUsed\xspace}
+\newcommand{\doclicenseName}{%
+ \doclicense@type~\doclicense@modifier~\doclicense@versionUsed\xspace}
\newcommand{\doclicenseNameRef}{\href{\doclicenseURL}{\doclicenseName}\xspace}
\newcommand{\doclicenseLongName}{\doclicenseLongType\space\doclicense@longName\xspace}
\newcommand{\doclicenseLongNameRef}{\href{\doclicenseURL}{\doclicenseLongName}}
@@ -338,11 +379,12 @@ corresponds to \PackageName~\fileversion, dated \filedate.}}
\setkeys{doclicense}{#1}
\href{\doclicenseURL}{%
\includegraphics[width=\doclicense@imagewidth]%
- {doclicense-\doclicense@type-\doclicense@modifier}%
+ {doclicense-\doclicense@type-\doclicense@modifier\doclicense@imagemodifier}%
}
}
-\newcommand{\doclicenseLicense}{
+\newcommand{\doclicenseLicense}{\doclicenseThis} %% legacy support
+\newcommand{\doclicenseThis}{
\setlength{\doclicense@hsize}{\textwidth-\doclicense@imagewidth-2em}
\ifthenelse{\lengthtest{\hsize > \vsize}}{%% landscape
\setlength{\doclicense@hsize}{\doclicense@hsize-10em}
@@ -361,7 +403,7 @@ corresponds to \PackageName~\fileversion, dated \filedate.}}
% \end{macrocode}
% \subsection{Language selection}
-% The following lines include the ldf files. All language dependent things
+% The following lines include the ldf file. All language dependent things
% should be stored there or can be changed there. Note that one could redefine
% macros like \cmd{\doclicenseLongText} if necessary.
% \begin{macrocode}
@@ -371,7 +413,9 @@ corresponds to \PackageName~\fileversion, dated \filedate.}}
\IfFileExists{doclicense-\doclicense@lang.ldf}{%
\input{doclicense-\doclicense@lang.ldf}
}{%
- \PackageWarning{doclicense}{No language definition for \doclicense@lang not found. Please add one and submit a patch. Using English as fallback.}
+ \PackageWarning{doclicense}{%
+ No language definition for \doclicense@lang not found.
+ Please add one and submit a patch. Using English as fallback.}
\renewcommand{\doclicense@lang}{english}
\input{doclicense-\doclicense@lang.ldf}
}
@@ -408,18 +452,25 @@ corresponds to \PackageName~\fileversion, dated \filedate.}}
licenses/%
\doclicense@modifier/%
\doclicense@versionUsed\doclicense@UrlLangPart}
- \ifthenelse{\equal{\doclicense@modifier}{by-sa}}
- {\renewcommand{\doclicense@icon}{\ccbysa}}{}
- \ifthenelse{\equal{\doclicense@modifier}{by-nd}}
- {\renewcommand{\doclicense@icon}{\ccbynd}}{}
- \ifthenelse{\equal{\doclicense@modifier}{by-nc}}
- {\renewcommand{\doclicense@icon}{\ccbync}}{}
+ \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}
+ \renewcommand{\doclicense@imagemodifier}{}
+ }{}
\ifthenelse{\equal{\doclicense@modifier}{by-nc-sa}}
{\renewcommand{\doclicense@icon}{\ccbync}}{}
\ifthenelse{\equal{\doclicense@modifier}{by-nc-nd}}
{\renewcommand{\doclicense@icon}{\ccbync}}{}
\ifthenelse{\equal{\doclicense@modifier}{zero}}{%
\renewcommand{\doclicense@icon}{\cczero}
+ \renewcommand{\doclicense@imagemodifier}{}
\doclicense@setVersion[1.0]
\edef\doclicenseURL{%
\doclicense@baseUrlCC/%
@@ -429,6 +480,7 @@ corresponds to \PackageName~\fileversion, dated \filedate.}}
}{}
\ifthenelse{\equal{\doclicense@modifier}{pd}}{
\renewcommand{\doclicense@icon}{\ccpd}
+ \renewcommand{\doclicense@imagemodifier}{}
\doclicense@setVersion[1.0]
\edef\doclicenseURL{%
\doclicense@baseUrlCC/%