From cde9a12d36aa92fe7a35212499e459309cdd06ce Mon Sep 17 00:00:00 2001 From: Tobias Pape Date: Fri, 9 Feb 2024 09:29:45 +0100 Subject: [PATCH 1/8] \paperdetails moved around and error msg fix Fixes #57 --- example-programming.tex | 6 +++--- programming.cls | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/example-programming.tex b/example-programming.tex index abbaa6e..987b980 100644 --- a/example-programming.tex +++ b/example-programming.tex @@ -171,14 +171,14 @@ \subsection{Document Parts} \documentclass[english,submission]{programming}`\label{l:doc}` \usepackage[backend=biber]{biblatex} % Use Biblatex `\label{l:bib}` \addbibresource{example.bib} - -\begin{document} - \paperdetails{`\label{l:details}` perspective=engineering, area={General-purpose programming} } +\begin{document} + + \title{The importance of why and how to do work}`\label{l:meta}` \author{Anna Author} \affiliation{The Unseen University, Ankh-Morpork} diff --git a/programming.cls b/programming.cls index f96ef10..cba62ad 100644 --- a/programming.cls +++ b/programming.cls @@ -141,9 +141,9 @@ \newcommand*\P@set@license[1]{% \renewcommand*\P@license{#1} \if@atdocument - \P@error{License set too late, move \string\paperdetails up in the document.}% + \P@error{License set too late, move \string\paperdetails\space up in the document.}% {The license cannot be set to ``#1'' at this point in the process. Please - move the \string\paperdetails command before the \string\begin\{document\} + move the \string\paperdetails\space command before the \string\begin\{document\} command.} \else \@ifpackageloaded{doclicense}% From 93f5116fa3d3445260ea68c1880994e71a04cc29 Mon Sep 17 00:00:00 2001 From: Tobias Pape Date: Fri, 9 Feb 2024 12:50:17 +0100 Subject: [PATCH 2/8] [ci skip] prepare doclicense avoidance --- programming.cls | 73 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 22 deletions(-) diff --git a/programming.cls b/programming.cls index cba62ad..a75cd85 100644 --- a/programming.cls +++ b/programming.cls @@ -465,26 +465,55 @@ \definecolor{P@GrayBG}{gray}{.90} \definecolor{P@ORCID}{HTML}{A6CE39} -\newlength{\doclicenseimagewidth} -\setlength{\doclicenseimagewidth}{2.7cm} -\RequirePackage[ - type={CC}, - modifier=\P@license, - version={4.0}, - imagewidth=\doclicenseimagewidth, -]{doclicense} - -% Fixes for intermediate versions. -% TL 2015 -% this is actually an installation bug for TL 2015, -% but we cannot reliably test that, so we resort to the check -% if the package is new enough for TL 2016. -\@ifpackagelater{doclicense}{2016/04/24}% - {\let\P@doclicenseImage\doclicenseImage}% we're good. - {\def\P@doclicenseImage{% - \makebox[\doclicenseimagewidth]{% - \setlength{\fboxsep}{5pt}% - \raisebox{.5\baselineskip}{\colorbox{P@GrayBG}{\Huge\selectfont\doclicenseIcon}}}}} +% +% We're emulating doclicense and having none of its shenanigans +% +\newlength{\P@doclicenseimagewidth} +\setlength{\P@doclicenseimagewidth}{2.7cm} +\RequirePackage{ccicons} +\def\P@doclicenseversionUsed{4.0} +\def\P@doclicenseimagemodifier{-88x31} + +\def\P@doclicenseImageFileName{doclicense-CC-\P@license\P@doclicenseimagemodifier} + +\def\P@doclicensetext#1{This work is licensed under a #1 license} +\def\P@doclicenseText{\href{\P@doclicenseURL}{``\P@doclicensetext{CC~\MakeUppercase{\P@license}~\P@doclicenseversionUsed}''}} +\def\P@doclicenseLongTextForHyperref{\P@doclicensetext{Creative Commons "\csuse{P@doclicense@l@\P@license @\P@doclicenseversionUsed}"}} +\def\P@doclicenseIcon{\csuse{P@doclicense@i@\P@license @\P@doclicenseversionUsed}} +\csdef{P@doclicense@l@by@4.0}{Attribution 4.0 International}% +% \csdef{P@doclicense@l@by-sa@4.0}{Attribution-ShareAlike 4.0 International}% +% \csdef{P@doclicense@l@by-nd@4.0}{Attribution-NoDerivatives 4.0 International}% +\csdef{P@doclicense@l@by-nc@4.0}{Attribution-NonCommercial 4.0 International}% +% \csdef{P@doclicense@l@by-nc-sa@4.0}{Attribution-NonCommercial-ShareAlike 4.0 International}% +% \csdef{P@doclicense@l@by-nc-nd@4.0}{Attribution-NonCommercial-NoDerivatives 4.0 International}% +\csdef{P@doclicense@i@by@4.0}{\ccby}% +% \csdef{P@doclicense@i@by-sa@4.0}{\ccbysa}% +% \csdef{P@doclicense@i@by-nd@4.0}{\ccbynd}% +\csdef{P@doclicense@i@by-nc@4.0}{\ccbync}% +% \csdef{P@doclicense@i@by-nc-sa@4.0}{\ccbyncsa}% +% \csdef{P@doclicense@i@by-nc-nd@4.0}{\ccbyncnd}% + +\def\P@doclicenseImage@{% + \href% + {\P@doclicenseURL}% + {\includegraphics[width=\P@doclicenseimagewidth]{\P@doclicenseImageFileName}}} +\def\P@doclicenseImage@@{% + \makebox[\P@doclicenseimagewidth]% + {\setlength{\fboxsep}{5pt}% + \raisebox{.5\baselineskip}{\colorbox{P@GrayBG}{\Huge\selectfont\P@doclicenseIcon}}}} +\IfFileExists{\P@doclicenseImageFileName.pdf}% new image present + {\let\P@doclicenseImage\P@doclicenseImage@}% + {\def\P@doclicenseImageFileName{doclicense-CC-\P@license} + \IfFileExists{\P@doclicenseImageFileName.pdf}% old image present + {\let\P@doclicenseImage\P@doclicenseImage@}% + {\let\P@doclicenseImage\P@doclicenseImage@@}}% no image present, us icon + + +\BeforeBeginEnvironment{document}{% + \edef\P@doclicenseURL{https://creativecommons.org/licenses/\P@license/\P@doclicenseversionUsed/deed.en} + \hypersetup{% + pdfcopyright = {\P@doclicenseLongTextForHyperref}, + pdflicenseurl = {\P@doclicenseURL}}} \RequirePackage{pict2e} \RequirePackage[tbtags,fleqn]{amsmath} @@ -976,11 +1005,11 @@ \hspace{-1mm}\P@doclicenseImage% \hfill% \begin{minipage}[b]% - {\dimexpr\linewidth - \doclicenseimagewidth - 1\columnsep\relax}% + {\dimexpr\linewidth - \P@doclicenseimagewidth - 1\columnsep\relax}% \ignorespaces \scriptsize% \textcopyright\ {\@authorrunning}\\ - \doclicenseText\\ + \P@doclicenseText\\ \ifboolexpr{bool{P@submission}}% {Submitted to \textit{\P@banner}.}% {In \textit{\P@banner}\ignorespaces% From 4949eaa076167361b1e177a6075e3884d1af8984 Mon Sep 17 00:00:00 2001 From: Tobias Pape Date: Fri, 9 Feb 2024 14:38:52 +0100 Subject: [PATCH 3/8] avoid doclicense but borrow images circumvents and thus fixes #58 --- programming.cls | 123 +++++++++++++++++++++++++----------------------- 1 file changed, 63 insertions(+), 60 deletions(-) diff --git a/programming.cls b/programming.cls index a75cd85..30537c0 100644 --- a/programming.cls +++ b/programming.cls @@ -137,22 +137,15 @@ \providecommand*\P@license{by} - \newcommand*\P@set@license[1]{% - \renewcommand*\P@license{#1} \if@atdocument \P@error{License set too late, move \string\paperdetails\space up in the document.}% - {The license cannot be set to ``#1'' at this point in the process. Please - move the \string\paperdetails\space command before the \string\begin\{document\} - command.} - \else - \@ifpackageloaded{doclicense}% - {\undef\doclicenseURL% - \setkeys{doclicense}{modifier=#1}% - % hack: propagate settings - \doclicense@set} - {\PassOptionsToPackage{modifier=#1}{doclicense}} - \fi} + {The license cannot be set to ``#1'' at this point in the process. Please + move the \string\paperdetails\space command before the \string\begin{document} + command.} + \fi + \renewcommand*\P@license{#1}% + \P@lic@setURL}% \P@Key{license}{ \P@setnum{license}{@tempa}{% @@ -468,52 +461,62 @@ % % We're emulating doclicense and having none of its shenanigans % -\newlength{\P@doclicenseimagewidth} -\setlength{\P@doclicenseimagewidth}{2.7cm} -\RequirePackage{ccicons} -\def\P@doclicenseversionUsed{4.0} -\def\P@doclicenseimagemodifier{-88x31} - -\def\P@doclicenseImageFileName{doclicense-CC-\P@license\P@doclicenseimagemodifier} - -\def\P@doclicensetext#1{This work is licensed under a #1 license} -\def\P@doclicenseText{\href{\P@doclicenseURL}{``\P@doclicensetext{CC~\MakeUppercase{\P@license}~\P@doclicenseversionUsed}''}} -\def\P@doclicenseLongTextForHyperref{\P@doclicensetext{Creative Commons "\csuse{P@doclicense@l@\P@license @\P@doclicenseversionUsed}"}} -\def\P@doclicenseIcon{\csuse{P@doclicense@i@\P@license @\P@doclicenseversionUsed}} -\csdef{P@doclicense@l@by@4.0}{Attribution 4.0 International}% -% \csdef{P@doclicense@l@by-sa@4.0}{Attribution-ShareAlike 4.0 International}% -% \csdef{P@doclicense@l@by-nd@4.0}{Attribution-NoDerivatives 4.0 International}% -\csdef{P@doclicense@l@by-nc@4.0}{Attribution-NonCommercial 4.0 International}% -% \csdef{P@doclicense@l@by-nc-sa@4.0}{Attribution-NonCommercial-ShareAlike 4.0 International}% -% \csdef{P@doclicense@l@by-nc-nd@4.0}{Attribution-NonCommercial-NoDerivatives 4.0 International}% -\csdef{P@doclicense@i@by@4.0}{\ccby}% -% \csdef{P@doclicense@i@by-sa@4.0}{\ccbysa}% -% \csdef{P@doclicense@i@by-nd@4.0}{\ccbynd}% -\csdef{P@doclicense@i@by-nc@4.0}{\ccbync}% -% \csdef{P@doclicense@i@by-nc-sa@4.0}{\ccbyncsa}% -% \csdef{P@doclicense@i@by-nc-nd@4.0}{\ccbyncnd}% - -\def\P@doclicenseImage@{% - \href% - {\P@doclicenseURL}% - {\includegraphics[width=\P@doclicenseimagewidth]{\P@doclicenseImageFileName}}} -\def\P@doclicenseImage@@{% - \makebox[\P@doclicenseimagewidth]% +% Data. +\newlength{\P@lic@imagewidth} +\setlength{\P@lic@imagewidth}{2.7cm} +\newcommand*\P@lic@version{4.0} +\newcommand*\P@lic@imagemodifier{-88x31} +% +\csdef{P@lic@l@by@4.0}{Attribution 4.0 International}% +% \csdef{P@lic@l@by-sa@4.0}{Attribution-ShareAlike 4.0 International}% +% \csdef{P@lic@l@by-nd@4.0}{Attribution-NoDerivatives 4.0 International}% +\csdef{P@lic@l@by-nc@4.0}{Attribution-NonCommercial 4.0 International}% +% \csdef{P@lic@l@by-nc-sa@4.0}{Attribution-NonCommercial-ShareAlike 4.0 International}% +% \csdef{P@lic@l@by-nc-nd@4.0}{Attribution-NonCommercial-NoDerivatives 4.0 International}% +% +% These require ccicons, and we take care of that when necessary. +% If someone uses these regardless, they can sure keep the errors +\csdef{P@lic@i@by@4.0}{\ccby}% +% \csdef{P@lic@i@by-sa@4.0}{\ccbysa}% +% \csdef{P@lic@i@by-nd@4.0}{\ccbynd}% +\csdef{P@lic@i@by-nc@4.0}{\ccbync}% +% \csdef{P@lic@i@by-nc-sa@4.0}{\ccbyncsa}% +% \csdef{P@lic@i@by-nc-nd@4.0}{\ccbyncnd}% + +\newcommand*\P@lic@ImageFileName{doclicense-CC-\P@license\P@lic@imagemodifier} +\newcommand*\P@lic@OldImageFileName{doclicense-CC-\P@license} +\newcommand*\P@lic@text[1]{This work is licensed under a #1 license} +\newcommand*\P@lic@Text{\P@lic@text{\href{\P@lic@URL}{``CC~\MakeUppercase{\P@license}~\P@lic@version}''}} +\newcommand*\P@lic@LongTextForHyperref{\P@lic@text{Creative Commons "\csuse{P@lic@l@\P@license @\P@lic@version}"}} +\newcommand*\P@lic@Icon{\csuse{P@lic@i@\P@license @\P@lic@version}} + +\newcommand*\P@lic@Image@% + {\href% + {\P@lic@URL}% + {\includegraphics[width=\P@lic@imagewidth]{\P@lic@ImageFileName}}} +\newcommand*\P@lic@Image@@% + {\makebox[\P@lic@imagewidth]% {\setlength{\fboxsep}{5pt}% - \raisebox{.5\baselineskip}{\colorbox{P@GrayBG}{\Huge\selectfont\P@doclicenseIcon}}}} -\IfFileExists{\P@doclicenseImageFileName.pdf}% new image present - {\let\P@doclicenseImage\P@doclicenseImage@}% - {\def\P@doclicenseImageFileName{doclicense-CC-\P@license} - \IfFileExists{\P@doclicenseImageFileName.pdf}% old image present - {\let\P@doclicenseImage\P@doclicenseImage@}% - {\let\P@doclicenseImage\P@doclicenseImage@@}}% no image present, us icon - - -\BeforeBeginEnvironment{document}{% - \edef\P@doclicenseURL{https://creativecommons.org/licenses/\P@license/\P@doclicenseversionUsed/deed.en} + \raisebox{.5\baselineskip}{\colorbox{P@GrayBG}{\Huge\selectfont\P@lic@Icon}}}} +\providecommand*\P@lic@Image{} +\IfFileExists{doclicense.sty}% borrow images + {\let\P@lic@Image\P@lic@Image@% + \IfFileExists{\P@lic@ImageFileName.pdf} + % image not present, but if doclicense is, assume old + {}{\let\P@lic@ImageFileName\P@lic@OldImageFileName}} + {\RequirePackage{ccicons}% no image present, us icon + \let\P@lic@Image\P@lic@Image@@} +% +% hook into hyperxmp at document begin +% +\providecommand*\P@lic@URL{https://creativecommons.org/licenses/by/4.0/deed.en} +\newcommand*\P@lic@setURL{\xdef\P@lic@URL{https://creativecommons.org/licenses/\P@license/\P@lic@version/deed.en}} + +\BeforeBeginEnvironment{document}% + {\P@lic@setURL \hypersetup{% - pdfcopyright = {\P@doclicenseLongTextForHyperref}, - pdflicenseurl = {\P@doclicenseURL}}} + pdfcopyright = {\P@lic@LongTextForHyperref}, + pdflicenseurl = {\P@lic@URL}}} \RequirePackage{pict2e} \RequirePackage[tbtags,fleqn]{amsmath} @@ -1002,14 +1005,14 @@ \begin{minipage}[b][0pt][b]{\textwidth} \null\noindent% \normalfont% - \hspace{-1mm}\P@doclicenseImage% + \hspace{-1mm}\P@lic@Image% \hfill% \begin{minipage}[b]% - {\dimexpr\linewidth - \P@doclicenseimagewidth - 1\columnsep\relax}% + {\dimexpr\linewidth - \P@lic@imagewidth - 1\columnsep\relax}% \ignorespaces \scriptsize% \textcopyright\ {\@authorrunning}\\ - \P@doclicenseText\\ + \P@lic@Text\\ \ifboolexpr{bool{P@submission}}% {Submitted to \textit{\P@banner}.}% {In \textit{\P@banner}\ignorespaces% From 43167636bccedf01d6dc1b5d241aa3cf939ac84e Mon Sep 17 00:00:00 2001 From: Tobias Pape Date: Fri, 9 Feb 2024 15:52:55 +0100 Subject: [PATCH 4/8] [ci] update deps --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bcd2d08..22dae4e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Git repository - uses: actions/checkout@v2 + uses: actions/checkout@latest - name: Compile LaTeX document (PdfLaTeX) uses: dante-ev/latex-action@latest From 54d6ca82d8f9b74e18d43ce662b9cf0ad530a958 Mon Sep 17 00:00:00 2001 From: Tobias Pape Date: Fri, 9 Feb 2024 15:57:29 +0100 Subject: [PATCH 5/8] [ci] gh is picky --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 22dae4e..980b68d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Git repository - uses: actions/checkout@latest + uses: actions/checkout@v4 - name: Compile LaTeX document (PdfLaTeX) uses: dante-ev/latex-action@latest From 10753a7f5202a4a5e5d2f5cdcb15c4743e4fda89 Mon Sep 17 00:00:00 2001 From: Tobias Pape Date: Fri, 9 Feb 2024 16:01:33 +0100 Subject: [PATCH 6/8] since we're optionalising on ccicons, make that explicit was loaede with doclicense previously unconditionally --- example-programming.tex | 1 + 1 file changed, 1 insertion(+) diff --git a/example-programming.tex b/example-programming.tex index 987b980..82d272b 100644 --- a/example-programming.tex +++ b/example-programming.tex @@ -14,6 +14,7 @@ % These ones are used in the guide, replace with your own. % \usepackage{multicol} +\usepackage{ccicons} \lstdefinelanguage[programming]{TeX}[AlLaTeX]{TeX}{% deletetexcs={title,author,bibliography},% deletekeywords={tabular}, From 6e7af39dbac9209cdecd771ed88114b652a8883e Mon Sep 17 00:00:00 2001 From: Tobias Pape Date: Fri, 9 Feb 2024 16:26:51 +0100 Subject: [PATCH 7/8] [ci] use recommended build settings --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 980b68d..711a0bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,16 +13,16 @@ jobs: uses: dante-ev/latex-action@latest with: root_file: example-programming.tex - compiler: pdflatex + args: -pdflatex -latexoption=-file-line-error -latexoption=-interaction=nonstopmode - name: Compile LaTeX document (LuaLaTeX) uses: dante-ev/latex-action@latest with: root_file: example-programming.tex - compiler: lualatex + args: -lualatex -latexoption=-file-line-error -latexoption=-interaction=nonstopmode - name: Compile LaTeX document (XeLaTeX) uses: dante-ev/latex-action@latest with: root_file: example-programming.tex - compiler: xelatex + args: -xelatex -latexoption=-file-line-error -latexoption=-interaction=nonstopmode \ No newline at end of file From 7e4cdebe71fbaf791042b1e67b5329298948a970 Mon Sep 17 00:00:00 2001 From: Tobias Pape Date: Fri, 9 Feb 2024 17:04:54 +0100 Subject: [PATCH 8/8] This is 8.1 now --- programming.cls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programming.cls b/programming.cls index 30537c0..c3b9275 100644 --- a/programming.cls +++ b/programming.cls @@ -1,6 +1,6 @@ \NeedsTeXFormat{LaTeX2e}[2005/12/01] \def\P@banner{The Art, Science, and Engineering of Programming} -\def\P@version{8.0} +\def\P@version{8.1} \ProvidesClass{programming}% [2023/02/03 v\P@version ^^J Articles for \P@banner^^J]