summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/authorarchive/authorarchive.sty
blob: 6493c16f37d540266dc48edde968103528e1bdae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
%% Copyright (C) 2008-2018 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.
%%   OR
%%   The 2-clause BSD-style license.
\NeedsTeXFormat{LaTeX2e}\relax
\ProvidesClass{authorarchive}
  [2018/02/21 v1.0.0%
  Self-archiving information for scientific publications.]
%
\RequirePackage{ifthen}
\RequirePackage{graphicx}
\RequirePackage{hyperref}
\RequirePackage{eso-pic}
\RequirePackage{embedfile}
\RequirePackage{kvoptions}
\RequirePackage{calc}
\RequirePackage{qrcode}
%
% Option declarations
% -------------------
\SetupKeyvalOptions{
  family=AA,
  prefix=AA@
}

\DeclareStringOption[.]{bibtexdir}
\DeclareStringOption[https://duckduckgo.com/?q=]{baseurl}
\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}
\DeclareBoolOption{IEEE}
\DeclareBoolOption{LNCS}
\DeclareBoolOption{LNI}
\DeclareBoolOption{nocopyright}
\DeclareBoolOption{nourl}
\DeclareBoolOption{nobib}
\DeclareBoolOption{ENTCS}
%\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}%
  \else
    % Package color does not take options with values.
    % We provide the standard LaTeX error.
    \@unknownoptionerror
  \fi
}
\ProcessKeyvalOptions*

% Provide command for dynamic configuration seutp
\def\authorsetup{\kvsetkeys{AA}}

% Load local configuration
\InputIfFileExists{authorarchive.config}{}{}


\newlength\AA@x
\newlength\AA@y
\newlength\AA@width

\newcommand{\authorcrfont}{\footnotesize}
\newcommand{\authorat}[1]{\put(100,100){#1}}
\newcommand{\authorwidth}[1]{\setlength{\AA@width}{#1}}
\setlength{\AA@width}{\textwidth}

\setcounter{page}{\AA@startpage}

\ifAA@ACM%
  \setkeys{AA}{publisher=ACM}
  \global\boilerplate={}
  \global\copyrightetc={}
  \renewcommand{\conferenceinfo}[2]{}
  \renewcommand{\authorcrfont}{\crnotice}
  \setlength\AA@x{1in+\hoffset+\oddsidemargin}
  \setlength\AA@y{-\textheight+\topmargin+\headheight} % -\voffset-\topmargin-\headheight-\footskip}
  \renewcommand{\authorat}[1]{\put(\LenToUnit{\AA@x},\LenToUnit{\AA@y}){#1}}
  \setlength{\AA@width}{\columnwidth}
\fi
%%%% LNCS
\ifAA@LNCS%
  \setkeys{AA}{publisher=Springer-Verlag}
  \setlength\AA@x{1in+\hoffset+\oddsidemargin}
  \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}
\fi
%
%%%% LNI
\ifAA@LNI%
  \setkeys{AA}{publisher=GI}
  \setlength\AA@x{1in+\hoffset+\oddsidemargin}
  \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}
\fi
%
%%%% 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}}
  \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}}
  \renewcommand{\authorcrfont}{\scriptsize}
  \setlength{\AA@width}{\textwidth}
  \setcounter{tocdepth}{2}
\fi
%

\hypersetup{%
  draft         = false,
  bookmarksopen = true,
  bookmarksnumbered= true,
  pdfauthor     = {\@author},
  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}}

\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}{
      \ifAA@LNCS%
        \AA@publication, pp. \thepage--\pageref{LastPage}, \AA@year.\\%
        \ifAA@nocopyright\relax\else
          \textcopyright~\AA@year~\AA@publisher.
        \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} %
        \fi
        \ifAA@nocopyright\relax\else
          by permission of \AA@publisher{}
        \fi
        for your personal use.
        \ifx\AA@doi\@empty%
          \relax
        \else
          The definitive
          version was published with doi:
          \ifx\AA@doiText\@empty%
            \href{https://doi.org/\AA@doi}{\AA@doi}.
          \else
            \href{https://doi.org/\AA@doi}{\AA@doiText}.
          \fi
        \fi
      \else
        \ifAA@nocopyright\relax\else
          \textcopyright~\AA@year~\AA@publisher. %
        \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} %
        \fi
        \ifAA@nocopyright\relax\else
          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%
        \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}.%
          \else
            , doi: \href{https://doi.org/\AA@doi}{\AA@doiText}.%
          \fi
        \fi
      \fi
    }
  }
}