summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/rorlink/rorlink.dtx
blob: 2a5daca2ef511841c7d30dc7443df0e2e871f93e (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
% \iffalse meta-comment
%
% Copyright (C) 2023 by Florian Lukas <florian.lukas@dainst.de>
% ---------------------------------------------------------------------------
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% 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.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Florian Lukas.
%
% This work consists of the files rorlink.dtx and rorlink.ins
% and the derived filebase rorlink.sty.
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{rorlink.dtx}
%</driver>
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{rorlink}
%<*package>
    [2023/06/23 1.1.0 Linked ROR logo macro package]
%</package>
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{rorlink}[2023/06/15]
\usepackage{orcidlink}
\usepackage{xurl}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{rorlink.dtx}
  \PrintChanges
  \PrintIndex
\end{document}
%</driver>
% \fi
%
% \CheckSum{62}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
%
% \changes{1.0.0}{2023/06/15}{Build documentation and sty}
% \changes{1.1.0}{2023/06/23}{Updated command syntax and implementation of optional arguments for a black and white logo}
%
% \DoNotIndex{\newcommand,\newenvironment}
%
% \providecommand*{\url}{\texttt}
% \GetFileInfo{rorlink.dtx}
% \title{The \textsf{rorlink} package}
% \author{Florian Lukas\,\orcidlink{0000-0002-7959-5494}\,\rorlink{https://ror.org/02rspp784}\thanks{The code is mainly derived from the \href{https://github.com/duetosymmetry/orcidlink-LaTeX-command}{\textbf{orcidlink}} package maintained by Leo Stein. The code of the orcidlink package itself rests mainly on th \href{https://tex.stackexchange.com/questions/445563/ieeetran-how-to-include-orcid-in-tex-pdf-with-pdflatex/445583\#445583}{tex.SE answer} by user Milo} \\ \href{mailto:florian.lukas@dainst.de}{florian.lukas@dainst.de}}
% \date{\fileversion~from \filedate}
%
% \maketitle
%
%Repo: \url{https://gitlab.com/lukeflo/rorlink-latex-package}
%
% \section{Introduction}
%
% This package provides a simple command for creating a \href{https://ror.org/}{ROR} (Research Organization Registry) symbol including a link to the given ROR-ID -- very similar to the \href{https://github.com/duetosymmetry/orcidlink-LaTeX-command}{\textbf{orcidlink}} package.
%
% \section{Usage}
%
% The package can be included in the praeambel like any other package:
%\begin{verbatim}
%	\usepackage{rorlink}
%\end{verbatim}
%
%\DescribeMacro{\rorlink\marg{ror-link}}
%Use the command to create a small ROR symbol which is linked to the given ROR-URL. For example, |\rorlink{https://ror.org/00rcxh774}| will create a linked symbol to the ID of the \textit{University of Cologne}.
%
%You can include it into the document title using it inside the |\author{names}| command, as I did for this documentation:
%\begin{verbatim}
%\author{Florian Lukas\,\orcidlink{0000-0002-7959-5494}\,\rorlink{https://ror.org/02rspp784}}
%\end{verbatim}
%
%Furthermore, it can be included into larger macros; for instance, to create an author section with all necessary informations of the contributors:
%
%
%
%\section{Optional Arguments}
%
%There are two possibilities of using an optional argument |blackwhite|
%
%\DescribeMacro{\usepackage[blackwhite]{rorlink}}\par
%The option |blackwhite| can be set globally in the praeambel. Then every ROR link will appear in black and white only.
%
%\DescribeMacro{\rorlink[blackwhite]\marg{ror-link}}\par
%The option |blackwhite| can be set as argument if you use the |\rorlink| macro inline. Then only the current symbol will appear in black and white.
%
%\section{Required Packages}
% 
%\begin{description}
%	\item[hyperref] Needed to use the symbol as a link to the particular ROR webpage.
%	\item[tikz] Is used to draw the ROR symbol using the svg-path method and process the image, when the |\rorlink| command is called. 
%	\item[etoolbox] For the conditioning of the optional argument uses in inline commands.
%\end{description}
%
% \StopEventually{}
%
% \section{Implementation}
%
% \iffalse
%<*package>
% \fi
%
%% Required packages
%    \begin{macrocode}
\RequirePackage{hyperref}
\RequirePackage{tikz}
\RequirePackage{xparse}
\RequirePackage{etoolbox}
%    \end{macrocode}
%% Set standard color of the ROR institution
%	\begin{macrocode}
\definecolor{rorlogocol}{HTML}{53BAA1}
%	\end{macrocode}
%% Set global option |blackwhite| for depicting the logo only in black and white.
%	\begin{macrocode}
\DeclareOption{blackwhite}{\definecolor{rorlogocol}{HTML}{000000}}
\DeclareOption*{\PackageWarning{rorlink}{Unknown option -- \CurrentOption --}}
\ProcessOptions\relax
%    \end{macrocode}
%% Load tikz library for processing svg-paths.
%	\begin{macrocode}
\usetikzlibrary{svg.path}
%    \end{macrocode}
%% The original svg-path received from the file \url{https://raw.githubusercontent.com/ror-community/ror-logos/main/ror-icon-rgb.svg}
%    \begin{macrocode}
\tikzset{
	rorlogo/.pic={
		\fill[rorlogocol] svg{M68.65,4.16L56.52,22.74L44.38,4.16L68.65,4.16Z}
		svg{M119.41,4.16L107.28,22.74L95.14,4.16L119.41,4.16Z}
		svg{M44.38,115.47L56.52,96.88L68.65,115.47L44.38,115.47Z}
		svg{M95.14,115.47L107.28,96.88L119.41,115.47L95.14,115.47Z};
		\fill[black] svg{M145.53,63.71C149.83,62.91 153.1,61 155.33,57.99C157.57,54.98 158.68,51.32 158.68,47.03C158.68,43.47 158.06,40.51 156.83,38.13C155.6,35.75 153.93,33.86 151.84,32.45C149.75,31.05 147.31,30.04 144.53,29.44C141.75,28.84 138.81,28.54 135.72,28.54L112.16,28.54L112.16,47.37C111.97,46.82 111.77,46.28 111.55,45.74C109.92,41.79 107.64,38.42 104.71,35.64C101.78,32.86 98.32,30.72 94.3,29.23C90.29,27.74 85.9,26.99 81.14,26.99C76.38,26.99 72,27.74 67.98,29.23C63.97,30.72 60.5,32.86 57.57,35.64C54.95,38.13 52.85,41.1 51.27,44.54C51.04,42.07 50.46,39.93 49.53,38.13C48.3,35.75 46.63,33.86 44.54,32.45C42.45,31.05 40.01,30.04 37.23,29.44C34.45,28.84 31.51,28.54 28.42,28.54L4.87,28.54L4.87,89.42L18.28,89.42L18.28,65.08L24.9,65.08L37.63,89.42L53.71,89.42L38.24,63.71C42.54,62.91 45.81,61 48.04,57.99C48.14,57.85 48.23,57.7 48.33,57.56C48.31,58.03 48.3,58.5 48.3,58.98C48.3,63.85 49.12,68.27 50.75,72.22C52.38,76.17 54.66,79.54 57.59,82.32C60.51,85.1 63.98,87.24 68,88.73C72.01,90.22 76.4,90.97 81.16,90.97C85.92,90.97 90.3,90.22 94.32,88.73C98.33,87.24 101.8,85.1 104.73,82.32C107.65,79.54 109.93,76.17 111.57,72.22C111.79,71.69 111.99,71.14 112.18,70.59L112.18,89.42L125.59,89.42L125.59,65.08L132.21,65.08L144.94,89.42L161.02,89.42L145.53,63.71ZM36.39,50.81C35.67,51.73 34.77,52.4 33.68,52.83C32.59,53.26 31.37,53.52 30.03,53.6C28.68,53.69 27.41,53.73 26.2,53.73L18.29,53.73L18.29,39.89L27.06,39.89C28.26,39.89 29.5,39.98 30.76,40.15C32.02,40.32 33.14,40.65 34.11,41.14C35.08,41.63 35.89,42.33 36.52,43.25C37.15,44.17 37.47,45.4 37.47,46.95C37.47,48.6 37.11,49.89 36.39,50.81ZM98.74,66.85C97.85,69.23 96.58,71.29 94.91,73.04C93.25,74.79 91.26,76.15 88.93,77.13C86.61,78.11 84.01,78.59 81.15,78.59C78.28,78.59 75.69,78.1 73.37,77.13C71.05,76.16 69.06,74.79 67.39,73.04C65.73,71.29 64.45,69.23 63.56,66.85C62.67,64.47 62.23,61.85 62.23,58.98C62.23,56.17 62.67,53.56 63.56,51.15C64.45,48.74 65.72,46.67 67.39,44.92C69.05,43.17 71.04,41.81 73.37,40.83C75.69,39.86 78.28,39.37 81.15,39.37C84.02,39.37 86.61,39.86 88.93,40.83C91.25,41.8 93.24,43.17 94.91,44.92C96.57,46.67 97.85,48.75 98.74,51.15C99.63,53.56 100.07,56.17 100.07,58.98C100.07,61.85 99.63,64.47 98.74,66.85ZM143.68,50.81C142.96,51.73 142.06,52.4 140.97,52.83C139.88,53.26 138.66,53.52 137.32,53.6C135.97,53.69 134.7,53.73 133.49,53.73L125.58,53.73L125.58,39.89L134.35,39.89C135.55,39.89 136.79,39.98 138.05,40.15C139.31,40.32 140.43,40.65 141.4,41.14C142.37,41.63 143.18,42.33 143.81,43.25C144.44,44.17 144.76,45.4 144.76,46.95C144.76,48.6 144.4,49.89 143.68,50.81Z};
	}
}
%    \end{macrocode}
%
% 
%% The original height of the svg file is 119.27pt. The macro here uses 1/119.27 as unit.
%    \begin{macrocode}
\newcommand{\@OrigHeightRecipROR}{0.008384338}
%    \end{macrocode}
% 
%
%% The logo is adjusted to the used font size and an optional option |blackwhite| for depicting the logo in only black and white colors is set.
%    \begin{macrocode}
\newlength{\@curXheightROR}
\DeclareDocumentCommand\rorlink{om}{%
	\IfNoValueTF{#1}{%
		\texorpdfstring{%
			\setlength{\@curXheightROR}{\fontcharht\font`X}%
			\href{#2}{\XeTeXLinkBox{\mbox{%
						\begin{tikzpicture}[yscale=-\@OrigHeightRecipROR*\@curXheightROR,%
							xscale=\@OrigHeightRecipROR*\@curXheightROR,transform shape]%
							\pic{rorlogo};%
						\end{tikzpicture}%
		}}}}{}%
	}{%
		\ifstrequal{#1}{blackwhite}{%
		\begingroup%
			\definecolor{rorlogocol}{HTML}{000000}
			\texorpdfstring{%
				\setlength{\@curXheightROR}{\fontcharht\font`X}%
				\href{#2}{\XeTeXLinkBox{\mbox{%
					\begin{tikzpicture}[yscale=-\@OrigHeightRecipROR*\@curXheightROR,%
						xscale=\@OrigHeightRecipROR*\@curXheightROR,transform shape]%
						\pic{rorlogo};%
					\end{tikzpicture}%
			}}}}{}%
		\endgroup%
		}{\PackageWarning{rorlink}{The defined optional argument is unknown, thus, set to blank.}{\rorlink{#2}}}%
	}%
}%
\endinput%    \end{macrocode}

%
% \iffalse
%</package>
% \fi
%
% \Finale
\endinput