% \iffalse meta-comment % % File: gfdl.dtx % ------------------------------------------------------------- % Package: gfdl % Version: v0.1 (January 1, 2023) % Author: निरंजन % Description: For using GFDL in LaTeX. % Repository: https://puszcza.gnu.org.ua/projects/gfdl-tex % License: GPLv3+, GFDLv1.3+ % ------------------------------------------------------------- % % The LaTeX package gfdl v0.1 % Copyright © 2022, 2023 निरंजन % % This program is free software: you can redistribute it % and/or modify it under the terms of the GNU General Public % License as published by the Free Software Foundation, % either version 3 of the License, or (at your option) any % later version. % % This program is distributed in the hope that it will be % useful, but WITHOUT ANY WARRANTY; without even the implied % warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR % PURPOSE. See the GNU General Public License for more % details. % % You should have received a copy of the GNU General Public % License along with this program. If not, see % . % \fi % \iffalse %<*internal> \iffalse % %<*readme> ------------------------------------------------------------- Package: gfdl Version: v0.1 (January 1, 2023) Author: निरंजन Description: For using GFDL in LaTeX. Repository: https://puszcza.gnu.org.ua/projects/gfdl-tex License: GPLv3+, GFDLv1.3+ ------------------------------------------------------------- % %<*internal> \fi % %<*driver> \documentclass{l3doc} \usepackage{xcolor} \usepackage{fontawesome5} \usepackage{gfdl} \usepackage{fontspec} \usepackage{hyperref,hyperxmp} \colorlet{myblue}{blue!60!black} \colorlet{myred}{red!60!black} \colorlet{mygreen}{green!60!black} \hypersetup{% unicode,% colorlinks,% urlcolor = {myblue},% linkcolor = {myred},% citecolor = {mygreen},% pdftitle = {The gfdl package},% pdfauthor = {निरंजन},% pdfsubject = {For using GFDL in LaTeX.},% pdfcreator = {निरंजन},% pdfkeywords = {% GFDL, LaTeX, FSF, Licensing, Documentation% },% pdfcopyright = {% The LaTeX package gfdl\textLF Copyright © 2022, 2023 निरंजन\textLF Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.% },% pdflicenseurl = {% https://www.gnu.org/licenses/fdl-1.3.txt% }% }% \usepackage{cleveref} \newfontfamily\devanagari[% Script = {Devanagari},% Renderer = {Harfbuzz},% Scale = {0.8}% ]% {Shobhika} \NewDocumentEnvironment{dedication}{ }{% % Based on egreg's answer: % https://tex.stackexchange.com/a/102849 \clearpage % for a new page. \thispagestyle{empty}% no header and footer. \vspace*{\stretch{1}}% some space at the top. \itshape % to get the text in italics. \raggedleft % flush to the right margin. }{% \par % end the paragraph \vspace{\stretch{3}}%% space at bottom is three times that \clearpage %% at the top finish off the page. } \NewCommandCopy\oldamp\& \renewcommand*{\&}{\textit{\oldamp}} \gfdlcopyrightdescription{The \LaTeX\ package \pkg{gfdl}} \gfdlcopyrightholders{\texorpdfstring{{\devanagari निरंजन}}{निरंजन}} \gfdlcopyrightableyears{2022, 2023} \begin{document} \DocInput{\jobname.dtx} \end{document} % % \fi % \title{The \pkg{gfdl} package} % \author{^^A % {^^A % \devanagari % निरंजन^^A % }^^A % \thanks{^^A % \href{mailto:hi.niranjan@pm.me}^^A % {\texttt{hi.niranjan@pm.me}}^^A % }^^A % } % \date{^^A % Version 0.1^^A % ---^^A % January 1, 2023\\[1ex]^^A % {^^A % \small\faIcon{link}\quad % \url{https://ctan.org/pkg/gfdl}^^A % }\\^^A % {^^A % \small\faIcon{bug}\quad % \url{https://puszcza.gnu.org.ua/bugs/?group=gfdl-tex}^^A % }^^A % } % % \maketitle % % \begin{documentation} % \begin{abstract} % The GFDL is a popular license used for programming % manuals, documentations \& various other textual works % too, but using this license with \LaTeX\ isn't very % convenient. This package aims to help users in easily % using the license without violating any rules of the % license. With a handful of commands, users can rest % assured that their document will be perfectly licensed % under GFDL. % \end{abstract} % % \tableofcontents % % \begin{dedication} % Dedicated to the FSF \& it's continuous fight for % the freedom of software\dots % \end{dedication} % % \section*{Acknowledgment} % % I acknowledge my friend Sahil Patel for reviewing the % output of this package \& suggesting some corrections. % I would also like to thank Karl Berry for pointing out % some critical issues in my package \& suggesting % alternative ways of dealing with them. This package % modifies \& uses a few \LaTeX-files provided on the % web-pages of respective versions of GFDL\footnote{^^A % GFDLv1.3: % \texttt{^^A % \url{https://www.gnu.org/licenses/fdl-1.3.tex}^^A % }.\\^^A % GFDLv1.2: % \texttt{^^A % \url{https://www.gnu.org/licenses/fdl-1.2.tex}^^A % }.\\^^A % GFDLv1.1: % \texttt{^^A % \url{https://www.gnu.org/licenses/fdl-1.1.tex}^^A % }.\\^^A % } which are unlicensed \& their authors are unknown, but % with a few typographic modifications I have used them in % the package. I would like to thank FSF/GNU-hackers for % providing a basic skeleton of the \LaTeX-files which I % could modify. % % \section{Documentation} % % This section describes all the macros \& parameters that % the package provides. % % \subsection{Macros} % % \begin{function}{^^A % \gfdlcopyrightdescription,^^A % \gfdlcopyrightableyears,^^A % \gfdlcopyrightholders % } % \begin{syntax} % \cs{gfdlcopyrightdescription}\marg{project-description} % \cs{gfdlcopyrightableyears}\marg{copyright-able years} % \cs{gfdlcopyrighthoders}\marg{copyright-holders} % \end{syntax} % The names of these macros are pretty self-explanatory. % These macros store the information which is then printed % automatically at necessary places. Only if one has % loaded the |manual| option (documented in \cref{opts}); % they will have to use the macros following this one to % print the notice \& the license-text. % \end{function} % % \begin{function}{\printgfdlnotice} % This text prints the copyright-notice. \LaTeX's % float-mechanism is used for printing it. It is printed % on the first page of the document with default % settings. With option |manual| user is free to print it % anywhere, but not printing it will produce an error. % \end{function} % % \begin{function}{\printgfdltext} % This text prints the entire license text. In default % settings this command is run after the last page of the % document. With option |manual|, the user is free to use % it anywhere, but not using it will produce an error. % \end{function} % % \subsection{Options} % \label{opts} % % \begin{function}{manual} % By default the package prints the copyright-notice along % with the license-text of GFDL in the document by % default. The former is printed at the bottom of the % first page whereas the latter is printed just after the % last page. If anyone wants to suppress this behavior \& % print both of these things anywhere in the document with % \cs{printgfdlnotice} \& \cs{printgfdltext} as documented % earlier. % \end{function} % % \subsubsection{Legacy support} % % The following options are just for legacy support \& % should be avoided for newer works. It is advised to use % these options only when the document demands certain old % conventions which are obsolete these days. % % \begin{function}{(C)} % The \textcopyright\ symbol was at times written as (C) % \& if someone needs to use this style, then they can use % this package-option. The package essentially prints this % symbol at two places. One in the actual PDF text \& one % in it's metadata. At both of these places users will see % the change if this option is used. By default this % option is inactive. % \end{function} % % \begin{function}{version} % \begin{syntax} % |version|=\marg{version-number}\hfill ^^A % |1.1|, |1.2| \textit{or} \textcolor{myred}{|1.3|} % \end{syntax} % 1.3 is the current version of GFDL, but there were two % old versions before it (i.e., 1.2 \& 1.1). By default % the latest version is used, but with this package % option, users can select previous versions too. It is % important to note that as of now this option does % \emph{not} allow any other value than |1.1|, |1.2| \& % \textcolor{myred}{|1.3|}. % % If a newer version is released by the FSF, the default % behavior of the package will most likely change to % produce the latest version of GFDL at that time. In that % case recompiling an old document with the new version of % this package will break your documents, but as a % developer I find that incompatibility reasonable \& % desirable, because I believe using the newer versions of % this license will only help the cause for which hackers % are fighting. % \end{function} % \end{documentation} % % \begin{implementation} % \section{Implementation} % % Provide package with its basic information. % % \begin{macrocode} %<*package> \ProvidesPackage{gfdl}[2023/01/01 v0.1 For using the GFDL in LaTeX.] % \end{macrocode} % % Load necessary packages. % % \begin{macrocode} \RequirePackage{float} \RequirePackage{expkv-def,expkv-opt} % \end{macrocode} % % Define conditionals which we will be using in the package % \& set some initial values for them. % % The package issues a warning if copyright-holders aren't % declared \& it doesn't print the GFDL-notice in this case, % because a copyright-notice without copyright-holders makes % no sense. The following conditional is at work for this. % % \begin{macrocode} \newif\ifgfdl@copyrightholdersgiven \gfdl@copyrightholdersgivenfalse % \end{macrocode} % % With the following code we first define various internal % conditionals which we require. We also set their initial % values here. % % \begin{macrocode} \newif\ifgfdl@copyrightableyearsgiven \gfdl@copyrightableyearsgivenfalse \newif\ifgfdl@copyrightedmaterialdesc \gfdl@copyrightedmaterialdescfalse \newif\ifgfdl@licensetextnotprinted \gfdl@licensetextnotprintedtrue \newif\ifgfdl@noticenotprinted \gfdl@noticenotprintedtrue % \end{macrocode} % % Define package options with \pkg{expkv}. % % \begin{macrocode} \ekvdefinekeys{gfdl}{ % \end{macrocode} % % \begin{macro}{manual} % % The |invbool| type is used to define package option % |manual|\footnote{Read the documentation of \pkg{expkv} % for explanation.}. We define the conditional % |\ifgfdl@printgfdl| with it. % % \begin{macrocode} invbool manual = {\ifgfdl@printgfdl}, % \end{macrocode} % \end{macro} % % \begin{macro}{(C)} % % The following code defines the package option |(C)| % which defines an internally used conditional % |\ifgfdl@bracketedcopyright|. The default value of this % conditional is false. % % \begin{macrocode} bool (C) = {\ifgfdl@bracketedcopyright}, % \end{macrocode} % \end{macro} % % \begin{macro}{version} % % The following code develops the option |version| which % takes three options seen in the documentation. By using % the |initial| key-type, we set the initial value of this % option to |1.3|. % % \begin{macrocode} choice version = {% 1.1 = {\def\gfdl@version{1p1}},% 1.2 = {\def\gfdl@version{1p2}},% 1.3 = {\def\gfdl@version{1p3}}% }, initial version = {1.3} } % \end{macrocode} % \end{macro} % % After developing all the options, we set process them with % the following code. % % \begin{macrocode} \ekvoProcessLocalOptions{gfdl} % \end{macrocode} % % We have used the |bool| type from \pkg{expkv} for % developing the package option |(C)|. It defines the % conditional |\ifgfdl@bracketedcopyright| which is by % default false. We use an internal macro, i.e., % |\gfdl@copyrightsymbol| for printing the copyright symbol % with the following code. We |\let| it be |\textcopyright| % when the aforementioned conditional is false \& it is % defined as |(C)| when the conditional is true (i.e., when % the option is explicitly used by the user). % % \begin{macrocode} \ifgfdl@bracketedcopyright \def\gfdl@copyrightsymbol{(C)}% \else \let\gfdl@copyrightsymbol\textcopyright \fi % \end{macrocode} % % \begin{macro}{\gfdlcopyrightdescription} % The following |\NewDocumentCommand| is used to develop % this command. % \begin{macrocode} \NewDocumentCommand{ \gfdlcopyrightdescription }{ m }{% \def\@copyrightedmaterialdesc{#1}% \gfdl@copyrightedmaterialdesctrue } % \end{macrocode} % \end{macro} % \begin{macro}{\gfdlcopyrightableyears} % For this command we have the following code. % \begin{macrocode} \NewDocumentCommand{ \gfdlcopyrightableyears }{ m }{% \def\@copyrightableyears{#1}% \gfdl@copyrightableyearsgiventrue } % \end{macrocode} % \end{macro} % \begin{macro}{\gfdlcopyrightholders} % And lastly, we have this command coded as follows. % \begin{macrocode} \NewDocumentCommand{ \gfdlcopyrightholders }{ m }{% \def\@copyrightholders{#1}% \gfdl@copyrightholdersgiventrue } % \end{macrocode} % \end{macro} % We issue a warning when copyright-able years are not % given. The following code generates the warning. We define % the internal macro containing the copyright-able years as % |??| in bold font here itself. % \begin{macrocode} \AddToHook{begindocument/before}{% \ifgfdl@copyrightableyearsgiven \else \def\@copyrightableyears{\textbf{??}}% \PackageWarningNoLine{gfdl}{% Copyright-able years not given. I can't print the \MessageBreak copyright notice without them. To give me this \MessageBreak information use the \string\gfdlcopyrightableyears\space command.\MessageBreak Using `??' as a placeholder% }% \fi % \end{macrocode} % The following code is used to check if user has given % information about copyright-holders. If not, then we issue % a warning with this code \& again define the internal % macro containing this information as bold |??|. % \begin{macrocode} \ifgfdl@copyrightholdersgiven \else \def\@copyrightholders{\textbf{??}}% \PackageWarningNoLine{gfdl}{% Copyright-holders not given. I can't print the \MessageBreak copyright notice without them. To give me this \MessageBreak information use the \string\gfdlcopyrightholders\space command.\MessageBreak Using `??' as a placeholder% }% \fi % \end{macrocode} % % With default settings of this package, \pkg{hyperref}, % \pkg{csquotes} \& \pkg{hyperxmp} are loaded, but to avoid % potential conflicts, we load them conditionally. With the % following code this is achieved. % % \begin{macrocode} \@ifpackageloaded{csquotes}{}{% \RequirePackage{csquotes}% }% \@ifpackageloaded{hyperref}{}{% \RequirePackage{hyperref}% }% \@ifpackageloaded{hyperxmp}{}{% \RequirePackage{hyperxmp}% }% % \end{macrocode} % % For setting the metadata we use the following code. % % \begin{macrocode} \hypersetup{% pdfcopyright = {% \ifgfdl@copyrightedmaterialdesc \@copyrightedmaterialdesc \textLF \fi Copyright \gfdl@copyrightsymbol\ \@copyrightableyears\ \@copyrightholders\textLF Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.% },% pdflicenseurl = {% https://www.gnu.org/licenses/fdl-1.3.txt% }% }% } % \end{macrocode} % % Printing the text automatically at the bottom of the first % page is achieved with the help of a float. It is developed % using package \pkg{float} for the following commands. % % \begin{macrocode} \newfloat{gfdl@float}{b}{delme} % \end{macrocode} % % \begin{macro}{\printgfdlnotice} % This command is developed using the following code. % \begin{macrocode} \NewDocumentCommand{ \printgfdlnotice }{ }{% \begin{gfdl@float}[b!] \hrule\medskip \ifgfdl@copyrightedmaterialdesc \@copyrightedmaterialdesc\par \fi Copyright \gfdl@copyrightsymbol\ \@copyrightableyears\ \@copyrightholders Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled \enquote{% GNU Free Documentation License% }.% \end{gfdl@float}% \gfdl@noticenotprintedfalse } % \end{macrocode} % \end{macro} % % We use |\printgfdlnotice| at the first page of the % document with the following code. % % \begin{macrocode} \AddToHook{begindocument/end}{% \ifgfdl@printgfdl \printgfdlnotice \fi } % \end{macrocode} % % \begin{macro}{\printgfdltext} % % The following code is used to define this command. % % \begin{macrocode} \NewDocumentCommand{ \printgfdltext }{ }{% \input{gfdl-tex-\gfdl@version.tex}% \gfdl@licensetextnotprintedfalse } % \end{macrocode} % \end{macro} % % In default settings the entire license text is printed % with the following code. % % \begin{macrocode} \AddToHook{enddocument}{% \ifgfdl@printgfdl \newpage \phantomsection \addcontentsline{toc}{section}{% GNU Free Documentation License% }% \printgfdltext \fi \ifgfdl@noticenotprinted \PackageError{gfdl}{% You didn't print the copyright notice% }{% You are in the `manual' mode of the GFDL package and hence you\MessageBreak are supposed to print the copyright notice at a suitable place\MessageBreak of your choice, but you haven't printed it at all. This violates\MessageBreak the requirement of the GFDL. To print it use:\MessageBreak \space\space\string\printgfdlnotice.% }% \fi \ifgfdl@licensetextnotprinted \PackageError{gfdl}{% You didn't print the license text% }% {% You are in the `manual' mode of the GFDL package and hence you% \MessageBreak are supposed to print the full license text at a suitable place% \MessageBreak of your choice, but you haven't printed it at all. This violates% \MessageBreak the requirement of the GFDL. To print it use:% \MessageBreak \space\space\string\printgfdltext.% }% \fi } % \end{macrocode} % % This is the end of the package. % % \begin{macrocode} % % \end{macrocode} % \end{implementation} % \Finale