A LaTeX style for producing author self-archiving copies of (academic) papers.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

328 lines
10 KiB

  1. %% Copyright (C) 2008-2019 Achim D. Brucker, https://www.brucker.ch
  2. %%
  3. %% License:
  4. %% This program can be redistributed and/or modified under the terms
  5. %% of the LaTeX Project Public License Distributed from CTAN
  6. %% archives in directory macros/latex/base/lppl.txt; either
  7. %% version 1.3c of the License, or (at your option) any later version.
  8. %% OR
  9. %% The 2-clause BSD-style license.
  10. %%
  11. %% SPDX-License-Identifier: LPPL-1.3c+ OR BSD-2-Clause
  12. \NeedsTeXFormat{LaTeX2e}\relax
  13. \ProvidesPackage{authorarchive}
  14. [0000/00/00 Unreleased v1.1.1+%
  15. Self-archiving information for scientific publications.]
  16. %
  17. \PassOptionsToPackage{hyphens}{url}
  18. %
  19. \RequirePackage{ifthen}
  20. \RequirePackage[inline]{enumitem}
  21. \RequirePackage{graphicx}
  22. \RequirePackage{eso-pic}
  23. \RequirePackage{intopdf}
  24. \RequirePackage{kvoptions}
  25. \RequirePackage{hyperref}
  26. \RequirePackage{calc}
  27. \RequirePackage{qrcode}
  28. \RequirePackage{dtk-logos}
  29. %
  30. %Better url breaking
  31. \g@addto@macro{\UrlBreaks}{\UrlOrds}
  32. %
  33. % Option declarations
  34. % -------------------
  35. \SetupKeyvalOptions{
  36. family=AA,
  37. prefix=AA@
  38. }
  39. %
  40. \DeclareStringOption[.]{bibtexdir}
  41. \DeclareStringOption[https://duckduckgo.com/?q=]{baseurl}
  42. \DeclareStringOption[.pdf]{suffix}
  43. \DeclareStringOption[UNKNOWN PUBLISHER]{publisher}[]
  44. \DeclareStringOption[UNKNOWN YEAR]{year}[]
  45. \DeclareStringOption[]{key}[]
  46. \DeclareStringOption[]{doi}[]
  47. \DeclareStringOption[]{doiText}[]
  48. \DeclareStringOption[]{publisherurl}[]
  49. \DeclareStringOption[UNKNOWN START PAGE]{startpage}[]
  50. \DeclareStringOption[UNKNOWN PUBLICATION]{publication}[]
  51. \DeclareBoolOption{ACM}
  52. \DeclareBoolOption{acmart}
  53. \DeclareBoolOption{ENTCS}
  54. \DeclareBoolOption{IEEE}
  55. \DeclareBoolOption{LNCS}
  56. \DeclareBoolOption{LNI}
  57. \DeclareBoolOption{nocopyright}
  58. \DeclareBoolOption{nourl}
  59. \DeclareBoolOption{nobib}
  60. \DeclareBoolOption{orcidicon}
  61. %\ProcessOptions\relax
  62. % Default option rule
  63. \DeclareDefaultOption{%
  64. \ifx\CurrentOptionValue\relax
  65. \PackageWarningNoLine{\@currname}{%
  66. Unknown option `\CurrentOption'\MessageBreak
  67. is passed to package `authorarchive'%
  68. }%
  69. % Pass the option to package color.
  70. % Again it is better to expand \CurrentOption.
  71. \expandafter\PassOptionsToPackage\expandafter{\CurrentOption}{color}%
  72. \else
  73. % Package color does not take options with values.
  74. % We provide the standard LaTeX error.
  75. \@unknownoptionerror
  76. \fi
  77. }
  78. \ProcessKeyvalOptions*
  79. % Provide command for dynamic configuration seutp
  80. \def\authorsetup{\kvsetkeys{AA}}
  81. % Load local configuration
  82. \InputIfFileExists{authorarchive.config}{}{}
  83. \newlength\AA@x
  84. \newlength\AA@y
  85. \newlength\AA@width
  86. \def\AA@bibBibTeX{\AA@bibtexdir/\AA@key.bib}
  87. \def\AA@bibBibTeXLong{\AA@bibtexdir/\AA@key.bibtex}
  88. \def\AA@bibWord{\AA@bibtexdir/\AA@key.word.xml}
  89. \def\AA@bibEndnote{\AA@bibtexdir/\AA@key.enw}
  90. \def\AA@bibRIS{\AA@bibtexdir/\AA@key.ris}
  91. \newboolean{AA@bibExists}
  92. \setboolean{AA@bibExists}{false}
  93. \IfFileExists{\AA@bibBibTeX}{\setboolean{AA@bibExists}{true}}{}
  94. \IfFileExists{\AA@bibBibTeXLong}{\setboolean{AA@bibExists}{true}}{}
  95. \IfFileExists{\AA@bibWord}{\setboolean{AA@bibExists}{true}}{}
  96. \IfFileExists{\AA@bibEndnote}{\setboolean{AA@bibExists}{true}}{}
  97. \IfFileExists{\AA@bibRIS}{\setboolean{AA@bibExists}{true}}{}
  98. \setlength\AA@x{1in+\hoffset+\oddsidemargin}
  99. \newcommand{\authorcrfont}{\footnotesize}
  100. \newcommand{\authorat}[1]{\AtPageUpperLeft{\put(\LenToUnit{\AA@x},\LenToUnit{.2cm-\paperheight}){#1}}}
  101. \newcommand{\authorwidth}[1]{\setlength{\AA@width}{#1}}
  102. \setlength{\AA@width}{\textwidth}
  103. \def\AA@pageinfo{}
  104. \ifthenelse{\equal{\AA@startpage}{UNKNOWN START PAGE}}{%
  105. }{%
  106. \setcounter{page}{\AA@startpage}%
  107. \def\AA@pageinfo{pp. \thepage--\pageref{\aa@lastpage}, }
  108. }
  109. %%%% sig-alternate.cls
  110. \ifAA@ACM%
  111. \ifthenelse{\equal{\AA@publisher}{UNKNOWN PUBLISHER}}{%
  112. \setkeys{AA}{publisher=ACM}
  113. }{}
  114. \global\boilerplate={}
  115. \global\copyrightetc={}
  116. \renewcommand{\conferenceinfo}[2]{}
  117. \renewcommand{\authorcrfont}{\scriptsize}
  118. \setlength\AA@x{1in+\hoffset+\oddsidemargin}
  119. \setlength\AA@y{-\textheight+\topmargin+\headheight-\footskip} % -\voffset-\topmargin-\headheight-\footskip}
  120. \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},\LenToUnit{\AA@y}){#1}}
  121. \setlength{\AA@width}{\columnwidth}
  122. \fi
  123. %
  124. %%%% acmart.cls
  125. \ifAA@acmart%
  126. \ifthenelse{\equal{\AA@publisher}{UNKNOWN PUBLISHER}}{%
  127. \setkeys{AA}{publisher=ACM}
  128. }{}
  129. \renewcommand{\authorat}[1]{\AtPageUpperLeft{\put(\LenToUnit{\AA@x},\LenToUnit{0.2cm-\paperheight}){#1}}}
  130. \setlength{\AA@width}{\textwidth}
  131. \fi
  132. %
  133. %%%% LNCS
  134. \ifAA@LNCS%
  135. \ifAA@orcidicon%
  136. \renewcommand{\orcidID}[1]{\href{https://orcid.org/#1}{%
  137. \textsuperscript{\,\includegraphics[height=2\fontcharht\font`A]{vector_iD_icon}}}}
  138. \else\relax\fi%
  139. %
  140. \ifthenelse{\equal{\AA@publisher}{UNKNOWN PUBLISHER}}{%
  141. \setkeys{AA}{publisher=Springer-Verlag}
  142. }{}
  143. \renewcommand{\authorcrfont}{\scriptsize}
  144. \@ifclasswith{llncs}{a4paper}{%
  145. \pdfpagesattr{/CropBox [92 114 523 780]}%
  146. \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},40){#1}}%
  147. }{%
  148. \pdfpagesattr{/CropBox [92 65 523 731]}% LNCS page: 152x235 mm
  149. \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},23){#1}}
  150. }
  151. \setlength{\AA@width}{\textwidth}
  152. \setcounter{tocdepth}{2}
  153. \fi
  154. %
  155. %%%% LNI
  156. \ifAA@LNI%
  157. \ifthenelse{\equal{\AA@publisher}{UNKNOWN PUBLISHER}}{%
  158. \setkeys{AA}{publisher=GI}
  159. }{}
  160. \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},35){#1}}
  161. \renewcommand{\authorcrfont}{\scriptsize}
  162. \pdfpagesattr{/CropBox [70 65 526.378 748.15]} % TODO
  163. \setlength{\AA@width}{\textwidth}
  164. \setcounter{tocdepth}{2}
  165. \fi
  166. %
  167. %%%% ENTCS
  168. \ifAA@ENTCS%
  169. \addtolength{\voffset}{1cm}
  170. \ifthenelse{\equal{\AA@publisher}{UNKNOWN PUBLISHER}}{%
  171. \setkeys{AA}{publisher=Elsevier Science B.~V.}
  172. }{}
  173. \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},\LenToUnit{-.5cm-\the\ht\AA@authoratBox}){#1}}
  174. \renewcommand{\authorcrfont}{\scriptsize}
  175. \setlength{\AA@width}{\textwidth}
  176. \fi
  177. %
  178. %%%% IEEE
  179. \ifAA@IEEE%
  180. \ifthenelse{\equal{\AA@publisher}{UNKNOWN PUBLISHER}}{%
  181. \setkeys{AA}{publisher=IEEE}
  182. }{}
  183. \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},6){#1}}
  184. \renewcommand{\authorcrfont}{\scriptsize}
  185. \setlength{\AA@width}{\textwidth}
  186. \setcounter{tocdepth}{2}
  187. \fi
  188. %
  189. \hypersetup{%
  190. draft = false,
  191. bookmarksopen = true,
  192. bookmarksnumbered= true,
  193. pdfauthor = {\@author},
  194. pdftitle = {\@title},
  195. }
  196. \@ifpackageloaded{totpages}{%
  197. \def\aa@lastpage{TotPages}
  198. }{%
  199. \RequirePackage{lastpage}
  200. \def\aa@lastpage{LastPage}
  201. }
  202. \newsavebox{\AA@authoratBox}
  203. \AddToShipoutPicture*{%
  204. \setlength{\unitlength}{1mm}%
  205. \savebox{\AA@authoratBox}{%
  206. \parbox{1.4cm}{%
  207. \bgroup%
  208. \normallineskiplimit=0pt%
  209. \ifAA@nourl%
  210. \ifx\AA@doi\@empty\relax%
  211. \else%
  212. \qrcode[hyperlink,height=1.17cm,padding]{https://doi.org/\AA@doi}%
  213. \fi%
  214. \else%
  215. \qrcode[hyperlink,height=1.17cm,padding]{\AA@baseurl/\AA@key\AA@suffix}%
  216. \fi%
  217. \egroup%
  218. }%
  219. \ifAA@nourl\ifx\AA@doi\@empty\addtolength{\AA@width}{1.4cm}\fi\fi
  220. \parbox{\AA@width-1.4cm}{\authorcrfont%
  221. \ifAA@LNCS%
  222. \AA@publication, \AA@pageinfo \AA@year. %
  223. \ifAA@nocopyright\else
  224. \textcopyright~\AA@year~\AA@publisher.
  225. \fi
  226. This is the author's
  227. version of the work. It is posted
  228. \ifAA@nourl\relax\else%
  229. at \url{\AA@baseurl/\AA@key\AA@suffix} %
  230. \fi
  231. \ifAA@nocopyright\relax\else
  232. by permission of \AA@publisher{}
  233. \fi
  234. for your personal use.
  235. \ifx\AA@doi\@empty%
  236. \relax
  237. \else
  238. The final publication is available at Springer via
  239. \ifx\AA@doiText\@empty%
  240. \url{https://doi.org/\AA@doi}.
  241. \else
  242. \href{https://doi.org/\AA@doi}{\AA@doiText}.
  243. \fi
  244. \fi
  245. \else
  246. \ifAA@nocopyright\relax\else
  247. \textcopyright~\AA@year~\AA@publisher. %
  248. \fi%
  249. This is the author's
  250. version of the work. It is posted
  251. \ifAA@nourl\relax\else%
  252. at \url{\AA@baseurl/\AA@key\AA@suffix} %
  253. \fi
  254. \ifAA@nocopyright\relax\else
  255. by permission of \AA@publisher{} %
  256. \fi
  257. for your personal use. Not for redistribution. The definitive
  258. version was published in \emph{\AA@publication}, \AA@pageinfo \AA@year%
  259. \ifx\AA@doi\@empty%
  260. \ifx\AA@publisherurl\@empty%
  261. .%
  262. \else
  263. \url{\AA@publisherurl}.%
  264. \fi
  265. \else
  266. \ifx\AA@doiText\@empty%
  267. , doi: \href{https://doi.org/\AA@doi}{\AA@doi}.%
  268. \else
  269. , doi: \href{https://doi.org/\AA@doi}{\AA@doiText}.%
  270. \fi
  271. \fi
  272. \fi
  273. \ifAA@nobib\relax\else%
  274. \ifthenelse{\boolean{AA@bibExists}}{%
  275. \hfill
  276. \begin{itemize*}[label={}, itemjoin={,}]
  277. \IfFileExists{\AA@bibBibTeX}{%
  278. \item \attachandlink{\AA@bibBibTeX}[application/x-bibtex]{BibTeX entry of this paper}{\BibTeX}%
  279. }{%
  280. \IfFileExists{\AA@bibBibTeXLong}{%
  281. \item \attachandlink[\AA@key.bib]{\AA@bibBibTeXLong}[application/x-bibtex]{BibTeX entry of this paper}{\BibTeX}%
  282. }{%
  283. \typeout{No file \AA@bibBibTeX{} (and no \AA@bibBibTeXLong) found. Not embedded reference in BibTeX format.}%
  284. }%
  285. }%
  286. \IfFileExists{\AA@bibWord}{%
  287. \item \attachandlink{\AA@bibWord}[application/xml]{XML entry of this paper (e.g., for Word 2007 and later)}{Word}%
  288. }{%
  289. \typeout{No file \AA@bibWord{} found. Not embedded reference for Word 2007 and later.}%
  290. }%
  291. \IfFileExists{\AA@bibEndnote}{%
  292. \item \attachandlink{\AA@bibEndnote}[application/x-endnote-refer]{Endnote entry of this paper}{EndNote}%
  293. }{%
  294. \typeout{No file \AA@bibEndnote{} found. Not embedded reference in Endnote format.}%
  295. }%
  296. \IfFileExists{\AA@bibRIS}{%
  297. \item \attachandlink{\AA@bibRIS}[application/x-research-info-systems]{RIS entry of this paper}{RIS}%
  298. }{%
  299. \typeout{No file \AA@bibRIS{} found. Not embedded reference in RIS format.}%
  300. }%
  301. \end{itemize*}\\
  302. }{%
  303. \PackageError{authorarchive}{No bibliographic files found. Specify option 'nobib' if this is intended.}
  304. }
  305. \fi
  306. }
  307. }
  308. \authorat{\raisebox{\the\ht\AA@authoratBox}{\usebox{\AA@authoratBox}}}
  309. }