summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/hvqrurl/doc/hvqrurl.tex
blob: 79c2c395ea377d8197677d3fb0e1741e598d3aad (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
%% $Id: hvqrurl.tex 870 2024-02-03 20:38:44Z herbert $
\listfiles
\errorcontextlines=100
\documentclass[twoside=on,usegeometry]{scrartcl}
\usepackage{libertinus-otf}
\setmonofont[Scale=MatchLowercase,FakeStretch=0.85]{DejaVu Sans Mono}
\usepackage{microtype}
\usepackage[english]{babel}
\usepackage[automark]{scrlayer-scrpage}
\pagestyle{scrheadings}

\usepackage[showframe=false]{geometry}
\usepackage{listings}
\usepackage[imakeidx]{xindex}
\makeindex
%
\lstset{%
    language=[LaTeX]TeX,%
    showstringspaces=false,%
    tabsize=5,%
    frame=single,%
%    lineskip=-1pt,%
    extendedchars=true,%
    basicstyle={\small\ttfamily},%
%    numbers=left,%
%    stepnumber=1,%
%    numberstyle=\tiny,%
%    xleftmargin=2em,%
    breaklines=true}
%

\usepackage{ragged2e}
\usepackage{hvqrurl}
\usepackage{hvdoctools}

\usepackage{hyperref}
\hypersetup{%urlcolor=blue, 
linktocpage, colorlinks=true}%

\begin{document}
\title{Package \texttt{hvqrurl}\\Creating a QR-code of an URL in the margin \\\small ver 0.05a}
\author{Herbert Voß\thanks{\protect\url{hvoss@tug.org}}}
\date{\today}
\maketitle


\begin{abstract}
This package allows to draw an URL as a QR code into the margin of a one- or twosided
document. The following packages are loaded by default:
\LPack{qrcode}, \LPack{marginnote}, \LPack{url}, \LPack{xcolor},
and 
\LPack{xkeyval}.
\end{abstract}


\section{The macros}


\begin{BDef}
\Lcs{hvqrset}\Largb{key=value, \ldots}\\
\Lcs{hvqrurl}\OptArg{key=value, \ldots}\Largb{URL}\\
\Lcs{hvqrurl*}\OptArg{key=value, \ldots}\Largb{URL}
\end{BDef}

With the default macro \Lcs{hvqrurl} the URL is printed as as QR code into the margin and
in the the text as usual with the macro \Lcs{url}, for example \hvqrurl{https://mirror.ctan.org/pkg/hvqrurl}.
With \LPack{hyperref} you'll get the the same color for the QR code as for  the URL link and, of course,
it is also a link. This example shows the output of the  QR code with the default setting and
an active \LPack{hyppref}.
The star version of the command
prints only the QR code but not the URL in the text.

With \Lcs{hvqrset} one can set the optional arguments globally. For example if one do not want all
QR codes not as a link when using \LPack{hyperref}:

\begin{lstlisting}
\hvqrset{qrlink=nolink} 
\end{lstlisting}


\section{Optional arguments}

\subsection{No link with \LPack{hyperref}}

This needs package hyperref, which is loaded by default. With the optional argument
\Lkeyword{nohyperref} you can prevent the loading of this package.

\begin{lstlisting}
With qrlink=nolink the QR code is no link: \hvqrurl[qrlink=nolink]{https://mirror.ctan.org/pkg/hvqrurl}.
The default setting is qrlink=link.
\end{lstlisting}
With \Lkeyset{qrlink=nolink} the QR code is no link: \hvqrurl[qrlink=nolink]{https://mirror.ctan.org/pkg/hvqrurl}.
The default setting is \Lkeyset{qrlink=link}. Without using \LPack{hyperref} this optional argument
has no meaning. The optional argument \Lkeyword{linktext} is also only valid, if hyperref is aktive.





\subsection{Color of the QR code}
Without using \LPack{hyperref} the default color is \Lkeyval{black}. It can be changed by
the optional argument \Lkeyword{qrcolor}. The package 
\LPack{xcolor}\hvqrurl*[qrlink=nolink,qrcolor=red!40!white]{https://mirror.ctan.org/pkg/xcolor}
is loaded by default, 
the reason why an extended color definition is possible. For this example we used

\begin{lstlisting}
The package xcolor\hvqrurl*[qrcolor=red!40!white]{https://mirror.ctan.org/pkg/xcolor}
 is loaded by default, ...
\end{lstlisting}

\subsection{Vertical position of the QR code}
By default the baseline of the QR code is nearly at the same height as the baseline of the text.
However, when changing the size of the QR code it may be nessesary to move up or down the QR code.
The default value of \Lkeyword{qradjust} is \verb|-1.5\normalbaselineskip|. Setting the value
to 0pt the QR code 
\hvqrurl[qrlink=nolink,qradjust=0pt]{https://latex.texnik.de/tutorials/packages/#header-footer} 
is moved down which is the default
setting without a vertical adjustment.

\begin{lstlisting}
The default value of qradjust is \verb|-1.5\normalbaselineskip|. Setting the value
to 0pt the QR code 
\hvqrurl[qradjust=0pt]{https://latex.texnik.de/tutorials/packages/#header-footer} 
is moved down which is the default setting without a vertical adjustment.
\end{lstlisting}


\subsection{Size of the QR code}
By default the QR code is a square with height and width of 1cm.
it can be changed by setting \Lkeyword{qrheight} to another value, for example to 2cm:
\hvqrurl*[qrlink=nolink,qrheight=2cm]{https://identity.fu-berlin.de/idp-fub/profile/SAML2/Redirect/SSO;jsessionid=71C984647E3B8F2E716CA067CB13387E?execution=e1s1}
This is an extremely long url where it may make sense to use a larger QR code.

\begin{lstlisting}
it can be changed by setting qrheight to another value, for example to 2cm:
\hvqrurl*[qrheight=2cm]{https://identity.fu-berlin.de/idp-fub/profile/SAML2/Redirect/SSO;jsessionid=71C984647E3B8F2E716CA067CB13387E?execution=e1s1}
This is an extremely long url where it may make sense to use a larger QR code.
\end{lstlisting}


\subsection{QR code level}
The QR code specification includes four levels of encoding: 
Low (L) (\hvqrurl[qrlink=nolink]{https://www.tug.org/}), Medium (M), Quality (Q), 
and High (H) (\hvqrurl[qrlink=nolink,qradjust=0pt,qrlevel=H]{https://www.tug.org/}), 
in increasing order of error-correction capability. 
In general, for a given text a higher error-correction level requires 
more bits of information in the QR code. 

\begin{lstlisting}
The QR code specification includes four levels of encoding: 
Low (L) (\hvqrurl{https://www.tug.org/}), Medium (M), Quality (Q), 
and High (H) (\hvqrurl[qradjust=0pt,qrlevel=H]{https://www.tug.org/}), 
in increasing order of error-correction capability. 
\end{lstlisting}

The first QR code has the default level \Lkeyval{M} and the last one the
level \Lkeyval{H}. In general the user has not to set this keyword it will be
controlled internally by the package.


\subsection{Inner or outer margin for  the QR code}
By default the QR code is set in the right (oneside document) or outer margin (twoside) of the
document. This one (\hvqrurl{https://hvoss.org}) is at the default position.
With the optional argument \Lkeyword{qrreverse} it can be placed in the left or inner margin.
This one (\hvqrurl[qrreverse]{https://latex.texnik.de}) is in the other margin.

\begin{lstlisting}
This one (\hvqrurl{https://hvoss.org}) is at the default position.
With the optional argument \Lkeyword{qrreverse} it can be placed in the left or inner margin.
This one (\hvqrurl[qrreverse]{https://latex.texnik.de}) is in the other margin.
\end{lstlisting}

\subsection{Alternative link text}
By default the QR code is set with the given text. If the link is too long, one
can use a short link with the optional argument \Lkeyword{linktext} for the text and 
the long link for the qrcode, like
this one: \hvqrurl[linktext=https://www.uni-bonn.de]%
{https://www.uni-bonn.de/de/studium/studienangebot/studiengaenge-a-z/kunstgeschichte-bazf?set_language=de}.


\begin{lstlisting}
By default the QR code is set with the given text. If the link is too long, one
can use a short link with the optional argument \Lkeyword{linktext} for the text and 
the long link for the qrcode, like
this one: \hvqrurl[linktext=https://www.uni-bonn.de]%
{https://www.uni-bonn.de/de/studium/studienangebot/studiengaenge-a-z/kunstgeschichte-bazf?set_language=de}.
\end{lstlisting}

It makes no sense to use the star version \Lcs{hvqrurl*} together with the optional argument
\Lkeyword{linktext}!



\printindex


\section{The Package Source}
\lstinputlisting[basicstyle=\ttfamily\footnotesize,tabsize=3,numbers=left,numberstyle=\tiny]{hvqrurl.sty}


\end{document}