summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/osda/osda.sty
blob: f7ba34fafda772452b028d10917b4b063f132019 (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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
%%
%% This is file `osda.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% osda.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2023-2024 by Christian Krieg <christian@osda.ws>
%% 
%% This work (excluding the OSDA logo) may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%% 
%% The OSDA logo is a trademark of Christian Krieg and may only be used and/or
%% distributed in order to refer to the Workshop on Open-Source Design Automation.
%% Any other use is subject to prior written permission.
%% 
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{osda}
    [2024/05/01 v1.4.0 OSDA copyright notice generator]


\RequirePackage[hang,flushmargin]{footmisc}%
\RequirePackage{flushend}%
\RequirePackage{ifthen}%
\RequirePackage{qrcode}%
\RequirePackage{xcolor}%
\RequirePackage{hyperref}%
\hypersetup{%
colorlinks = true,%
allcolors  = black,%
}%
\RequirePackage{tikz}%
\RequirePackage{pgfopts}%

\newcommand{\osdaset}[1]{\pgfkeys{/osda/.cd,#1}}

%%
%% Specify booleans
%%
\newif\ifosda@auto
%%
%% Define keys to manage package and command options
%%
\pgfkeys {
    /osda/.cd,
    paper/url/.store in = \osda@paper@url,
    url/.forward to = /osda/paper/url,
    paper/doi/.store in = \osda@paper@doi,
    doi/.forward to = /osda/paper/doi,
    license/version/.store in = \osda@license@version,
    license/url/.store in = \osda@license@url,
    license/long/.store in = \osda@license@long,
    license/short/.store in = \osda@license@short,
    proceedings/title/.store in = \osda@proceedings@title,
    proceedings/startpage/.store in = \osda@proceedings@startpage,
    proceedings/endpage/.store in = \osda@proceedings@endpage,
    pages/.code 2 args={\osdaset{proceedings/startpage=#1,proceedings/endpage=#2}},
    workshop/counter/.store in = \osda@workshop@counter,
    workshop/longname/.store in = \osda@workshop@longname,
    workshop/acronym/.store in = \osda@workshop@acronym,
    location/city/.store in = \osda@location@city,
    location/country/.store in = \osda@location@country,
    date/month/.store in = \osda@date@month,
    date/day/.store in = \osda@date@day,
    date/year/.store in = \osda@date@year,
    hostconference/longname/.store in = \osda@hostconference@longname,
    hostconference/acronym/.store in = \osda@hostconference@acronym,
}
%%
%% Set boolean flags
%%
\pgfkeys {
    /osda/.cd,
    auto/.is if=osda@auto,
}
%%
%% Specify default values
%%
\pgfkeys {
    /osda/.cd,
    auto = true,
    license/version = ,
    license/url = ,
    license/long = \textbf{\textcolor{red}{{Please specify a license}}},
    license/short = ,
    proceedings/startpage = ,
    proceedings/endpage = ,
    paper/url = https://please.specify.the/url/here,
    paper/doi = ,
}
%%
%% Define some useful styles
%%
\pgfkeys {
    /osda/.cd,
    %
    % Default values for specific editions of OSDA
    %
    2024/.style={
        proceedings/title = Proceedings of the 4th Workshop on Open-Source Design Automation (OSDA),
        workshop/counter = 4th,
        workshop/longname = Workshop on Open-Source Design Automation,
        workshop/acronym = OSDA,
        location/city = Valencia,
        location/country = Spain,
        date/month = March,
        date/day = 25,
        date/year = 2024,
        hostconference/longname = {Design, Automation, and Test in Europe Conference},
        hostconference/acronym = DATE,
    },
    2023/.style={
        proceedings/title = Proceedings of the 3rd Workshop on Open-Source Design Automation (OSDA),
        workshop/counter = 3rd,
        workshop/longname = Workshop on Open-Source Design Automation,
        workshop/acronym = OSDA,
        location/city = Antwerp,
        location/country = Belgium,
        date/month = April,
        date/day = 17,
        date/year = 2023,
        hostconference/longname = {Design, Automation, and Test in Europe Conference},
        hostconference/acronym = DATE,
    },
    2020/.style={
        proceedings/title = Proceedings of the 2nd Workshop on Open-Source Design Automation (OSDA),
        workshop/counter = 2nd,
        workshop/longname = Workshop on Open-Source Design Automation,
        workshop/acronym = OSDA,
        location/city = Grenoble,
        location/country = France,
        date/month = March,
        date/day = 13,
        date/year = 2020,
        hostconference/longname = {Design, Automation, and Test in Europe Conference},
        hostconference/acronym = DATE,
    },
    2019/.style={
        proceedings/title = Proceedings of the 1st Workshop on Open-Source Design Automation (OSDA),
        workshop/counter = 1st,
        workshop/longname = Workshop on Open-Source Design Automation,
        workshop/acronym = OSDA,
        location/city = Florence,
        location/country = Italy,
        date/month = March,
        date/day = 29,
        date/year = 2019,
        hostconference/longname = {Design, Automation, and Test in Europe Conference},
        hostconference/acronym = DATE,
    },
    %
    % Licenses
    %
    cc-by/.style={
        license/version = 4.0,
        license/url = https://creativecommons.org/licenses/by/4.0,
        license/long = Creative Commons Attribution license,
        license/short = CC BY,
    },
    cc-by-sa/.style={
        license/version = 4.0,
        license/url = https://creativecommons.org/licenses/by-sa/4.0,
        license/long = Creative Commons Attribution-ShareAlike license,
        license/short = CC BY-SA,
    },
    cc-by-nc-sa/.style={
        license/version = 4.0,
        license/url = https://creativecommons.org/licenses/by-nc-sa/4.0,
        license/long = Creative Commons Attribution-Noncommercial-ShareAlike license,
        license/short = CC BY-NC-SA,
    },
    cc-by-nc-nd/.style={
        license/version = 4.0,
        license/url = https://creativecommons.org/licenses/by-nc-nd/4.0,
        license/long = Creative Commons Attribution-Noncommercial-NoDerivatives license,
        license/short = CC BY-NC-ND,
    },
    arXiv/.style={
        license/version = 1.0,
        license/url = https://arxiv.org/licenses/nonexclusive-distrib/1.0,
        license/long = {arXiv.org perpetual, non-exclusive license},
        license/short =,
    },
    cc0/.style={
        license/version =,
        license/url = https://creativecommons.org/share-your-work/public-domain/cc0,
        license/long = Public Domain license,
        license/short = CC0,
    },
}
%%
%% We now process the options passed to the package.
%%
\ProcessPgfOptions{/osda}
%%
%% The margin defines the space between the logo's right/QR code's left side and
%% the text of the copyright notice
%%
\newlength{\osda@margin}
%%
%% |\WrapLR|
%%
%% Command to place two figures wrapped around text; we use it here for the OSDA
%% logo and the QR code that links to the paper in the acknowledgments box in the
%% footnote of the title page
%%
%% Usage:
%%
%%     \WrapLR{\includegraphics[height=1.2in]{example-image-a}}%
%%         {\includegraphics[height=1.2in]{example-image-b}}%
%%         {\noindent Text to wrap around images}
%%
%% Adapted from: https://tex.stackexchange.com/a/455612
%%
%%
\newcommand*{\WrapLR}[3]% #1=left image, #2=right image, #3=text (1 paragraph)
{\bgroup
  \sbox0{\raisebox{-\height}{#1}}% align tops
  \sbox1{\raisebox{-\height}{#2}}% measure width and height (depth)
  \sbox2{\raisebox{\depth}{\makebox[\columnwidth]{\usebox0\hfill\usebox1}}}% total height
  \par\noindent\usebox2\vspace{\dimexpr \ht\strutbox-\ht2-\baselineskip-\parskip}\par% overlay pictures
  \setlength{\osda@margin}{2ex}
  \dimen0=\dimexpr \wd0+.5\osda@margin\relax% indent
  \dimen1=\dimexpr \columnwidth-\wd0-\wd1-\osda@margin\relax% width
  \edef\shape{\the\dimen0 \the\dimen1}% set up \parshape arguments in loop
  \dimen2=\ht\strutbox
  \dimen4=\dimexpr \ht2-.5\baselineskip\relax
  \count1=2
  \loop\ifdim\dimen2<\dimen4
    \advance\dimen2 by \baselineskip
    \ifdim\dimen2>\dp0\relax% end of left image
      \dimen0=0pt
      \dimen1=\dimexpr \columnwidth-\wd1-.5\osda@margin\relax
    \fi
    \ifdim\dimen2>\dp1\relax% end of right image
      \dimen1=\dimexpr \columnwidth-\wd0-.5\osda@margin\relax
    \fi
    \advance\count1 by 1
    \edef\shape{\shape\space\the\dimen0 \the\dimen1}%
  \repeat
  \edef\shape{\the\count1 \space\shape\space 0pt \the\columnwidth}%
  \parshape=\shape
  #3\par
\egroup}
%% |\blfootnote|
%%
%% Set footnotes without marks
%%
%% Usage:
%%
%%     |\blfootnote{footnotetext}|
%%
%% From: https://tex.stackexchange.com/a/30726
%%
\newcommand\blfootnote[1]{%
  \begingroup
  \renewcommand\thefootnote{}\footnote{#1}%
  \addtocounter{footnote}{-1}%
  \endgroup
}
%%
%% |\osdalogo|
%%
%% Draws the OSDA logo at a given height
%%
%% Usage:
%%
%%     |\osdalogo{height}|
%%
%% Example:
%%
%%     |\osdalogo{2\baselineskip}|
%%
\usetikzlibrary{svg.path}
\newcommand{\osdalogo}[1]{\scalebox{1}[-1]{\resizebox*{!}{#1}{%
\begin{tikzpicture}%
    \pgfpathsvg{m 41.493525,114.88969 c -4.235403,-0.0951 -5.244524,4.38987 -4.853967,7.74446 0.06465,11.92294 -0.129872,23.85884 0.09828,35.77361 0.660896,3.83742 4.80625,4.07909 7.908947,3.87335 36.559883,0 73.119765,0 109.679645,0 4.2354,0.0951 5.24452,-4.38987 4.85397,-7.74445 -0.0647,-11.92294 0.12987,-23.85884 -0.0983,-35.77361 -0.6609,-3.83742 -4.80625,-4.07909 -7.90895,-3.87336 -36.55988,0 -73.119759,0 -109.679642,0 z m 15.406294,9.3338 c 7.083699,-0.16814 13.650363,5.59034 14.408423,12.6354 0.773555,-7.32725 7.848415,-13.19963 15.192447,-12.61203 5.305345,0.24729 10.291595,3.68656 12.407418,8.55802 -4.449622,-0.0531 -9.052306,0.10604 -13.406456,-0.0794 -0.839139,-2.90692 -5.235964,-3.40946 -6.707523,-0.76424 -1.678739,2.40924 0.506129,6.05789 3.422128,5.71655 1.497283,-0.0812 2.873132,-1.15803 3.311785,-2.59192 4.718573,0 9.43715,0 14.155724,0 0.08339,-2.35529 -0.165262,-4.8569 0.121518,-7.12255 5.339507,-5.05446 14.506947,-4.9329 19.710957,0.26069 2.32206,2.20209 3.8742,5.19535 4.33608,8.36202 0.90939,-7.27195 8.02238,-12.99336 15.31906,-12.32891 7.37799,0.33186 13.674,7.07245 13.50245,14.45591 0.0496,5.18443 -2.94531,10.24647 -7.51324,12.69897 -1.2907,-3.10635 -2.86729,-6.27677 -3.98135,-9.34353 2.57226,-2.09161 1.63297,-6.69649 -1.5515,-7.61542 -3.0763,-1.19911 -6.61783,1.86093 -5.86635,5.08096 0.22078,1.22057 0.97501,2.33122 2.02814,2.98654 -1.33651,3.06304 -2.67302,6.12607 -4.00953,9.18911 -4.21173,-2.03739 -7.27498,-6.23733 -7.9282,-10.87014 -0.9141,7.33051 -8.13486,13.07383 -15.48271,12.31672 -3.21287,-0.24801 -6.32487,-1.6114 -8.68532,-3.8051 0,-2.30873 0,-4.61746 0,-6.92619 -1.727782,7.19313 -9.563391,12.09549 -16.787442,10.50764 -4.612862,-0.86727 -8.678534,-4.13841 -10.513216,-8.45867 4.434157,0.0533 9.021826,-0.10629 13.360463,0.0794 0.820198,2.82501 5.042639,3.41435 6.604149,0.92056 1.808231,-2.33495 -0.226145,-6.10845 -3.171246,-5.87992 -1.550448,0.0211 -3.007434,1.11568 -3.459292,2.59898 -4.701352,0 -9.402702,0 -14.104054,0 -0.258707,-1.27682 -0.309266,-2.11823 -0.532659,-0.32786 -1.436394,7.22593 -9.014468,12.43124 -16.274501,11.17924 -7.328434,-0.91683 -13.068091,-8.13653 -12.311164,-15.48257 0.464997,-7.3576 7.032469,-13.43953 14.405011,-13.33826 z m 52.620561,9.99112 c -0.96292,0.0502 -2.60046,0.17595 -2.09755,1.57043 0.0567,2.29818 -0.11186,4.73381 0.0816,6.94851 2.876,1.60884 6.79391,-0.92082 6.51013,-4.20444 -0.0576,-2.3593 -2.13312,-4.35301 -4.49417,-4.3145 z m -52.58387,5.3e-4 c -3.299763,-0.14891 -5.665574,3.88662 -3.923721,6.69319 1.479497,2.95488 6.158026,3.05141 7.757886,0.15973 1.863071,-2.9074 -0.372921,-6.91859 -3.834165,-6.85292 z}%
    \pgfusepath{fill}%
    \pgfusepath{stroke}%
\end{tikzpicture}%
}}}
%%
%% |\osda|
%%
%% This command prints the OSDA logo inline at a height of 1ex
%%
%% Usage:
%%
%%     |\osda{}|
%%
\newcommand{\osda}{\raisebox{.6\baselineskip}{\osdalogo{.7\baselineskip}}}
%%
%% |\osdanotice|
%%
%% This command sets the OSDA copyright notice, taking a URL as argument to set
%% links to the paper's web page, and to create a QR code from.
%%
%% Usage:
%%
%%     |\osdanotice{url}|
%%
%% Example:
%%
%%     |\osdanotice{https://osda.ws}|
%%
\newcommand{\osdanotice}[1][]{
\osdaset{#1}
\WrapLR%
    {\href{\osda@paper@url}{\osdalogo{1.8\baselineskip}}}
    {\qrcode[height=3.8\baselineskip,level=L,version=1]{\osda@paper@url}}
    {\noindent%
        This work was presented at the \emph{\osda@workshop@counter{}
        \osda@workshop@longname{} (\osda@workshop@acronym) \osda@date@year{}},
        \ifthenelse{\isundefined{\osda@hostconference@longname}}{%
        }{%
            co-hosted with \emph{\osda@hostconference@longname} %
            \ifthenelse{\isundefined{\osda@hostconference@acronym}}{%
            }{%
                \emph{(\osda@hostconference@acronym)}
            }%
            \ifthenelse{\isundefined{\osda@date@year}}{%
            }{%
                \emph{\osda@date@year}
            }%
        }%
        in \osda@location@city{}, \osda@location@country{}, on
        \osda@date@month{} \osda@date@day{}, \osda@date@year{}.  For further
        information and material, please visit the paper's web page on the
        workshop website at \href{\osda@paper@url}{\textbf{\osda@paper@url}}
        (just scan the QR code on the right).
        %
        % Copyright and license information
        %
        The copyright is retained by the authors.
        This work is licensed under the terms of the
        \osda@license@long
        \ifthenelse{\isundefined{\osda@license@short} \or \equal{\osda@license@short}{}}{%
        }{ %
            (\osda@license@short)%
        }%
        \ifthenelse{\isundefined{\osda@license@version} \or \equal{\osda@license@version}{}}{%
        }{, %
            version \osda@license@version%
        }%
        \ifthenelse{\isundefined{\osda@license@url} \or \equal{\osda@license@url}{}}{%
        }{, %
            see \href{\osda@license@url}{\osda@license@url}%
        }%
        %
        .
        \emph{\osda@proceedings@title},
        Pages \osda@proceedings@startpage--\osda@proceedings@endpage, \osda@date@year.
        \ifthenelse{\isundefined{\osda@paper@doi} \or \equal{\osda@paper@doi}{}}{%
        }{%
            DOI: \href{https://doi.org/\osda@paper@doi}{\osda@paper@doi}%
        }%
    }%
}
%%
%% |\osdafootnote|
%%
%% This command sets the OSDA copyright notice in an un-numbered footnote.
%%
%% Usage:
%%
%%     |\osdafootnote{url}|
%%
%% Example:
%%
%%     |\osdafootnote{https://osda.ws}|
%%
\newcommand{\osdafootnote}[1][]{
    \osdaset{#1}
    \blfootnote{\osdanotice\vspace{-1.5\baselineskip}}%

}
%%
%% |\maketitle|
%%
%% Re-defining the \maketitle command to automatically place the copyright notice
%% once the paper title is generated
%%
\let\maketitle@orig\maketitle
\renewcommand{\maketitle}{%
    \ifosda@auto%
        \maketitle@orig\osdafootnote%
    \else%
        \maketitle@orig%
    \fi%
}
\endinput
%%
%% End of file `osda.sty'.