diff options
author | Karl Berry <karl@freefriends.org> | 2016-04-24 22:06:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-04-24 22:06:36 +0000 |
commit | 7e0ac46d48cf38a13141f3969aa465c80e495cd6 (patch) | |
tree | 43bd359878f70fecf281da46f09d10ca28e8a6c8 /Master/texmf-dist/source/latex/doclicense | |
parent | c08f665b75f94669941f1657423ac3e51a0697e4 (diff) |
doclicense (24apr16)
git-svn-id: svn://tug.org/texlive/trunk@40723 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/doclicense')
-rw-r--r-- | Master/texmf-dist/source/latex/doclicense/doclicense.dtx | 127 |
1 files changed, 91 insertions, 36 deletions
diff --git a/Master/texmf-dist/source/latex/doclicense/doclicense.dtx b/Master/texmf-dist/source/latex/doclicense/doclicense.dtx index 91670cf3526..61d24e5cc4c 100644 --- a/Master/texmf-dist/source/latex/doclicense/doclicense.dtx +++ b/Master/texmf-dist/source/latex/doclicense/doclicense.dtx @@ -27,7 +27,7 @@ %<package>\NeedsTeXFormat{LaTeX2e}[1998/12/01] %<package>\ProvidesPackage{doclicense} %<*package> - [2015/12/13 v1.4.0 Support for putting documents under a license] + [2016/04/24 v1.5.0 Support for putting documents under a license] %</package> % %<*driver> @@ -37,7 +37,7 @@ \newcommand{\PackageCTANURL}{https://www.ctan.org/pkg/doclicense} \newcommand{\PackageAuthor}{Robin Schneider} \newcommand{\PackageAuthorEmail}{ypid@riseup.net} -\newcommand{\PackageName}{\PrintPackage{doclicense}\xspace} +\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. @@ -59,19 +59,21 @@ } %% ^^A https://tex.stackexchange.com/a/95893/32320 \setlength\IndexMin{100pt} -\usepackage{doclicense} +\usepackage[ + hyphenation={RaggedRight}, +]{doclicense} \GetFileInfo{doclicense.dtx} \hypersetup{ pdftitle={A manual for \PackageName}, pdfauthor={\PackageAuthor{} <\PackageAuthorEmail>}, pdfsubject={\fileinfo}, baseurl={\PackageURL}, - pdfkeywords={This document corresponds to \PackageName~\fileversion, + pdfkeywords={This document corresponds to \PackageName\nobreakspace\fileversion, dated \filedate}, } \title{The \PackageName{} package\thanks{This document -corresponds to \PackageName~\fileversion, dated \filedate.}} +corresponds to \PackageName\nobreakspace\fileversion, dated \filedate.}} \author{\PackageAuthor\\ \texttt{\href{mailto:\PackageAuthorEmail?subject=LaTeX package doclicense% \&body=Dear Robin Schneider,}% @@ -118,6 +120,8 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} % \changes{1.1}{2015/04/06}{Added support for Creative Commons 4.0 and added \cmd{\doclicenseImageFileName}} % \changes{1.2}{2015/04/06}{Allow \cmd{\doclicenseModifier} to be used with hyperref. Fixed \cmd{\doclicenseIcon} macro, added missing image and wrote test framework. Added notes about how to add translations. Added Spanish translation.} % \changes{1.4.0}{2015/12/13}{Added \cmd{\doclicensePlainFullText} and \cmd{\doclicenseFullText} macros Thanks to \href{https://github.com/siefkenj}{siefkenj} for the help.} +% \changes{1.4.1}{2016/04/10}{Translation fixes for: fr, en-gb. Included missing CC-by-nc-nd icon (US dollar).} +% \changes{1.5.0}{2016/04/24}{Allow to change the way text is typeset by \cmd{\doclicenseThis}.} % %% ^^A nag warned about the center environment and it really messes up spacing. % @@ -186,7 +190,7 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} % by \PrintPackage{doclicense} to the corresponding values % (\enquote{\url{\doclicenseURL}} and \enquote{\doclicenseLongText{}}). % -% \bigskip +% \section{Package options} % % The first parameter is \enquote{\PrintOptionF{type}}. \DescribePara{type} % This sets the license type. Like in this example, the type can be @@ -236,6 +240,45 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} % % Currently supported are \enquote{-eu} and \enquote{-us}. % +% This option allows you to specify +% \DescribePara{hyphenation} +% a macro name which is going to be expanded +% in the minipage environment of \cmd{\doclicenseThis}. +% That allows you to change the behaviour how \cmd{\doclicenseLongText} is +% typeset. By default, this option is not enabled. +% +% One possible use case is to set the option to \enquote{RaggedRight}. +% This will use the \cmd{\RaggedRight} macro provided by the +% \PrintPackage{ragged2e} package\footnote{The \PrintPackage{ragged2e} package will be loaded when it is required.}) with the intention of limiting the number of +% hyphenations while still allowing a hyphenation by typesetting +% \cmd{\doclicenseLongText} as ragged text. +% +% The idea of using ragged text is that the \cmd{\doclicenseLongText} is +% 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. +% \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 +% by adding additional space between words. This has been be avoided by setting +% the following option for this document: +% +% \begin{quote} +% |\usepackage[| \\ +% | hyphenation={RaggedRight},| \\ +% |]{doclicense}| +% \end{quote} +% +% Another option which can make sense is the \cmd{\raggedright} macro which +% more drastically limits the number of hyphenations. This can be set as shown +% below: +% +% \begin{quote} +% |\usepackage[| \\ +% | hyphenation={raggedright},| \\ +% |]{doclicense}| +% \end{quote} +% % \section{Macros} % \DescribeMacro{\doclicenseType} % Expands to the type as set in the package options. Example: \enquote{\doclicenseType{}} @@ -406,19 +449,47 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} % % \newpage % \section{Implementation} -% \subsection{Dependencies} % \iffalse %<*package> % \fi -% This package depends on these packages. +% \subsection{Declaring the options} +% \begin{macrocode} +%% Parameters ((( +\RequirePackage{kvoptions} +\DeclareStringOption[CC]{type} +\DeclareStringOption[by-sa]{modifier} +\DeclareStringOption{version} +\DeclareStringOption{lang} +\DeclareStringOption{imagemodifier} +\DeclareStringOption[10em]{imagewidth} +\DeclareStringOption{hyphenation} +%% ))) + +% \end{macrocode} +% To test if all parameters are valid the macro |\ProcessLocalKeyvalOptions*| +% is expanded to ensure this before leaving the preamble. This is the only +% purpose for the |\ProcessLocalKeyvalOptions*| macro in this case. % \begin{macrocode} +\ProcessLocalKeyvalOptions* +% \end{macrocode} +% \subsection{Dependencies} +% \begin{macrocode} %% Dependencies ((( -\RequirePackage{kvoptions} \RequirePackage{xifthen} \RequirePackage{etoolbox} %% \ifcsdef \RequirePackage{xspace} \RequirePackage{verbatim} +\ifthenelse{ + \equal{\doclicense@hyphenation}{} +}{}{% + \RequirePackage{ragged2e} + + \ifthenelse{\isnamedefined{\doclicense@hyphenation}}{}{% + \PackageError{doclicense}{Hyphenation macro not defined} + {The macro name given via the hyphenation option is not defined.}% + } +} \AtEndPreamble{% \@ifpackageloaded{csquotes}{}{\RequirePackage{csquotes}} \@ifpackageloaded{ccicons}{}{\RequirePackage{ccicons}} @@ -437,24 +508,6 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} %% ))) % \end{macrocode} -% \subsection{Declaring the options} -% \begin{macrocode} -%% Parameters ((( -\DeclareStringOption[CC]{type} -\DeclareStringOption[by-sa]{modifier} -\DeclareStringOption{version} -\DeclareStringOption{lang} -\DeclareStringOption{imagemodifier} -\DeclareStringOption[10em]{imagewidth} -%% ))) - -% \end{macrocode} -% To test if all parameters are valid the macro |\ProcessLocalKeyvalOptions*| -% is expanded to ensure this before leaving the preamble. This is the only -% purpose for the |\ProcessLocalKeyvalOptions*| macro in this case. -% \begin{macrocode} -\ProcessLocalKeyvalOptions* -% \end{macrocode} % \subsection{Declare variables and macros} % \begin{macrocode} %% Declare variables ((( @@ -487,7 +540,7 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} \newcommand{\doclicenseModifier}{\doclicense@modifier@uppercase\xspace} \newcommand{\doclicenseVersion}{\doclicense@versionUsed\xspace} \newcommand{\doclicenseName}{% - \doclicense@type~\doclicense@modifier@uppercase~% + \doclicense@type\nobreakspace\doclicense@modifier@uppercase\nobreakspace% \doclicense@versionUsed\xspace% } \newcommand{\doclicenseNameRef}{\href{\doclicenseURL}{\doclicenseName}\xspace} @@ -501,7 +554,7 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} } \newcommand{\doclicenseLongText}{% \doclicense@lang@thisDoc\space - \href{\doclicenseURL}{\doclicenseLongType\space\enquote{\doclicense@longName}} + \href{\doclicenseURL}{\doclicenseLongType\space\enquote{\doclicense@longName}}% \doclicense@lang@word@license.\xspace% } \newcommand{\doclicenseIcon}{\doclicense@icon\xspace} @@ -531,15 +584,17 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} \newcommand{\doclicenseLicense}{\doclicenseThis} %% legacy support \newcommand{\doclicenseThis}{% \setlength{\doclicense@hsize}{\textwidth-\doclicense@imagewidth-2em}% - \ifthenelse{\isnamedefined{iflandscape}}{% - \iflandscape{% - % \setlength{\doclicense@hsize}{\doclicense@hsize-10em}% - }{}% - }{}% + % \ifthenelse{\isnamedefined{iflandscape}}{% + % \iflandscape{% + % \setlength{\doclicense@hsize}{\doclicense@hsize-10em}% + % }{}% + % }{}% % {% - % \centering% \begin{center} \begin{minipage}{\doclicense@hsize} + \ifthenelse{\isempty{\doclicense@hyphenation}}{}{% + \@nameuse{\doclicense@hyphenation}% + }% \doclicenseLongText% \end{minipage} \hfill @@ -554,7 +609,7 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} % \end{macrocode} % \subsection{Language selection} % 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 +% should be stored and changed there. Note that one could also redefine % macros like \cmd{\doclicenseLongText} if necessary. % \begin{macrocode} %% Language support ((( |