Debian Codegraph @

texmf-dist/source/latex/rorlink/rorlink.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2023 by Florian Lukas <[email protected]>
4 % ---------------------------------------------------------------------------
5 % This work may be distributed and/or modified under the
6 % conditions of the LaTeX Project Public License, either version 1.3c
7 % of this license or (at your option) any later version.
8 % The latest version of this license is in
9 % http://www.latex-project.org/lppl.txt
10 % and version 1.3c or later is part of all distributions of LaTeX
11 % version 2005/12/01 or later.
12 %
13 % This work has the LPPL maintenance status `maintained'.
14 %
15 % The Current Maintainer of this work is Florian Lukas.
16 %
17 % This work consists of the files rorlink.dtx and rorlink.ins
18 % and the derived filebase rorlink.sty.
19 %
20 % \fi
21 %
22 % \iffalse
23 %<*driver>
24 \ProvidesFile{rorlink.dtx}
25 %</driver>
26 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
27 %<package>\ProvidesPackage{rorlink}
28 %<*package>
29 [2023/06/23 1.1.0 Linked ROR logo macro package]
30 %</package>
31 %
32 %<*driver>
33 \documentclass{ltxdoc}
34 \usepackage{rorlink}[2023/06/15]
35 \usepackage{orcidlink}
36 \usepackage{xurl}
37 \EnableCrossrefs
38 \CodelineIndex
39 \RecordChanges
40 \begin{document}
41 \DocInput{rorlink.dtx}
42 \PrintChanges
43 \PrintIndex
44 \end{document}
45 %</driver>
46 % \fi
47 %
48 % \CheckSum{62}
49 %
50 % \CharacterTable
51 % {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
52 % 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
53 % Digits \0\1\2\3\4\5\6\7\8\9
54 % Exclamation \! Double quote \" Hash (number) \#
55 % Dollar \$ Percent \% Ampersand \&
56 % Acute accent \' Left paren \( Right paren \)
57 % Asterisk \* Plus \+ Comma \,
58 % Minus \- Point \. Solidus \/
59 % Colon \: Semicolon \; Less than \<
60 % Equals \= Greater than \> Question mark \?
61 % Commercial at \@ Left bracket \[ Backslash \\
62 % Right bracket \] Circumflex \^ Underscore \_
63 % Grave accent \` Left brace \{ Vertical bar \|
64 % Right brace \} Tilde \~}
65 %
66 %
67 % \changes{1.0.0}{2023/06/15}{Build documentation and sty}
68 % \changes{1.1.0}{2023/06/23}{Updated command syntax and implementation of optional arguments for a black and white logo}
69 %
70 % \DoNotIndex{\newcommand,\newenvironment}
71 %
72 % \providecommand*{\url}{\texttt}
73 % \GetFileInfo{rorlink.dtx}
74 % \title{The \textsf{rorlink} package}
75 % \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:[email protected]}{[email protected]}}
76 % \date{\fileversion~from \filedate}
77 %
78 % \maketitle
79 %
80 %Repo: \url{https://gitlab.com/lukeflo/rorlink-latex-package}
81 %
82 % \section{Introduction}
83 %
84 % 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.
85 %
86 % \section{Usage}
87 %
88 % The package can be included in the praeambel like any other package:
89 %\begin{verbatim}
90 % \usepackage{rorlink}
91 %\end{verbatim}
92 %
93 %\DescribeMacro{\rorlink\marg{ror-link}}
94 %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}.
95 %
96 %You can include it into the document title using it inside the |\author{names}| command, as I did for this documentation:
97 %\begin{verbatim}
98 %\author{Florian Lukas\,\orcidlink{0000-0002-7959-5494}\,\rorlink{https://ror.org/02rspp784}}
99 %\end{verbatim}
100 %
101 %Furthermore, it can be included into larger macros; for instance, to create an author section with all necessary informations of the contributors:
102 %
103 %
104 %
105 %\section{Optional Arguments}
106 %
107 %There are two possibilities of using an optional argument |blackwhite|
108 %
109 %\DescribeMacro{\usepackage[blackwhite]{rorlink}}\par
110 %The option |blackwhite| can be set globally in the praeambel. Then every ROR link will appear in black and white only.
111 %
112 %\DescribeMacro{\rorlink[blackwhite]\marg{ror-link}}\par
113 %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.
114 %
115 %\section{Required Packages}
116 %
117 %\begin{description}
118 % \item[hyperref] Needed to use the symbol as a link to the particular ROR webpage.
119 % \item[tikz] Is used to draw the ROR symbol using the svg-path method and process the image, when the |\rorlink| command is called.
120 % \item[etoolbox] For the conditioning of the optional argument uses in inline commands.
121 %\end{description}
122 %
123 % \StopEventually{}
124 %
125 % \section{Implementation}
126 %
127 % \iffalse
128 %<*package>
129 % \fi
130 %
131 %% Required packages
132 % \begin{macrocode}
133 \RequirePackage{hyperref}
134 \RequirePackage{tikz}
135 \RequirePackage{xparse}
136 \RequirePackage{etoolbox}
137 % \end{macrocode}
138 %% Set standard color of the ROR institution
139 % \begin{macrocode}
140 \definecolor{rorlogocol}{HTML}{53BAA1}
141 % \end{macrocode}
142 %% Set global option |blackwhite| for depicting the logo only in black and white.
143 % \begin{macrocode}
144 \DeclareOption{blackwhite}{\definecolor{rorlogocol}{HTML}{000000}}
145 \DeclareOption*{\PackageWarning{rorlink}{Unknown option -- \CurrentOption --}}
146 \ProcessOptions\relax
147 % \end{macrocode}
148 %% Load tikz library for processing svg-paths.
149 % \begin{macrocode}
150 \usetikzlibrary{svg.path}
151 % \end{macrocode}
152 %% The original svg-path received from the file \url{https://raw.githubusercontent.com/ror-community/ror-logos/main/ror-icon-rgb.svg}
153 % \begin{macrocode}
154 \tikzset{
155 rorlogo/.pic={
156 \fill[rorlogocol] svg{M68.65,4.16L56.52,22.74L44.38,4.16L68.65,4.16Z}
157 svg{M119.41,4.16L107.28,22.74L95.14,4.16L119.41,4.16Z}
158 svg{M44.38,115.47L56.52,96.88L68.65,115.47L44.38,115.47Z}
159 svg{M95.14,115.47L107.28,96.88L119.41,115.47L95.14,115.47Z};
160 \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};
161 }
162 }
163 % \end{macrocode}
164 %
165 %
166 %% The original height of the svg file is 119.27pt. The macro here uses 1/119.27 as unit.
167 % \begin{macrocode}
168 \newcommand{\@OrigHeightRecipROR}{0.008384338}
169 % \end{macrocode}
170 %
171 %
172 %% 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.
173 % \begin{macrocode}
174 \newlength{\@curXheightROR}
175 \DeclareDocumentCommand\rorlink{om}{%
176 \IfNoValueTF{#1}{%
177 \texorpdfstring{%
178 \setlength{\@curXheightROR}{\fontcharht\font`X}%
179 \href{#2}{\XeTeXLinkBox{\mbox{%
180 \begin{tikzpicture}[yscale=-\@OrigHeightRecipROR*\@curXheightROR,%
181 xscale=\@OrigHeightRecipROR*\@curXheightROR,transform shape]%
182 \pic{rorlogo};%
183 \end{tikzpicture}%
184 }}}}{}%
185 }{%
186 \ifstrequal{#1}{blackwhite}{%
187 \begingroup%
188 \definecolor{rorlogocol}{HTML}{000000}
189 \texorpdfstring{%
190 \setlength{\@curXheightROR}{\fontcharht\font`X}%
191 \href{#2}{\XeTeXLinkBox{\mbox{%
192 \begin{tikzpicture}[yscale=-\@OrigHeightRecipROR*\@curXheightROR,%
193 xscale=\@OrigHeightRecipROR*\@curXheightROR,transform shape]%
194 \pic{rorlogo};%
195 \end{tikzpicture}%
196 }}}}{}%
197 \endgroup%
198 }{\PackageWarning{rorlink}{The defined optional argument is unknown, thus, set to blank.}{\rorlink{#2}}}%
199 }%
200 }%
201 \endinput% \end{macrocode}
202
203 %
204 % \iffalse
205 %</package>
206 % \fi
207 %
208 % \Finale
209 \endinput