From d13f4aa60ac176e565e64bddd1c59f089551b2d0 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sun, 23 Jun 2019 20:57:00 +0000
Subject: authorarchive (23jun19)

git-svn-id: svn://tug.org/texlive/trunk@51430 c570f23f-e606-0410-a88d-b1316a301751
---
 .../tex/latex/authorarchive/authorarchive.sty      | 238 +++++++++++++--------
 1 file changed, 151 insertions(+), 87 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/authorarchive/authorarchive.sty')

diff --git a/Master/texmf-dist/tex/latex/authorarchive/authorarchive.sty b/Master/texmf-dist/tex/latex/authorarchive/authorarchive.sty
index 6493c16f37d..41534ebd125 100644
--- a/Master/texmf-dist/tex/latex/authorarchive/authorarchive.sty
+++ b/Master/texmf-dist/tex/latex/authorarchive/authorarchive.sty
@@ -1,25 +1,34 @@
-%% Copyright (C) 2008-2018 Achim D. Brucker, https://www.brucker.ch
+%% Copyright (C) 2008-2019 Achim D. Brucker, https://www.brucker.ch
 %%
 %% License:
 %%   This program can be redistributed and/or modified under the terms
 %%   of the LaTeX Project Public License Distributed from CTAN
 %%   archives in directory macros/latex/base/lppl.txt; either
-%%   version 1 of the License, or any later version.
+%%   version 1.3c of the License, or (at your option) any later version.
 %%   OR
 %%   The 2-clause BSD-style license.
+%%
+%%   SPDX-License-Identifier: LPPL-1.3c+ OR BSD-2-Clause
 \NeedsTeXFormat{LaTeX2e}\relax
-\ProvidesClass{authorarchive}
-  [2018/02/21 v1.0.0%
+\ProvidesPackage{authorarchive}
+  [2019/06/23 v1.1.1%
   Self-archiving information for scientific publications.]
 %
+\PassOptionsToPackage{hyphens}{url}
+%
 \RequirePackage{ifthen}
+\RequirePackage[inline]{enumitem}
 \RequirePackage{graphicx}
-\RequirePackage{hyperref}
 \RequirePackage{eso-pic}
-\RequirePackage{embedfile}
+\RequirePackage{intopdf}
 \RequirePackage{kvoptions}
+\RequirePackage{hyperref}
 \RequirePackage{calc}
 \RequirePackage{qrcode}
+\RequirePackage{dtk-logos}
+%
+%Better url breaking
+\g@addto@macro{\UrlBreaks}{\UrlOrds}
 %
 % Option declarations
 % -------------------
@@ -27,27 +36,29 @@
   family=AA,
   prefix=AA@
 }
-
+%
 \DeclareStringOption[.]{bibtexdir}
 \DeclareStringOption[https://duckduckgo.com/?q=]{baseurl}
 \DeclareStringOption[.pdf]{suffix}
-\DeclareStringOption[UNKOWN PUBLISHER]{publisher}[]
-\DeclareStringOption[UNKOWN YEAR]{year}[]
+\DeclareStringOption[UNKNOWN PUBLISHER]{publisher}[]
+\DeclareStringOption[UNKNOWN YEAR]{year}[]
 \DeclareStringOption[]{key}[]
 \DeclareStringOption[]{doi}[]
 \DeclareStringOption[]{doiText}[]
 \DeclareStringOption[]{publisherurl}[]
-\DeclareStringOption[1]{startpage}[]
+\DeclareStringOption[UNKNOWN START PAGE]{startpage}[]
 \DeclareStringOption[UNKNOWN PUBLICATION]{publication}[]
 
 \DeclareBoolOption{ACM}
+\DeclareBoolOption{acmart}
+\DeclareBoolOption{ENTCS}
 \DeclareBoolOption{IEEE}
 \DeclareBoolOption{LNCS}
 \DeclareBoolOption{LNI}
 \DeclareBoolOption{nocopyright}
 \DeclareBoolOption{nourl}
 \DeclareBoolOption{nobib}
-\DeclareBoolOption{ENTCS}
+\DeclareBoolOption{orcidicon}
 %\ProcessOptions\relax
 
 
@@ -80,39 +91,87 @@
 \newlength\AA@y
 \newlength\AA@width
 
+\def\AA@bibBibTeX{\AA@bibtexdir/\AA@key.bib}
+\def\AA@bibBibTeXLong{\AA@bibtexdir/\AA@key.bibtex}
+\def\AA@bibWord{\AA@bibtexdir/\AA@key.word.xml}
+\def\AA@bibEndnote{\AA@bibtexdir/\AA@key.enw}
+\def\AA@bibRIS{\AA@bibtexdir/\AA@key.ris}
+
+\newboolean{AA@bibExists}
+\setboolean{AA@bibExists}{false}
+\IfFileExists{\AA@bibBibTeX}{\setboolean{AA@bibExists}{true}}{}
+\IfFileExists{\AA@bibBibTeXLong}{\setboolean{AA@bibExists}{true}}{}
+\IfFileExists{\AA@bibWord}{\setboolean{AA@bibExists}{true}}{}
+\IfFileExists{\AA@bibEndnote}{\setboolean{AA@bibExists}{true}}{}
+\IfFileExists{\AA@bibRIS}{\setboolean{AA@bibExists}{true}}{}
+
+\setlength\AA@x{1in+\hoffset+\oddsidemargin}
+
 \newcommand{\authorcrfont}{\footnotesize}
-\newcommand{\authorat}[1]{\put(100,100){#1}}
+\newcommand{\authorat}[1]{\AtPageUpperLeft{\put(\LenToUnit{\AA@x},\LenToUnit{.2cm-\paperheight}){#1}}}
 \newcommand{\authorwidth}[1]{\setlength{\AA@width}{#1}}
 \setlength{\AA@width}{\textwidth}
 
-\setcounter{page}{\AA@startpage}
+\def\AA@pageinfo{}
+\ifthenelse{\equal{\AA@startpage}{UNKNOWN START PAGE}}{%
+}{%
+  \setcounter{page}{\AA@startpage}%
+  \def\AA@pageinfo{pp. \thepage--\pageref{\aa@lastpage}, }
+}
+
 
+
+%%%% sig-alternate.cls
 \ifAA@ACM%
-  \setkeys{AA}{publisher=ACM}
+  \ifthenelse{\equal{\AA@publisher}{UNKNOWN PUBLISHER}}{%
+    \setkeys{AA}{publisher=ACM}
+  }{}
   \global\boilerplate={}
   \global\copyrightetc={}
   \renewcommand{\conferenceinfo}[2]{}
-  \renewcommand{\authorcrfont}{\crnotice}
+  \renewcommand{\authorcrfont}{\scriptsize}
   \setlength\AA@x{1in+\hoffset+\oddsidemargin}
-  \setlength\AA@y{-\textheight+\topmargin+\headheight} % -\voffset-\topmargin-\headheight-\footskip}
+  \setlength\AA@y{-\textheight+\topmargin+\headheight-\footskip} % -\voffset-\topmargin-\headheight-\footskip}
   \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},\LenToUnit{\AA@y}){#1}}
   \setlength{\AA@width}{\columnwidth}
 \fi
+%
+%%%% acmart.cls
+\ifAA@acmart%
+  \ifthenelse{\equal{\AA@publisher}{UNKNOWN PUBLISHER}}{%
+    \setkeys{AA}{publisher=ACM}
+  }{}
+  \renewcommand{\authorat}[1]{\AtPageUpperLeft{\put(\LenToUnit{\AA@x},\LenToUnit{0.2cm-\paperheight}){#1}}}
+  \setlength{\AA@width}{\textwidth}
+\fi
+%
 %%%% LNCS
 \ifAA@LNCS%
-  \setkeys{AA}{publisher=Springer-Verlag}
-  \setlength\AA@x{1in+\hoffset+\oddsidemargin}
-  \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},27){#1}}
+  \ifAA@orcidicon%
+    \renewcommand{\orcidID}[1]{\href{https://orcid.org/#1}{%
+      \textsuperscript{\,\includegraphics[height=2\fontcharht\font`A]{vector_iD_icon}}}}
+  \else\relax\fi%
+%  
+  \ifthenelse{\equal{\AA@publisher}{UNKNOWN PUBLISHER}}{%
+    \setkeys{AA}{publisher=Springer-Verlag}
+  }{}
   \renewcommand{\authorcrfont}{\scriptsize}
-  \pdfpagesattr{/CropBox [92 65 523 731]}% LNCS page: 152x235 mm
+  \@ifclasswith{llncs}{a4paper}{%
+    \pdfpagesattr{/CropBox [92 114 523 780]}%
+    \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},40){#1}}%
+  }{%
+    \pdfpagesattr{/CropBox [92 65 523 731]}% LNCS page: 152x235 mm
+    \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},23){#1}}
+  }
   \setlength{\AA@width}{\textwidth}
   \setcounter{tocdepth}{2}
 \fi
 %
 %%%% LNI
 \ifAA@LNI%
-  \setkeys{AA}{publisher=GI}
-  \setlength\AA@x{1in+\hoffset+\oddsidemargin}
+  \ifthenelse{\equal{\AA@publisher}{UNKNOWN PUBLISHER}}{%
+    \setkeys{AA}{publisher=GI}
+  }{}
   \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},35){#1}}
   \renewcommand{\authorcrfont}{\scriptsize}
   \pdfpagesattr{/CropBox [70 65 526.378 748.15]} % TODO
@@ -123,29 +182,20 @@
 %%%% ENTCS
 \ifAA@ENTCS%
   \addtolength{\voffset}{1cm}
-  \setkeys{AA}{publisher=Elsevier Science B.~V.}
-  \setlength\AA@x{1in+\hoffset+\oddsidemargin}
-  \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},-250){#1}}
+  \ifthenelse{\equal{\AA@publisher}{UNKNOWN PUBLISHER}}{%
+    \setkeys{AA}{publisher=Elsevier Science B.~V.}
+  }{}
+  \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},\LenToUnit{-.5cm-\the\ht\AA@authoratBox}){#1}}
   \renewcommand{\authorcrfont}{\scriptsize}
-  \def\@oddfoot{}
-  \def\@evenfoot{}
-  \def\firstfootline{}
-  \headsep 8pt
-  \renewcommand\rightheadline{\ifnum\value{page}=\hypergetpageref{FirstPage}\relax
-    \else{\hfil\scriptsize\emph{\lastname / \AA@publication} \hfil {\rmfamily\thepage}}\fi}
-  \renewcommand\leftheadline{\scriptsize{\rmfamily\thepage} \hfil \emph{\lastname /
-      \AA@publication}\hfil}
-  %  467.717 x 680.315 pts
-  % \pdfpagesattr{/CropBox [70 110 535 850]}
-  \pdfpagesattr{/CropBox [70 95 535 775]}
   \setlength{\AA@width}{\textwidth}
 \fi
 %
 %%%% IEEE
 \ifAA@IEEE%
-  \setkeys{AA}{publisher=IEEE Computer Society}
-  \setlength\AA@x{1in+\hoffset+\oddsidemargin}
-  \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},12){#1}}
+  \ifthenelse{\equal{\AA@publisher}{UNKNOWN PUBLISHER}}{%
+    \setkeys{AA}{publisher=IEEE}
+  }{}
+  \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},6){#1}}
   \renewcommand{\authorcrfont}{\scriptsize}
   \setlength{\AA@width}{\textwidth}
   \setcounter{tocdepth}{2}
@@ -160,54 +210,35 @@
   pdftitle      = {\@title},
 }
 
-\ifAA@nobib\relax\else%
-  \AtBeginDocument{%
-    \IfFileExists{\AA@bibtexdir/\AA@key.bib}{%
-      \embedfile[filespec=\AA@key.bib,%
-        desc={BibTeX entry of this paper.},%
-        stringmethod=escape,%
-        mimetype=plain/text,%
-      ]{\AA@bibtexdir/\AA@key.bib}}{
-      \typeout{No file \AA@bibtexdir/\AA@key.bib found. Not embedded reference in BibTeX format.}
-    }%
-    \IfFileExists{\AA@bibtexdir/\AA@key.enw}{%
-      \embedfile[filespec=\AA@key.enw,%
-        desc={Endnote entry of this paper.},%
-        stringmethod=escape,%
-        mimetype=plain/text,%
-      ]{\AA@bibtexdir/\AA@key.enw}}{
-      \typeout{No file \AA@bibtexdir/\AA@key.enw found. Not embedded reference in Endnote format.}
-    }%
-    \IfFileExists{\AA@bibtexdir/\AA@key.ris}{%
-      \embedfile[filespec=\AA@key.ris,%
-        desc={RIS entry of this paper.},%
-        stringmethod=escape,%
-        mimetype=plain/text,%
-      ]{\AA@bibtexdir/\AA@key.ris}}{
-      \typeout{No file \AA@bibtexdir/\AA@key.ris found. Not embedded reference in RIS format.}
-    }%
-    \IfFileExists{\AA@bibtexdir/\AA@key.word.xml}{%
-      \embedfile[filespec=\AA@key.word.xml,%
-        desc={XML entry of this paper (e.g., for Word 2007 and later).},%
-        stringmethod=escape,%
-        mimetype=plain/text,%
-      ]{\AA@bibtexdir/\AA@key.word.xml}}{
-      \typeout{No file \AA@bibtexdir/\AA@key.word.xml found. Not embedded reference for Word 2007 and later.}
-    }%
-  }%
-\fi
-\AtEndDocument{\label{LastPage}}
+\@ifpackageloaded{totpages}{%
+  \def\aa@lastpage{TotPages}
+}{%
+  \RequirePackage{lastpage}
+  \def\aa@lastpage{LastPage}
+}
+\newsavebox{\AA@authoratBox}
 
 \AddToShipoutPicture*{%
   \setlength{\unitlength}{1mm}%
-  \authorat{%
-    \ifAA@nourl\relax\else%
-      \raisebox{.5cm}[.5cm]{\qrcode[hyperlink,height=1.17cm,padding]{\AA@baseurl/\AA@key\AA@suffix}}%
-    \fi%
-    \authorcrfont\parbox[b]{\AA@width-1.4cm}{
+  \savebox{\AA@authoratBox}{%
+    \parbox{1.4cm}{%
+      \bgroup%
+        \normallineskiplimit=0pt%
+        \ifAA@nourl%
+           \ifx\AA@doi\@empty\relax%
+           \else%
+              \qrcode[hyperlink,height=1.17cm,padding]{https://doi.org/\AA@doi}%
+            \fi%
+        \else%
+          \qrcode[hyperlink,height=1.17cm,padding]{\AA@baseurl/\AA@key\AA@suffix}%
+        \fi%
+      \egroup%
+    }%
+    \ifAA@nourl\ifx\AA@doi\@empty\addtolength{\AA@width}{1.4cm}\fi\fi
+    \parbox{\AA@width-1.4cm}{\authorcrfont%
       \ifAA@LNCS%
-        \AA@publication, pp. \thepage--\pageref{LastPage}, \AA@year.\\%
-        \ifAA@nocopyright\relax\else
+        \AA@publication, \AA@pageinfo  \AA@year. %
+        \ifAA@nocopyright\else
           \textcopyright~\AA@year~\AA@publisher.
         \fi
         This is the author's
@@ -222,10 +253,9 @@
         \ifx\AA@doi\@empty%
           \relax
         \else
-          The definitive
-          version was published with doi:
+          The final publication is available at Springer via
           \ifx\AA@doiText\@empty%
-            \href{https://doi.org/\AA@doi}{\AA@doi}.
+            \url{https://doi.org/\AA@doi}.
           \else
             \href{https://doi.org/\AA@doi}{\AA@doiText}.
           \fi
@@ -243,7 +273,7 @@
           by permission of \AA@publisher{} %
         \fi
         for your personal use. Not for redistribution. The definitive
-        version was published in \emph{\AA@publication}, pp.~\thepage--\pageref{LastPage}, \AA@year%
+        version was published in \emph{\AA@publication}, \AA@pageinfo \AA@year%
         \ifx\AA@doi\@empty%
           \ifx\AA@publisherurl\@empty%
             .%
@@ -258,6 +288,40 @@
           \fi
         \fi
       \fi
+      \ifAA@nobib\relax\else%
+        \ifthenelse{\boolean{AA@bibExists}}{%
+          \hfill
+          \begin{itemize*}[label={}, itemjoin={,}]
+            \IfFileExists{\AA@bibBibTeX}{%
+              \item \attachandlink{\AA@bibBibTeX}[application/x-bibtex]{BibTeX entry of this paper}{\BibTeX}%
+            }{%
+              \IfFileExists{\AA@bibBibTeXLong}{%
+                \item \attachandlink[\AA@key.bib]{\AA@bibBibTeXLong}[application/x-bibtex]{BibTeX entry of this paper}{\BibTeX}%
+              }{%
+                \typeout{No file \AA@bibBibTeX{} (and no \AA@bibBibTeXLong) found. Not embedded reference in BibTeX format.}%
+              }%
+            }%
+            \IfFileExists{\AA@bibWord}{%
+              \item \attachandlink{\AA@bibWord}[application/xml]{XML entry of this paper (e.g., for Word 2007 and later)}{Word}%
+            }{%
+              \typeout{No file \AA@bibWord{} found. Not embedded reference for Word 2007 and later.}%
+            }%
+            \IfFileExists{\AA@bibEndnote}{%
+              \item \attachandlink{\AA@bibEndnote}[application/x-endnote-refer]{Endnote entry of this paper}{EndNote}%
+            }{%
+              \typeout{No file \AA@bibEndnote{} found. Not embedded reference in Endnote format.}%
+            }%
+            \IfFileExists{\AA@bibRIS}{%
+              \item \attachandlink{\AA@bibRIS}[application/x-research-info-systems]{RIS entry of this paper}{RIS}%
+            }{%
+              \typeout{No file \AA@bibRIS{} found. Not embedded reference in RIS format.}%
+            }%
+          \end{itemize*}\\
+        }{%
+          \PackageError{authorarchive}{No bibliographic files found. Specify option 'nobib' if this is intended.}
+        }
+      \fi
     }
   }
+  \authorat{\raisebox{\the\ht\AA@authoratBox}{\usebox{\AA@authoratBox}}}
 }
-- 
cgit v1.2.3

