authorarchive/authorarchive.sty

286 lines
9.1 KiB
Plaintext
Raw Normal View History

%% Copyright (C) 2008-2018 Achim D. Brucker, https://www.brucker.ch
2016-08-26 12:32:46 +00:00
%%
%% 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.
%% OR
%% The 2-clause BSD-style license.
\NeedsTeXFormat{LaTeX2e}\relax
\ProvidesPackage{authorarchive}
[2018/02/25 Unreleased v1.0.0+%
Self-archiving information for scientific publications.]
2016-08-26 12:32:46 +00:00
%
\RequirePackage{ifthen}
2018-02-26 14:14:48 +00:00
\RequirePackage[inline]{enumitem}
2016-08-26 12:32:46 +00:00
\RequirePackage{graphicx}
\RequirePackage{eso-pic}
2018-02-26 14:14:48 +00:00
\RequirePackage{attachfile}
2016-08-26 12:32:46 +00:00
\RequirePackage{kvoptions}
2018-02-26 14:14:48 +00:00
\RequirePackage{hyperref}
\RequirePackage{hypgotoe}
2016-08-26 12:32:46 +00:00
\RequirePackage{calc}
\RequirePackage{qrcode}
2018-02-26 14:14:48 +00:00
\RequirePackage{dtk-logos}
2016-08-26 12:32:46 +00:00
%
% Option declarations
% -------------------
\SetupKeyvalOptions{
family=AA,
prefix=AA@
}
\DeclareStringOption[.]{bibtexdir}
\DeclareStringOption[https://duckduckgo.com/?q=]{baseurl}
2016-08-26 12:32:46 +00:00
\DeclareStringOption[.pdf]{suffix}
\DeclareStringOption[UNKOWN PUBLISHER]{publisher}[]
\DeclareStringOption[UNKOWN YEAR]{year}[]
\DeclareStringOption[]{key}[]
\DeclareStringOption[]{doi}[]
\DeclareStringOption[]{doiText}[]
\DeclareStringOption[]{publisherurl}[]
\DeclareStringOption[1]{startpage}[]
\DeclareStringOption[UNKNOWN PUBLICATION]{publication}[]
\DeclareBoolOption{ACM}
2018-02-25 21:31:05 +00:00
\DeclareBoolOption{ENTCS}
2016-08-26 12:32:46 +00:00
\DeclareBoolOption{IEEE}
\DeclareBoolOption{LNCS}
\DeclareBoolOption{LNI}
\DeclareBoolOption{nocopyright}
\DeclareBoolOption{nourl}
\DeclareBoolOption{nobib}
%\ProcessOptions\relax
% Default option rule
\DeclareDefaultOption{%
\ifx\CurrentOptionValue\relax
\PackageWarningNoLine{\@currname}{%
Unknown option `\CurrentOption'\MessageBreak
is passed to package `authorarchive'%
}%
% Pass the option to package color.
% Again it is better to expand \CurrentOption.
\expandafter\PassOptionsToPackage\expandafter{\CurrentOption}{color}%
2016-08-26 12:32:46 +00:00
\else
% Package color does not take options with values.
% We provide the standard LaTeX error.
\@unknownoptionerror
2016-08-26 12:32:46 +00:00
\fi
}
\ProcessKeyvalOptions*
% Provide command for dynamic configuration seutp
\def\authorsetup{\kvsetkeys{AA}}
% Load local configuration
\InputIfFileExists{authorarchive.config}{}{}
2016-08-26 12:32:46 +00:00
\newlength\AA@x
\newlength\AA@y
\newlength\AA@width
2018-02-25 22:00:47 +00:00
\setlength\AA@x{1in+\hoffset+\oddsidemargin}
2016-08-26 12:32:46 +00:00
\newcommand{\authorcrfont}{\footnotesize}
2018-02-25 22:00:47 +00:00
\newcommand{\authorat}[1]{\AtPageUpperLeft{\put(\LenToUnit{\AA@x},\LenToUnit{-\paperheight}){#1}}}
2016-08-26 12:32:46 +00:00
\newcommand{\authorwidth}[1]{\setlength{\AA@width}{#1}}
\setlength{\AA@width}{\textwidth}
\setcounter{page}{\AA@startpage}
\ifAA@ACM%
\setkeys{AA}{publisher=ACM}
2018-02-26 08:01:42 +00:00
\renewcommand{\authorat}[1]{\AtPageUpperLeft{\put(\LenToUnit{\AA@x},\LenToUnit{-\paperheight}){#1}}}
\setlength{\AA@width}{\textwidth}
2016-08-26 12:32:46 +00:00
\fi
%%%% LNCS
\ifAA@LNCS%
\setkeys{AA}{publisher=Springer-Verlag}
\renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},27){#1}}
\renewcommand{\authorcrfont}{\scriptsize}
\pdfpagesattr{/CropBox [92 65 523 731]}% LNCS page: 152x235 mm
\setlength{\AA@width}{\textwidth}
\setcounter{tocdepth}{2}
2016-08-26 12:32:46 +00:00
\fi
%
%%%% LNI
\ifAA@LNI%
\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
\setlength{\AA@width}{\textwidth}
\setcounter{tocdepth}{2}
2016-08-26 12:32:46 +00:00
\fi
%
%%%% ENTCS
\ifAA@ENTCS%
\addtolength{\voffset}{1cm}
\setkeys{AA}{publisher=Elsevier Science B.~V.}
\renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},-250){#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}
2016-08-26 12:32:46 +00:00
\fi
%
%%%% IEEE
\ifAA@IEEE%
\setkeys{AA}{publisher=IEEE Computer Society}
\renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},12){#1}}
\renewcommand{\authorcrfont}{\scriptsize}
\setlength{\AA@width}{\textwidth}
\setcounter{tocdepth}{2}
2016-08-26 12:32:46 +00:00
\fi
%
\hypersetup{%
draft = false,
bookmarksopen = true,
bookmarksnumbered= true,
pdfauthor = {\@author},
pdftitle = {\@title},
}
\AtEndDocument{\label{LastPage}}
\AddToShipoutPicture*{%
\setlength{\unitlength}{1mm}%
\authorat{%
2018-02-25 21:02:08 +00:00
\ifAA@nourl%
\ifx\AA@doi\@empty%
\hspace{0.585cm}
\else%
\raisebox{.5cm}[.5cm]{\qrcode[hyperlink,height=1.17cm,padding]{https://doi.org/\AA@doi}}%
\fi%
\else%
\raisebox{.5cm}[.5cm]{\qrcode[hyperlink,height=1.17cm,padding]{\AA@baseurl/\AA@key\AA@suffix}}%
\fi%
2016-08-26 12:32:46 +00:00
\authorcrfont\parbox[b]{\AA@width-1.4cm}{
\ifAA@LNCS%
\AA@publication, pp. \thepage--\pageref{LastPage}, \AA@year.
\ifAA@nocopyright\relax\else
\textcopyright~\AA@year~\AA@publisher.
\fi
2016-08-26 12:32:46 +00:00
This is the author's
version of the work. It is posted
\ifAA@nourl\relax\else%
at \url{\AA@baseurl/\AA@key\AA@suffix} %
2016-08-26 12:32:46 +00:00
\fi
\ifAA@nocopyright\relax\else
by permission of \AA@publisher{}
2016-08-26 12:32:46 +00:00
\fi
for your personal use.
\ifx\AA@doi\@empty%
\relax
\else
The final publication is available at Springer via
\ifx\AA@doiText\@empty%
\url{https://doi.org/\AA@doi}.
2016-08-26 12:32:46 +00:00
\else
\href{https://doi.org/\AA@doi}{\AA@doiText}.
2016-08-26 12:32:46 +00:00
\fi
\fi
2016-08-26 12:32:46 +00:00
\else
\ifAA@nocopyright\relax\else
\textcopyright~\AA@year~\AA@publisher. %
2016-08-26 12:32:46 +00:00
\fi%
This is the author's
version of the work. It is posted
\ifAA@nourl\relax\else%
at \url{\AA@baseurl/\AA@key\AA@suffix} %
2016-08-26 12:32:46 +00:00
\fi
\ifAA@nocopyright\relax\else
by permission of \AA@publisher{} %
2016-08-26 12:32:46 +00:00
\fi
for your personal use. Not for redistribution. The definitive
2018-01-28 19:18:42 +00:00
version was published in \emph{\AA@publication}, pp.~\thepage--\pageref{LastPage}, \AA@year%
2016-08-26 12:32:46 +00:00
\ifx\AA@doi\@empty%
\ifx\AA@publisherurl\@empty%
.%
\else
\url{\AA@publisherurl}.%
\fi
\else
\ifx\AA@doiText\@empty%
, doi: \href{https://doi.org/\AA@doi}{\AA@doi}.%
2016-08-26 12:32:46 +00:00
\else
, doi: \href{https://doi.org/\AA@doi}{\AA@doiText}.%
2016-08-26 12:32:46 +00:00
\fi
\fi
2016-08-26 12:32:46 +00:00
\fi
2018-02-26 14:14:48 +00:00
\ifAA@nobib\relax\else%
\hfill
% We need "doubleprint", because the text of \textattachfile is not printed when printing a PDF
% We use the idea from https://tex.stackexchange.com/a/19045/9075, accepting that
% the pointers to the files are renderedin semi-bold way
\newlength{\Urlname}
\newcommand{\doubleprint}[1]{\setlength{\Urlname}{\widthof{#1}}\hspace{-\Urlname}#1}
\begin{itemize*}[label={}, itemjoin={,}]
\IfFileExists{\AA@bibtexdir/\AA@key.bib}{%
\item \textattachfile[%
print=true,%
color=0 0 0,%
icon=Paperclip,%
description={BibTeX entry of this paper},%
mimetype=application/x-bibtex%
]{\AA@bibtexdir/\AA@key.bib}{\BibTeX}%
\doubleprint{\BibTeX}
}{
\typeout{No file \AA@bibtexdir/\AA@key.bib found. Not embedded reference in BibTeX format.}
}
\IfFileExists{\AA@bibtexdir/\AA@key.word.xml}{%
\item \textattachfile[%
print=true,%
color=0 0 0,%
icon=Paperclip,%
description={XML entry of this paper (e.g., for Word 2007 and later)},%
mimetype=application/xml%
]{\AA@bibtexdir/\AA@key.word.xml}{Word}%
\doubleprint{Word}
}{
\typeout{No file \AA@bibtexdir/\AA@key.word.xml found. Not embedded reference for Word 2007 and later.}
}
\IfFileExists{\AA@bibtexdir/\AA@key.enw}{%
\item \textattachfile[%
print=true,%
color=0 0 0,%
icon=Paperclip,%
description={Endnote entry of this paper},%
mimetype=application/x-endnote-refer%
]{\AA@bibtexdir/\AA@key.enw}{EndNote}%
\doubleprint{EndNote}
}{
\typeout{No file \AA@bibtexdir/\AA@key.enw found. Not embedded reference in Endnote format.}
}
\IfFileExists{\AA@bibtexdir/\AA@key.ris}{%
\item \textattachfile[%
print=true,%
color=0 0 0,%
icon=Paperclip,%
description={RIS entry of this paper},%
mimetype=application/x-research-info-systems%
]{\AA@bibtexdir/\AA@key.ris}{RIS}%
\doubleprint{RIS}
}{
\typeout{No file \AA@bibtexdir/\AA@key.ris found. Not embedded reference in RIS format.}
}
\end{itemize*}
\fi
2016-08-26 12:32:46 +00:00
}
}
}