Debian Codegraph @

texmf-dist/source/latex/komacv-rg/komacv-lco.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2017-2018 by Richard Grewe <[email protected]>
4 % -------------------------------------------------------
5 %
6 % This file may be distributed and/or modified under the
7 % conditions of the LaTeX Project Public License, either version 1.2
8 % of this license or (at your option) any later version.
9 % The latest version of this license is in:
10 %
11 % http://www.latex-project.org/lppl.txt
12 %
13 % and version 1.2 or later is part of all distributions of LaTeX
14 % version 1999/12/01 or later.
15 %
16 % \fi
17 %
18 % \iffalse
19 %<*driver>
20 \ProvidesFile{komacv-lco.dtx}
21 %</driver>
22 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
23 %<package>\ProvidesPackage{komacv-lco}
24 %<*package>
25 [2018/11/02 v0.9b Letter class options usable for komacv]
26 %</package>
27 %
28 %<*driver>
29 \documentclass{ltxdoc}
30 \usepackage[columns=2]{idxlayout}
31 \usepackage{xspace}
32 \usepackage{enumitem}
33 \usepackage{keyvaltable}
34 \usepackage{showexpl}
35 \lstset{gobble=2,frame=trbl,backgroundcolor=\color{black!5!white},width=0.55\textwidth}
36 \lstset{basicstyle=\footnotesize\fontfamily{pcr}\selectfont}
37 \lstset{explpreset={columns=fixed,numbers=none,language={}}}
38 \lstset{preset={\small\sffamily},overhang=3cm,pos=r,varwidth=false}
39 \usepackage{pbox}
40 \usepackage{csquotes}\MakeOuterQuote{"}
41 \usepackage{filecontents}
42 \begin{filecontents*}{demo.lco}
43 \ProvidesFile{demo.lco}
44 \KOMAoptions{fromemail=true,fromphone=false,frommobilephone=true}
45
46 \setkomavar{fromfirstname}{John}
47 \setkomavar{fromfamilyname}{Doe}
48 \setkomavar{fromaddressstreet}{Main Street 1}
49 \setkomavar{fromaddresscity}{12345 Springfield}
50
51 \setkomavar{fromphone}[\Telefon~]{555\ 123456}
52 \setkomavar{frommobilephone}[\Mobilefone~]{555\ 98765}
53 \setkomavar{fromemail}[\Letter~]{[email protected]}
54 \setkomavar{place}{Springfield}
55
56 \setkomavar{fromgithub}{\httpslink{github.com/JohnDoe}}
57 \setkomavar{fromlinkedin}{\httpslink{linkedin.com/in/JohnDoe}}
58 \setkomavar{fromurl}{www.example.com/~Doe}
59 \end{filecontents*}
60 \newcommand\NiceDescribeStuff[2]{% #1=margin text, #2=body text
61 \medskip\par\noindent\leavevmode%
62 \marginpar{\hfill\hbox to 0pt{\hss\pbox[t]{4\marginparwidth}{\ttfamily #1}}%
63 \hspace*{-0.85\marginparsep}}% NOTE: the 0.85 fixes an otherwise too close placement
64 \ifstrempty{#2}{\ignorespaces}{#2\smallskip\\}}
65 \newcommand\NiceDescribeEnv[3][]{% #1=index list, #2=envname, #3=parameters
66 \NiceDescribeStuff{%
67 \textcolor{gray}{\cs{begin}}\string{#2\string}\\
68 \textcolor{gray}{\cs{end}}\string{#2\string}}{#3}%
69 \ifstrempty{#1}
70 {\SpecialEnvIndex{#1}}%
71 {\forcsvlist{\SpecialEnvIndex}{#1}}%
72 \ignorespaces}
73 \newcommand\NiceDescribeMacro[2]{% #1=macro, #2=parameters
74 \NiceDescribeStuff{\hbox to 0pt{\hss\string#1}}{#2}%
75 \SpecialUsageIndex{#1}\ignorespaces}
76 \newcommand\NiceDescribeConstant[1]{% #1=constant
77 \NiceDescribeStuff{#1\quad\kern 0pt\relax}{}}
78 \newcommand\ThisPackage{\textsf{komacv-lco}\xspace}
79 \usepackage{hypdoc}
80 \usepackage[capitalise,noabbrev,nameinlink]{cleveref}
81 \usepackage{komacv-lco}
82 \EnableCrossrefs
83 \CodelineIndex
84 \RecordChanges
85 \begin{document}
86 \DocInput{komacv-lco.dtx}
87 \PrintChanges
88 \PrintIndex
89 \end{document}
90 %</driver>
91 % \fi
92 %
93 % \CheckSum{0}
94 %
95 % \CharacterTable
96 % {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
97 % 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
98 % Digits \0\1\2\3\4\5\6\7\8\9
99 % Exclamation \! Double quote \" Hash (number) \#
100 % Dollar \$ Percent \% Ampersand \&
101 % Acute accent \' Left paren \( Right paren \)
102 % Asterisk \* Plus \+ Comma \,
103 % Minus \- Point \. Solidus \/
104 % Colon \: Semicolon \; Less than \<
105 % Equals \= Greater than \> Question mark \?
106 % Commercial at \@ Left bracket \[ Backslash \\
107 % Right bracket \] Circumflex \^ Underscore \_
108 % Grave accent \` Left brace \{ Vertical bar \|
109 % Right brace \} Tilde \~}
110 %
111 % \changes{v0.9}{2017/08/30}{Initial version}
112 % \changes{v0.9b}{2018/11/02}{Package author's name change}
113 %
114 % \GetFileInfo{komacv-lco.dtx}
115 %
116 % \DoNotIndex{\newcommand,\newenvironment,\def,\gdef,\edef}
117 %
118 % \title{The \ThisPackage Package\thanks{This document
119 % corresponds to \ThisPackage~\fileversion, dated \filedate.
120 % The package is available online at
121 % \url{http://www.ctan.org/pkg/komacv-rg} and
122 % \url{https://github.com/Ri-Ga/komacv-rg}.}}
123 % \author{Richard Grewe \\ \texttt{[email protected]}}
124 %
125 % \maketitle
126 %
127 % \section{Introduction}
128 % \label{sec:Introduction}
129 %
130 % The \ThisPackage package provides means for unifying the input data to a CV
131 % made with \textsf{komacv} and to a cover letter made with \textsf{scrlttr2}.
132 % Concretely:
133 % \begin{itemize}[noitemsep]
134 % \item When the \ThisPackage package is used within a document of the
135 % \textsf{scrlttr2} class (e.g., a cover letter), it defines KOMA variables
136 % \textsf{komacv}'s data fields such as |github| and |linkedin|. Values for
137 % these variables can therefore be specified in letter-class-option (LCO)
138 % files (see the KOMA manual for more on these files).
139 % \item When the \ThisPackage package is used within CV of the \textsf{komacv}
140 % class, it provides a macro for loading LCO files and setting the
141 % \textsf{komacv} variables based on these macros.
142 % \item When the \ThisPackage package is used with neither \textsf{komacv} nor
143 % \textsf{scrlttr2} (e.g., a cover sheet), it provides the KOMA variables and
144 % macros for accessing them in the document.
145 % \end{itemize}
146 %
147 % \section{Usage}
148 %
149 % The following code shows some basic usage of the \ThisPackage package.
150 % The package provides the |\LoadLetterOption| macro for loading various
151 % variables. The content of the variables can be displayed, e.g., via the
152 % |\usekomavar| macro. The \ThisPackage package provides these macros, whose
153 % interfaces originate from the \textsf{scrlttr2} class, for use with other
154 % classes than \textsf{scrlttr2} -- particularly including \textsf{komacv}.
155 %
156 % \begin{LTXexample}
157 % \usepackage{komacv-lco}
158 % \LoadLetterOption{demo}
159 %
160 % \begin{document}
161 % \usekomavar{fromname}\\
162 % \usekomavar*{fromphone} \usekomavar{fromphone}\\
163 % \usekomavar*{fromgithub} \usekomavar{fromgithub}
164 % \end{document}
165 % \end{LTXexample}
166 %
167 % The content of the LCO file, \texttt{demo.lco}, is displayed in
168 % \cref{fig:lco-example}. This file shows many of the variables defined.
169 % The remainder of this section provides the complete list of macros and
170 % variables made available by \ThisPackage.
171 %
172 % \begin{figure}
173 % \lstinputlisting{demo.lco}
174 % \caption{\texttt{demo.lco}}
175 % \label{fig:lco-example}
176 % \end{figure}
177 %
178 %
179 % \subsection{Variables}
180 %
181 % The \ThisPackage package provides a set of variables that can be set in LCO
182 % files and can be used in \textsf{scrlttr2} letters, \textsf{komacv} CVs, and
183 % other \LaTeX{} documents.
184 % \Cref{tab:variables} shows the set of variables in alphabetic order.
185 % \begin{itemize}
186 % \item Most of the variables correspond to a macro that the \textsf{komacv}
187 % class defines and that is displayed in the second column of the
188 % \lcnamecref{tab:variables}. The \ThisPackage package ensures that when the
189 % value of a variable is set (via |\setkomavar|), the corresponding
190 % \textsf{komacv} macro is updated as well.
191 % Note that the macros are only defined in documents that use the
192 % \textsf{komacv} class. Documents based on another class can access the
193 % respective variables via |\usekomavar|.
194 % \item Many of the variables are also defined by the \textsf{scrlttr2} class.
195 % The third column of the \lcnamecref{tab:variables} shows which of the
196 % variables these are. The \ThisPackage package makes all of the variables
197 % available for use in documents that use the \textsf{scrlttr2} class.
198 % \item Some of the variables have a symbol assigned to them, as shown in the
199 % fourth column of the \lcnamecref{tab:variables}. The symbols are those that
200 % the \textsf{komacv} class uses.
201 % \item Some of the variables have KOMA options of the same name. These
202 % variables can be used for disabling the display of the respective variable's
203 % content.
204 % \item Two variables (from \textsf{scrlttr2}) have default values that are
205 % based on other, more fine-grained variables (from \textsf{komacv}). These
206 % variables are marked in the rightmost column of the
207 % \lcnamecref{tab:variables}.
208 % Concretely:
209 % \begin{itemize}[nosep]
210 % \item[$\star$]
211 % The `fromaddress' variable by default is set to a two-line
212 % combination of the contents of the `fromaddressstreet' and
213 % `fromaddresscity' variables.
214 % \item[$\star\star$]
215 % The `fromname' variable by default is set to the concatenation of the
216 % contents of the `fromfirstname' and the `fromfamilyname' variables.
217 % \end{itemize}
218 % \end{itemize}
219 %
220 % \begin{table}
221 % \NewKeyValTable{variables}{
222 % name: align=l, head=\small\textbf{variable name};
223 % macro: align=l, head=\small\textbf{\textsf{komacv} macro};
224 % letter: align=c, head=\small\textbf{\textsf{scrlttr2}};
225 % symbol: align=c, head=\small\textbf{symbol};
226 % option: align=c, head=\small\textbf{option};
227 % default:align=c, head=\small\textbf{default};
228 % }
229 % \begin{KeyValTable}{variables}
230 % \Row{name=fromacadtitle, macro=\cs{acadtitle}, letter=no, option=no, symbol=\usekomavar*{fromacadtitle}}
231 % \Row{name=fromaddress, macro=\cs{address}, letter=yes, option=no, symbol=\usekomavar*{fromaddress}, default=$\star$}
232 % \Row{name=fromaddresscity, macro=\cs{addresscity}, letter=no, option=no, symbol=\usekomavar*{fromaddresscity}}
233 % \Row{name=fromaddressstreet, macro=\cs{addressstreet}, letter=no, option=no, symbol=\usekomavar*{fromaddressstreet}}
234 % \Row{name=fromemail, macro=\cs{email}, letter=yes, option=yes, symbol=\usekomavar*{fromemail}}
235 % \Row{name=fromextrainfo, macro=\cs{extrainfo}, letter=no, option=yes, symbol=\usekomavar*{fromextrainfo}}
236 % \Row{name=fromfax, macro=\cs{faxnr}, letter=yes, option=yes, symbol=\usekomavar*{fromfax}}
237 % \Row{name=fromfacebook, macro=\cs{facebook}, letter=no, option=yes, symbol=\usekomavar*{fromfacebook}}
238 % \Row{name=fromfamilyname, macro=\cs{familyname}, letter=no, option=no, symbol=\usekomavar*{fromfamilyname}}
239 % \Row{name=fromfirstname, macro=\cs{firstname}, letter=no, option=no, symbol=\usekomavar*{fromfirstname}}
240 % \Row{name=fromgithub, macro=\cs{github}, letter=no, option=yes, symbol=\usekomavar*{fromgithub}}
241 % \Row{name=fromlinkedin, macro=\cs{linkedin}, letter=no, option=yes, symbol=\usekomavar*{fromlinkedin}}
242 % \Row{name=frommobilephone, macro=\cs{mobile}, letter=yes, option=yes, symbol=\usekomavar*{frommobilephone}}
243 % \Row{name=fromname, letter=yes, option=no, symbol=\usekomavar*{fromname}, default=$\star\star$}
244 % \Row{name=fromphone, macro=\cs{phonenr}, letter=yes, option=yes, symbol=\usekomavar*{fromphone}}
245 % \Row{name=fromtwitter, macro=\cs{twitter}, letter=no, option=yes, symbol=\usekomavar*{fromtwitter}}
246 % \Row{name=fromurl, macro=\cs{homepage}, letter=yes, option=yes, symbol=\usekomavar*{fromurl}}
247 % \Row{name=location, letter=yes, option=no, symbol=\usekomavar*{location}}
248 % \Row{name=place, letter=yes, option=no, symbol=\usekomavar*{place}}
249 % \end{KeyValTable}
250 % \caption{Variables for use in letter options}
251 % \label{tab:variables}
252 % \end{table}
253 %
254 %
255 % \subsection{Macros}
256 %
257 % The following macros imitate the behavior of \textsf{scrlttr2}. For a
258 % documentation of the macros, we refer to the KOMA manual.
259 % \begin{itemize}
260 % \item
261 % |\newkomavar|\oarg{description}\marg{name}\\
262 % |\newkomavar*|\oarg{description}\marg{name}
263 % \item
264 % |\setkomavar|\marg{name}\oarg{description}\marg{content}\\
265 % |\setkomavar*|\marg{name}\marg{description}
266 % \item
267 % |\usekomavar|\oarg{command}\marg{name}\\
268 % |\usekomavar*|\oarg{command}\marg{name}
269 % \item
270 % |\ifkomavarempty|\marg{name}\marg{true-code}\marg{false-code}\\
271 % |\ifkomavarempty*|\marg{name}\marg{true-code}\marg{false-code}
272 % \item
273 % |\ifkomavar|\marg{name}\marg{true-code}\marg{false-code}
274 % \item
275 % |\LoadLetterOption|\marg{name}
276 % |\LoadLetterOptions|\marg{names}
277 % \end{itemize}
278 % The following macros of the \textsf{komacv} class are provided by
279 % \ThisPackage.
280 % \begin{itemize}
281 % \item |\emaillink|\oarg{link-text}\marg{link}
282 % \item |\httplink|\oarg{link-text}\marg{link}
283 % \end{itemize}
284 % The following additional macros are defined by \ThisPackage.
285 % \begin{itemize}
286 % \item |\ifkomavarenabled|\marg{name}\marg{true-code}\marg{false-code}\\
287 % This macro executes \meta{true-code} if the variable with name \meta{name}
288 % is enabled (through the KOMA option of the same name) and executes
289 % \meta{false-code} otherwise.
290 % \item |\httpslink|\oarg{link-text}\marg{link}\\
291 % This macro is analogous to |\httplink|, just for HTTPS links.
292 % \end{itemize}
293 %
294 %
295 % \section{Limitations}
296 %
297 % The current version of \ThisPackage has the following known limitations.
298 % Some of them might be eliminated in future versions.
299 %
300 % \begin{itemize}
301 % \item Enabled variables that are not already defined by \textsf{scrlttr2} are
302 % \emph{not} displayed in the head of the letter.
303 % If you want the additional variables to be displayed, you currently have to
304 % set the |firsthead| variable manually (see the \textsf{scrlttr2}
305 % documentation).
306 % \item In a document based on the \textsf{komacv} class, KOMA options for
307 % enabling/disabling a variable must be set \emph{before} the content of the
308 % variable is set. Only then the respective \textsf{komacv} macro is set
309 % appropriately (i.e., set empty if the variable is disabled and set to the
310 % respective content when enabled). In short, as shown also in
311 % \cref{fig:lco-example}: First use |\KOMAoptions| and afterwards use
312 % |\setkomavar|.
313 % \end{itemize}
314 %
315 % \clearpage
316 %
317 % \StopEventually{}
318 %\iffalse
319 %<*package>
320 %\fi
321 %
322 %
323 % \section{Implementation}
324 %
325 % We use the \textsf{etoolbox} package for simplifying the code and use
326 % the \textsf{scrkbase} package for KOMA options and related macros.
327 % The \textsf{marvosym} and \textsf{fontawesome} packages provide the symbols
328 % for some of the variables defined by this package.
329 % \begin{macrocode}
330 \RequirePackage{etoolbox}
331 \RequirePackage{scrkbase}
332 \RequirePackage{marvosym,fontawesome}
333 % \end{macrocode}
334 %
335 %
336 % \subsection{KOMA Variables Interface}
337 %
338 % The ``public'' interface consists of the macros |\newkomavar|, |\setkomavar|,
339 % and |\usekomavar|, which we define to have the same arguments as the
340 % counterparts defined by \textsf{scrlttr2}.
341 %
342 % \begin{macro}{\newkomavar}
343 % The |\newkomavar|\oarg{description}\marg{name} macro defines a new KOMA
344 % variable with name \meta{name} and description \meta{description}.
345 % If \meta{description} is omitted, no description is set.
346 % The |\newkomavar*|\oarg{description}\marg{name} macro is defined equivalent to
347 % the un-starred macro.
348 % \begin{macrocode}
349 \providecommand{\newkomavar}{%
350 \@ifstar{\kcvlco@newkomavar}{\kcvlco@newkomavar}}
351 \newcommand{\kcvlco@newkomavar}[2][\relax]{%
352 \ifkomavar{#2}%
353 {\kcvlco@error{KOMA variable `#2' already defined}}%
354 {\csdef{kcvlco@@var@#2}{\empty}%
355 \begingroup\def\@tempa{#1}\def\@tempb{\relax}%
356 \ifx\@tempa\@tempb\endgroup\else
357 \endgroup\csdef{kcvlco@@desc@#2}{#1}\fi}}
358 % \end{macrocode}
359 % \end{macro}
360 %
361 % \begin{macro}{\setkomavar}
362 % The |\setkomavar|\marg{name}\oarg{description}\marg{content} macro sets the
363 % content of the variable with name \meta{name} to content \meta{content} and
364 % sets the description of the variable to \meta{description}.
365 % The |\setkomavar*|\marg{name}\marg{description} sets only the description of
366 % the variable with name \meta{name} and sets it to \meta{description}.
367 % \begin{macrocode}
368 \providecommand{\setkomavar}{%
369 \@ifstar{\kcvlco@setkomadesc}{\kcvlco@setkomavar}}
370 \newcommand{\kcvlco@setkomavar}[1]{\kcvlco@onlyifdef{#1}{\@ifnextchar[%
371 {\kcvlco@setkomavar@i{#1}}{\kcvlco@setkomavar@i{#1}[\relax]}}}
372 \long\def\kcvlco@setkomavar@i#1[#2]#3{%
373 \csdef{kcvlco@@value@#1}{#3}%
374 \csuse{scr@#1@postsetvar}%
375 \begingroup\def\@tempa{#2}\def\@tempb{\relax}%
376 \ifx\@tempa\@tempb\endgroup\else
377 \endgroup\csdef{kcvlco@@desc@#1}{#2}\fi}
378 \newcommand{\kcvlco@setkomadesc}[2]{%
379 \csdef{kcvlco@@desc@#1}{#2}}
380 % \end{macrocode}
381 % \end{macro}
382 %
383 % \begin{macro}{\usekomavar}
384 % The |\usekomavar|\oarg{command}\marg{name} macro expands to the \meta{command}
385 % applied to the content of the KOMA variable \meta{name}. If omitted,
386 % \meta{command} is the identity.
387 % The |\usekomavar*|\oarg{command}\marg{name} macro is analogous to
388 % |\usekomavar| except that the description of the variable is used rather than
389 % the content.
390 % \begin{macrocode}
391 \providecommand{\usekomavar}{%
392 \@ifstar{\kcvlco@usekomadesc}{\kcvlco@usekomavar}}
393 \newcommand{\kcvlco@usekomavar}[2][\@firstofone]{%
394 \kcvlco@onlyifdef{#2}{#1{\csuse{kcvlco@@value@#2}}}}
395 \newcommand{\kcvlco@usekomadesc}[2][\@firstofone]{%
396 \kcvlco@onlyifdef{#2}{#1{\csuse{kcvlco@@desc@#2}}}}
397 % \end{macrocode}
398 % \end{macro}
399 %
400 % \begin{macro}{\ifkomavarempty}
401 % The |\ifkomavarempty|\marg{name}\marg{true-code}\marg{false-code} expands to
402 % \meta{true-code} if the content of the KOMA variable \meta{name} is empty, and
403 % expands to \meta{false-code} otherwise.
404 % The |\ifkomavarempty*|\marg{name}\marg{true-code}\marg{false-code} is
405 % analogous to |\ifkomavarempty|, except that the description of the variable is
406 % checked for emptiness rather than the content.
407 % \begin{macrocode}
408 \providecommand{\ifkomavarempty}{%
409 \@ifstar{\kcvlco@ifemptydesc}{\kcvlco@ifemptyvar}}
410 \newcommand{\kcvlco@ifemptyvar}[1]{\ifcsvoid{kcvlco@@value@#1}}
411 \newcommand{\kcvlco@ifemptydesc}[1]{\ifcsvoid{kcvlco@@desc@#1}}
412 % \end{macrocode}
413 % \end{macro}
414 %
415 % \begin{macro}{\ifkomavar}
416 % The |\ifkomavar|\marg{name}\marg{true-code}\marg{false-code} macro checks
417 % whether the KOMA variable \meta{name} is defined and expands to
418 % \meta{true-code} (positive case) or \meta{false-code} (negative case)
419 % respectively.
420 % \begin{macrocode}
421 \providecommand{\ifkomavar}[1]{\ifcsdef{kcvlco@@var@#1}}
422 % \end{macrocode}
423 % \end{macro}
424 %
425 % \begin{macro}{\ifkomavarenabled}
426 % The |\ifkomavarenabled|\marg{name}\marg{true-code}\marg{false-code} macro
427 % checks whether the corresponding KOMA option for \meta{name} exists and is set
428 % to |false|. In this case, the macro expands to \meta{false-code} and otherwise
429 % expands to \meta{true-code}.
430 % \begin{macrocode}
431 \providecommand{\ifkomavarenabled}[1]{\csuse{kcvlco@@enab@#1}}
432 % \end{macrocode}
433 % \end{macro}
434 %
435 % \subsection{Letter Options Interface}
436 %
437 % \begin{macro}{\LoadLetterOption}
438 % The |\LoadLetterOption|\marg{name} loads options from the file with filename
439 % \meta{name} (an ``lco''-file, but without the file extension).
440 % \begin{macro}{\LoadLetterOptions}
441 % The |\LoadLetterOptions|\marg{names} loads options from the files in the
442 % comma-separated list \meta{names} of file names (again without ``lco''
443 % extension).
444 % \begin{macrocode}
445 \providecommand\LoadLetterOption[1]{\input{#1.lco}}
446 \providecommand\LoadLetterOptions[1]{\forcsvlist{\LoadLetterOption}{#1}}
447 % \end{macrocode}
448 % \end{macro}
449 % \end{macro}
450 %
451 %
452 % \subsection{URL Formatting}
453 %
454 % \begin{macro}{\emaillink}
455 % The |\emaillink|\oarg{text}\marg{link} macro, analogously to \textsf{komacv}'s
456 % |\emaillink| macro, provides a means for typesetting a ``mailto'' link.
457 % \begin{macrocode}
458 \providecommand*{\emaillink}[2][]{%
459 \ifstrempty{#1}{%
460 \href{mailto:#2}{\usefontofkomafont{emaillinkfont}#2}}{%
461 \href{mailto:#2}{\usefontofkomafont{emaillinkfont}#1}}}
462 \IfExistskomafont{emaillinkfont}{}{\newkomafont{emaillinkfont}{}}
463 % \end{macrocode}
464 % \end{macro}
465 %
466 % \begin{macro}{\httplink}
467 % The |\httplink|\oarg{text}\marg{link} macro, analogously to \textsf{komacv}'s
468 % |\httplink| macro, provides a means for typesetting an HTTP link.
469 % \begin{macrocode}
470 \providecommand*{\httplink}[2][]{%
471 \ifstrempty{#1}{%
472 \href{http://#2}{\usefontofkomafont{httplinkfont}#2}}{%
473 \href{http://#2}{\usefontofkomafont{httplinkfont}#1}}}
474 \IfExistskomafont{httplinkfont}{}{\newkomafont{httplinkfont}{}}
475 % \end{macrocode}
476 % \end{macro}
477 %
478 % \begin{macro}{\httpslink}
479 % The |\httpslink|\oarg{text}\marg{link} macro, analogously to \textsf{komacv}'s
480 % |\httplink| macro, provides a means for typesetting an HTTPS link.
481 % \begin{macrocode}
482 \providecommand*{\httpslink}[2][]{%
483 \ifstrempty{#1}{%
484 \href{https://#2}{\usefontofkomafont{httplinkfont}#2}}{%
485 \href{https://#2}{\usefontofkomafont{httplinkfont}#1}}}
486 % \end{macrocode}
487 % \end{macro}
488 %
489 %
490 % \subsection{Registering KOMA Variables with \textsf{komacv} Macros}
491 %
492 % \begin{macro}{\kcvlco@newvar}
493 % The
494 % |\kcvlco@newvar|\oarg{description}\marg{KOMAvar}\marg{CVmacro}\marg{conditional}
495 % macro provides the KOMA variable \meta{KOMAvar}. If \meta{conditional} is
496 % provided, a Boolean |\KOMAoptions| variable named \meta{KOMAvar} is
497 % registered.
498 % This Boolean is stored in |if|\meta{conditional} (as registered with
499 % |\newif|).
500 % The macro connects \meta{KOMAvar} with the \textsf{komacv} macro
501 % \meta{CVmacro}. The connection establishes that when \meta{KOMAvar} is
502 % changed, the \meta{CVmacro} is updated (though \emph{not} vice versa).
503 % \begin{macrocode}
504 \newcommand\kcvlco@newvar[4][\relax]{%
505 \ifkomavar{#2}%
506 {\begingroup\def\@tempa{#1}\def\@tempb{\relax}%
507 \ifx\@tempa\@tempb\endgroup\else
508 \endgroup\setkomavar*{#2}{#1}\fi}
509 {\newkomavar[{#1}]{#2}}%
510 \ifstrempty{#4}%
511 {\csdef{kcvlco@@enab@#2}{\ifbool{true}}}%
512 {\csdef{kcvlco@@enab@#2}{\ifbool{#4}}\KOMA@ifkey{#2}{#4}}%
513 % \end{macrocode}
514 % We use the \meta{postsetvar} hook of KOMA, which we also implement in our
515 % |\setkomavar| surrogate.
516 % \begin{macrocode}
517 \@ifclassloaded{komacv}{%
518 \ifstrempty{#4}%
519 {\csappto{scr@#2@postsetvar}{\ifkomavarempty{#2}%
520 {\let#3=\empty}%
521 {\kcvlco@storekomavar{#2}{#3}}}}%
522 {\csappto{scr@#2@postsetvar}{\ifkomavarempty{#2}%
523 {\let#3=\empty}%
524 {\ifbool{#4}{\kcvlco@storekomavar{#2}{#3}}{\let#3=\empty}}}}%
525 \csuse{scr@#2@postsetvar}}{}}
526 % \end{macrocode}
527 % \end{macro}
528 %
529 %
530 % \subsection{Internal Helper Macros}
531 %
532 % \begin{macro}{\kcvlco@error}
533 % The |\kcvlco@error|\marg{message} macro displays the given error
534 % \meta{message}.
535 % \begin{macrocode}
536 \providecommand{\kcvlco@error}[1]{%
537 \PackageError{komacv-lco}{#1}{}}
538 % \end{macrocode}
539 % \end{macro}
540 %
541 % \begin{macro}{\kcvlco@errundef}
542 % The |\kcvlco@errundef|\marg{name} macro displays an error message for
543 % KOMA variable \meta{name} not being defined.
544 % \meta{message}.
545 % \begin{macrocode}
546 \providecommand{\kcvlco@errundef}[1]{%
547 \kcvlco@error{KOMA variable `#1' undefined}}
548 % \end{macrocode}
549 % \end{macro}
550 %
551 % \begin{macro}{\kcvlco@onlyifdef}
552 % The |\kcvlco@onlyifdef|\marg{name}\marg{code} macro displays an error message
553 % if KOMA variable \meta{name} is undefined and expands to \meta{code}
554 % otherwise.
555 % \meta{message}.
556 % \begin{macrocode}
557 \providecommand{\kcvlco@onlyifdef}[2]{%
558 \ifkomavar{#1}{#2}{\kcvlco@errundef{#1}}}
559 % \end{macrocode}
560 % \end{macro}
561 %
562 % \begin{macro}{\kcvlco@storekomavar}
563 % The |\kcvlco@storekomavar|\marg{name}\marg{macro} macro stores the content of
564 % the KOMA variable \meta{name} into the macro \meta{macro}.
565 % \begin{macrocode}
566 \newcommand{\kcvlco@storekomavar}[2]{\letcs#2{kcvlco@@value@#1}}
567 % \end{macrocode}
568 % \end{macro}
569 %
570 %
571 % \subsection{Declaration of Concrete Variables}
572 %
573 % \paragraph{Shared variables}
574 % The following variables are shared by \textsf{scrlttr2} and \textsf{komacv}.
575 % The conditionals used in the last argument to |\kcvlco@newvar| are taken over
576 % from \textsf{scrlttr2}.
577 % \begin{macrocode}
578 \kcvlco@newvar[\Telefon]{fromphone}{\phonenr}{@phone}
579 \kcvlco@newvar[\Mobilefone]{frommobilephone}{\mobile}{@mobilephone}
580 \kcvlco@newvar[\FAX]{fromfax}{\faxnr}{@fax}
581 \kcvlco@newvar[\Letter]{fromemail}{\email}{@email}
582 \kcvlco@newvar{fromurl}{\homepage}{@www}
583 % \end{macrocode}
584 %
585 % \paragraph{\textsf{scrlttr2} variables}
586 % The following variables are \textsf{scrlttr2}-only.
587 % \begin{macrocode}
588 \ifkomavar{fromname}{}{\newkomavar{fromname}}
589 \setkomavar{fromname}{%
590 \usekomavar{fromfirstname}~\usekomavar{fromfamilyname}}
591 \ifkomavar{fromaddress}{}{\newkomavar{fromaddress}}
592 \setkomavar{fromaddress}{%
593 \usekomavar{fromaddressstreet}\\ \usekomavar{fromaddresscity}}
594 \ifkomavar{place}{}{\newkomavar{place}}
595 \ifkomavar{location}{}{\newkomavar{location}}
596 % \end{macrocode}
597 %
598 % \paragraph{\textsf{komacv} variables}
599 % The following variables are \textsf{komacv}-only.
600 % \begin{macrocode}
601 \kcvlco@newvar{fromfirstname}{\firstname}{}
602 \kcvlco@newvar{fromfamilyname}{\familyname}{}
603 \kcvlco@newvar{fromacadtitle}{\acadtitle}{}
604 \kcvlco@newvar{fromaddressstreet}{\addressstreet}{}
605 \kcvlco@newvar{fromaddresscity}{\addresscity}{}
606 \kcvlco@newvar[\faTwitter]{fromtwitter}{\twitter}{kcvlco@@twitter}
607 \kcvlco@newvar[\faGithub]{fromgithub}{\github}{kcvlco@@github}
608 \kcvlco@newvar[\faFacebook]{fromfacebook}{\facebook}{kcvlco@@facebook}
609 \kcvlco@newvar[\faLinkedin]{fromlinkedin}{\linkedin}{kcvlco@@linkedin}
610 \kcvlco@newvar{fromextrainfo}{\extrainfo}{kcvlco@@extrainfo}
611 % \end{macrocode}
612 %
613 %\iffalse
614 %</package>
615 %\fi
616 % \Finale
617 \endinput