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.
 
 
 

264 lines
8.1 KiB

  1. %% Copyright (C) 2008-2018 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 of the License, or any later version.
  8. %% OR
  9. %% The 2-clause BSD-style license.
  10. \NeedsTeXFormat{LaTeX2e}\relax
  11. \ProvidesClass{authorarchive}
  12. [2018/02/21 v1.0.0%
  13. Self-archiving information for scientific publications.]
  14. %
  15. \RequirePackage{ifthen}
  16. \RequirePackage{graphicx}
  17. \RequirePackage{hyperref}
  18. \RequirePackage{eso-pic}
  19. \RequirePackage{embedfile}
  20. \RequirePackage{kvoptions}
  21. \RequirePackage{calc}
  22. \RequirePackage{qrcode}
  23. %
  24. % Option declarations
  25. % -------------------
  26. \SetupKeyvalOptions{
  27. family=AA,
  28. prefix=AA@
  29. }
  30. \DeclareStringOption[.]{bibtexdir}
  31. \DeclareStringOption[https://duckduckgo.com/?q=]{baseurl}
  32. \DeclareStringOption[.pdf]{suffix}
  33. \DeclareStringOption[UNKOWN PUBLISHER]{publisher}[]
  34. \DeclareStringOption[UNKOWN YEAR]{year}[]
  35. \DeclareStringOption[]{key}[]
  36. \DeclareStringOption[]{doi}[]
  37. \DeclareStringOption[]{doiText}[]
  38. \DeclareStringOption[]{publisherurl}[]
  39. \DeclareStringOption[1]{startpage}[]
  40. \DeclareStringOption[UNKNOWN PUBLICATION]{publication}[]
  41. \DeclareBoolOption{ACM}
  42. \DeclareBoolOption{IEEE}
  43. \DeclareBoolOption{LNCS}
  44. \DeclareBoolOption{LNI}
  45. \DeclareBoolOption{nocopyright}
  46. \DeclareBoolOption{nourl}
  47. \DeclareBoolOption{nobib}
  48. \DeclareBoolOption{ENTCS}
  49. %\ProcessOptions\relax
  50. % Default option rule
  51. \DeclareDefaultOption{%
  52. \ifx\CurrentOptionValue\relax
  53. \PackageWarningNoLine{\@currname}{%
  54. Unknown option `\CurrentOption'\MessageBreak
  55. is passed to package `authorarchive'%
  56. }%
  57. % Pass the option to package color.
  58. % Again it is better to expand \CurrentOption.
  59. \expandafter\PassOptionsToPackage\expandafter{\CurrentOption}{color}%
  60. \else
  61. % Package color does not take options with values.
  62. % We provide the standard LaTeX error.
  63. \@unknownoptionerror
  64. \fi
  65. }
  66. \ProcessKeyvalOptions*
  67. % Provide command for dynamic configuration seutp
  68. \def\authorsetup{\kvsetkeys{AA}}
  69. % Load local configuration
  70. \InputIfFileExists{authorarchive.config}{}{}
  71. \newlength\AA@x
  72. \newlength\AA@y
  73. \newlength\AA@width
  74. \newcommand{\authorcrfont}{\footnotesize}
  75. \newcommand{\authorat}[1]{\put(100,100){#1}}
  76. \newcommand{\authorwidth}[1]{\setlength{\AA@width}{#1}}
  77. \setlength{\AA@width}{\textwidth}
  78. \setcounter{page}{\AA@startpage}
  79. \ifAA@ACM%
  80. \setkeys{AA}{publisher=ACM}
  81. \global\boilerplate={}
  82. \global\copyrightetc={}
  83. \renewcommand{\conferenceinfo}[2]{}
  84. \renewcommand{\authorcrfont}{\crnotice}
  85. \setlength\AA@x{1in+\hoffset+\oddsidemargin}
  86. \setlength\AA@y{-\textheight+\topmargin+\headheight} % -\voffset-\topmargin-\headheight-\footskip}
  87. \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},\LenToUnit{\AA@y}){#1}}
  88. \setlength{\AA@width}{\columnwidth}
  89. \fi
  90. %%%% LNCS
  91. \ifAA@LNCS%
  92. \setkeys{AA}{publisher=Springer-Verlag}
  93. \setlength\AA@x{1in+\hoffset+\oddsidemargin}
  94. \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},27){#1}}
  95. \renewcommand{\authorcrfont}{\scriptsize}
  96. \pdfpagesattr{/CropBox [92 65 523 731]}% LNCS page: 152x235 mm
  97. \setlength{\AA@width}{\textwidth}
  98. \setcounter{tocdepth}{2}
  99. \fi
  100. %
  101. %%%% LNI
  102. \ifAA@LNI%
  103. \setkeys{AA}{publisher=GI}
  104. \setlength\AA@x{1in+\hoffset+\oddsidemargin}
  105. \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},35){#1}}
  106. \renewcommand{\authorcrfont}{\scriptsize}
  107. \pdfpagesattr{/CropBox [70 65 526.378 748.15]} % TODO
  108. \setlength{\AA@width}{\textwidth}
  109. \setcounter{tocdepth}{2}
  110. \fi
  111. %
  112. %%%% ENTCS
  113. \ifAA@ENTCS%
  114. \addtolength{\voffset}{1cm}
  115. \setkeys{AA}{publisher=Elsevier Science B.~V.}
  116. \setlength\AA@x{1in+\hoffset+\oddsidemargin}
  117. \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},-250){#1}}
  118. \renewcommand{\authorcrfont}{\scriptsize}
  119. \def\@oddfoot{}
  120. \def\@evenfoot{}
  121. \def\firstfootline{}
  122. \headsep 8pt
  123. \renewcommand\rightheadline{\ifnum\value{page}=\hypergetpageref{FirstPage}\relax
  124. \else{\hfil\scriptsize\emph{\lastname / \AA@publication} \hfil {\rmfamily\thepage}}\fi}
  125. \renewcommand\leftheadline{\scriptsize{\rmfamily\thepage} \hfil \emph{\lastname /
  126. \AA@publication}\hfil}
  127. % 467.717 x 680.315 pts
  128. % \pdfpagesattr{/CropBox [70 110 535 850]}
  129. \pdfpagesattr{/CropBox [70 95 535 775]}
  130. \setlength{\AA@width}{\textwidth}
  131. \fi
  132. %
  133. %%%% IEEE
  134. \ifAA@IEEE%
  135. \setkeys{AA}{publisher=IEEE Computer Society}
  136. \setlength\AA@x{1in+\hoffset+\oddsidemargin}
  137. \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},12){#1}}
  138. \renewcommand{\authorcrfont}{\scriptsize}
  139. \setlength{\AA@width}{\textwidth}
  140. \setcounter{tocdepth}{2}
  141. \fi
  142. %
  143. \hypersetup{%
  144. draft = false,
  145. bookmarksopen = true,
  146. bookmarksnumbered= true,
  147. pdfauthor = {\@author},
  148. pdftitle = {\@title},
  149. }
  150. \ifAA@nobib\relax\else%
  151. \AtBeginDocument{%
  152. \IfFileExists{\AA@bibtexdir/\AA@key.bib}{%
  153. \embedfile[filespec=\AA@key.bib,%
  154. desc={BibTeX entry of this paper.},%
  155. stringmethod=escape,%
  156. mimetype=plain/text,%
  157. ]{\AA@bibtexdir/\AA@key.bib}}{
  158. \typeout{No file \AA@bibtexdir/\AA@key.bib found. Not embedded reference in BibTeX format.}
  159. }%
  160. \IfFileExists{\AA@bibtexdir/\AA@key.enw}{%
  161. \embedfile[filespec=\AA@key.enw,%
  162. desc={Endnote entry of this paper.},%
  163. stringmethod=escape,%
  164. mimetype=plain/text,%
  165. ]{\AA@bibtexdir/\AA@key.enw}}{
  166. \typeout{No file \AA@bibtexdir/\AA@key.enw found. Not embedded reference in Endnote format.}
  167. }%
  168. \IfFileExists{\AA@bibtexdir/\AA@key.ris}{%
  169. \embedfile[filespec=\AA@key.ris,%
  170. desc={RIS entry of this paper.},%
  171. stringmethod=escape,%
  172. mimetype=plain/text,%
  173. ]{\AA@bibtexdir/\AA@key.ris}}{
  174. \typeout{No file \AA@bibtexdir/\AA@key.ris found. Not embedded reference in RIS format.}
  175. }%
  176. \IfFileExists{\AA@bibtexdir/\AA@key.word.xml}{%
  177. \embedfile[filespec=\AA@key.word.xml,%
  178. desc={XML entry of this paper (e.g., for Word 2007 and later).},%
  179. stringmethod=escape,%
  180. mimetype=plain/text,%
  181. ]{\AA@bibtexdir/\AA@key.word.xml}}{
  182. \typeout{No file \AA@bibtexdir/\AA@key.word.xml found. Not embedded reference for Word 2007 and later.}
  183. }%
  184. }%
  185. \fi
  186. \AtEndDocument{\label{LastPage}}
  187. \AddToShipoutPicture*{%
  188. \setlength{\unitlength}{1mm}%
  189. \authorat{%
  190. \ifAA@nourl\relax\else%
  191. \raisebox{.5cm}[.5cm]{\qrcode[hyperlink,height=1.17cm,padding]{\AA@baseurl/\AA@key\AA@suffix}}%
  192. \fi%
  193. \authorcrfont\parbox[b]{\AA@width-1.4cm}{
  194. \ifAA@LNCS%
  195. \AA@publication, pp. \thepage--\pageref{LastPage}, \AA@year.\\%
  196. \ifAA@nocopyright\relax\else
  197. \textcopyright~\AA@year~\AA@publisher.
  198. \fi
  199. This is the author's
  200. version of the work. It is posted
  201. \ifAA@nourl\relax\else%
  202. at \url{\AA@baseurl/\AA@key\AA@suffix} %
  203. \fi
  204. \ifAA@nocopyright\relax\else
  205. by permission of \AA@publisher{}
  206. \fi
  207. for your personal use.
  208. \ifx\AA@doi\@empty%
  209. \relax
  210. \else
  211. The definitive
  212. version was published with doi:
  213. \ifx\AA@doiText\@empty%
  214. \href{https://doi.org/\AA@doi}{\AA@doi}.
  215. \else
  216. \href{https://doi.org/\AA@doi}{\AA@doiText}.
  217. \fi
  218. \fi
  219. \else
  220. \ifAA@nocopyright\relax\else
  221. \textcopyright~\AA@year~\AA@publisher. %
  222. \fi%
  223. This is the author's
  224. version of the work. It is posted
  225. \ifAA@nourl\relax\else%
  226. at \url{\AA@baseurl/\AA@key\AA@suffix} %
  227. \fi
  228. \ifAA@nocopyright\relax\else
  229. by permission of \AA@publisher{} %
  230. \fi
  231. for your personal use. Not for redistribution. The definitive
  232. version was published in \emph{\AA@publication}, pp.~\thepage--\pageref{LastPage}, \AA@year%
  233. \ifx\AA@doi\@empty%
  234. \ifx\AA@publisherurl\@empty%
  235. .%
  236. \else
  237. \url{\AA@publisherurl}.%
  238. \fi
  239. \else
  240. \ifx\AA@doiText\@empty%
  241. , doi: \href{https://doi.org/\AA@doi}{\AA@doi}.%
  242. \else
  243. , doi: \href{https://doi.org/\AA@doi}{\AA@doiText}.%
  244. \fi
  245. \fi
  246. \fi
  247. }
  248. }
  249. }