Debian Codegraph @

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

raw
1 % \iffalse meta-comment
2 % Copyright (C) 2005 Gianluca Pignalberi
3 % ([email protected])
4 %
5 % this file may be distributed and/or modified under the conditions of the
6 % LaTeX Project Public License, either version 1.3a or
7 % (at your option) any later version. The latest version of this
8 % license is in http://www.latex-project.org/lppl.txt
9 % and version 1.3a or later is part of all distributions of LaTeX
10 % version 2004/10/01 or later.
11 % \fi
12 %
13 % \iffalse
14 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
15 %<package>\ProvidesPackage{cclicenses}
16 %<package>[2005/05/20 v0.4 .dtx cclicenses file]
17 %<*driver>
18 \documentclass{ltxdoc}
19 \usepackage{cclicenses}
20 \usepackage{mflogo}
21 \usepackage{booktabs}
22 %
23 \begin{document}
24 % \OnlyDescription% Comment out to print Section "The Code" as well.
25 \DocInput{cclicenses.dtx}
26 \end{document}
27 %</driver>
28 % \fi
29 % \CheckSum{283}
30 % \newcommand\CC{Creative Commons}
31 %
32 % \RecordChanges
33 % \changes{v0.4}{2005/05/20}{Initial version}
34 %
35 % \GetFileInfo{cclicenses.sty}
36 % \title{The \textsf{cclicenses} package}
37 % \author{Gianluca Pignalberi\\
38 % \texttt{[email protected]}}
39 % \date{\filedate ~(\fileversion)}
40 % \maketitle
41 % \begin{abstract}
42 % The version 0.4 of \texttt{cclicenses} is my very first attempt to write a
43 % package to submit to CTAN. It is intended for typesetting the \CC\
44 % licenses icons, using \LaTeX\ instead of defining new strokes by \MF.
45 % \end{abstract}
46 %
47 % \section{Introduction}
48 % Some journal and magazines started publishing articles released under free
49 % licenses, such as \CC. To show this fact immediately they want to insert the
50 % proper logos
51 % along with the articles. Artists who release music, images or other
52 % work under \CC may want to add the proper icons to their documents as well.
53 %
54 % Some of these magazines, including the one I work for, are typeset by
55 % \LaTeX. So, I believe there's a need to instruct \LaTeX\ to typeset such
56 % logos.
57 %
58 % This is my very first attempt.
59 % All of the icons are typeset in boldface Helvetica. I used |\textcircled{}|
60 % to surround symbols by a circle. For some reason, the circle is not quite a
61 % circle when the text is very small or it's |\textbf|'ed.
62 %
63 % As I said, this is only my first attempt. Please do send me your suggestions
64 % to improve the result.
65 %
66 % \section{How to use the package's commands}
67 % It coulnd't be easier: according to the license you're going to release
68 % your work under, use the corresponding logos.
69 %
70 % \begin{table*}[h]
71 % \centering
72 % \caption{What command generates what icon}
73 % \begin{tabular}{lcl}
74 % \toprule
75 % \textbf{Command}&\textbf{Icon}&\textbf{License's type}\\
76 % \midrule
77 % |\cc|&\cc&Creative Commons\\
78 % |\ccby|&\ccby&Attribution\\
79 % |\ccnc|&\ccnc&NonCommercial\\
80 % |\ccnd|&\ccnd&NoDerivs\\
81 % |\ccsa|&\ccsa&Share-alike\\
82 % \bottomrule
83 % \end{tabular}
84 % \end{table*}
85 %
86 % \section{\CC\ licenses}
87 % When an artist wants to release his or her work under a free license, s/he
88 % can choose to adopt one of the \CC\ licenses.
89 %
90 % The CC licenses are used to reserve some rights to the author, give away
91 % some other rights, while the copyright is still held by the author.
92 %
93 % Since version 2.0, each license includes the \emph{Attribution} right which
94 % forces every person (who is not the author) to give the original author
95 % credit.
96 %
97 % A \emph{NoDerivs} icon, where ``NoDerivs'' stands for ``Non derivative
98 % works'', indicates that you may not alter, transform, or build upon a work;
99 % the \emph{NonCommercial} icon indicates that the work can't be used for
100 % commercial purposes. The \emph{Share-alike} icon, that applies only to
101 % derivative works ---so it can't appear along with the NoDerivs icon---,
102 % forces to release the derivative works under the same license as the
103 % original.
104 %
105 % \section{The current licenses}
106 % The following are the currently used licenses and the related commands:
107 %
108 % \begin{center}
109 % \begin{tabular}{lll}
110 % \toprule
111 % \textbf{Command}&\textbf{License}&\textbf{Symbol(s)}\\
112 % \midrule
113 % \multicolumn{3}{c}{Version 2.0}\\
114 % \midrule
115 % |\by|&Attribution&\by\\
116 % |\bynd|&Attribution-NoDerivs&\bynd\\
117 % |\byncnd|&Attribution-NonCommercial-NoDerivs&\byncnd\\
118 % |\bync|&Attribution-NonCommercial&\bync\\
119 % |\byncsa|& Attribution-NonCommercial-ShareAlike&\byncsa\\
120 % |\bysa|&Attribution-ShareAlike&\bysa\\
121 % \midrule
122 % \multicolumn{3}{c}{Version 1.0}\\
123 % \midrule
124 % |\nd|&NoDerivs&\nd\\
125 % |\ndnc|&NoDerivs-NonCommercial&\ndnc\\
126 % |\nc|&NonCommercial&\nc\\
127 % |\ncsa|&NonCommercial-ShareAlike&\ncsa\\
128 % |\sa|&ShareAlike&\sa\\
129 % \bottomrule
130 % \end{tabular}
131 % \end{center}
132 %
133 % \section{Known issues}
134 % As already stated, this package uses the Helvetica font. Be sure it's
135 % installed in your system.
136 %
137 % The strokes are not so elegant. I advice not to use them when typesetting
138 % |\tiny| and |\scriptsize| text.
139 %
140 % The ``NonCommercial'' and ``Share-alike'' logos are just usable, not exactly
141 % good-looking. I hope I'll be able to release a new version of this package
142 % soon, where I use the |picture| environment instead of
143 % the |\textcircled| command.
144 %
145 % The space after the icons is wrong: it's always too big (it's not as big
146 % while using ``Share-alike'').
147 %
148 % \StopEventually{\PrintChanges}
149 % \section{The Code}
150 %
151 % This package needs \LaTeXe\ and the \textsf{rotating} package.
152 % \begin{macrocode}
153 \NeedsTeXFormat{LaTeX2e}
154 \ProvidesPackage{cclicenses}[2005/05/20 v0.4 CC licenses typesetting]
155 \RequirePackage{rotating}
156 % \end{macrocode}
157 %
158 % Some counters and dimension registers.
159 % \begin{macrocode}
160 \newdimen\chardim
161 \newdimen\hdim
162 \newdimen\htmp
163 \newcount\hpos
164 \newcount\vpos
165 % \end{macrocode}
166 %
167 % \DescribeMacro{\SAarrow}
168 % The CC Share-alike symbol has an arrow. This is the macro to draw an
169 % arrow, according to the symbol dimensions.
170 % \begin{macrocode}
171 \newcommand{\SA@arrow}{
172 \hdim\chardim
173 \ifdim\hdim<1.5pt \hdim=1.5pt\fi
174 \setlength\unitlength{1sp}
175 \begin{picture}(0,0)
176 \hpos=0
177 \vpos\hdim
178 \loop
179 \put(\hpos,\vpos){
180 \rule[0mm]{\hdim}{1000sp}
181 }
182 \advance\htmp by 1000sp
183 \hpos\htmp
184 \advance\vpos by -1000
185 \advance\hdim by -2000sp
186 \ifnum\vpos > 0 \repeat
187 \end{picture}}
188 % \end{macrocode}
189 %
190 % \DescribeMacro{\text@cc}
191 % The primary Creative Commons logo is a circled capital double c.
192 % \begin{macrocode}
193 \DeclareTextCommandDefault{\text@cc}{%
194 \let\origfontfamily\f@family
195 \let\origfontseries\f@series
196 \chardim\fontdimen6\font
197 \divide\chardim by 2
198 {
199 \fontfamily{phv}\fontseries{b}\selectfont%
200 \textcircled{%
201 \raisebox{.12ex}{\fontsize{\chardim}{\baselineskip}\selectfont{CC}}%
202 }
203 }
204 \fontfamily{\origfontfamily}\fontseries{\origfontseries}\selectfont
205 }
206 % \end{macrocode}
207 %
208 % \DescribeMacro{\text@ccnd}
209 % The ``NoDerivs'' (no derivative works allowed) icon indicates that you may
210 % not alter, transform, or build upon this work. It shows an equal sign into a
211 % circle.
212 % \begin{macrocode}
213 \DeclareTextCommandDefault{\text@ccnd}{%
214 \let\origfontfamily\f@family
215 \let\origfontseries\f@series
216 \chardim\fontdimen6\font
217 \divide\chardim by 2
218 {
219 \fontfamily{phv}\fontseries{b}\selectfont%
220 \textcircled{%
221 \raisebox{.20ex}{\fontsize{\chardim}{\baselineskip}\selectfont{=}}%
222 }
223 }
224 \fontfamily{\origfontfamily}\fontseries{\origfontseries}\selectfont
225 }
226 % \end{macrocode}
227 %
228 % \DescribeMacro{\text@ccby}
229 % The ``Attribution'' logo, introduced in version 2 of the Creative Commons
230 % license, forces to give the original author credit. It's a must have
231 % attribute, that is typeset as a \textsc{by:} string surrounded by a circle.
232 % \begin{macrocode}
233 \DeclareTextCommandDefault{\text@ccby}{%
234 \let\origfontfamily\f@family
235 \let\origfontseries\f@series
236 \chardim\fontdimen6\font
237 \divide\chardim by 2
238 {
239 \fontfamily{phv}\fontseries{b}\selectfont%
240 \textcircled{%
241 \raisebox{.5pt}{\fontsize{\chardim}{\baselineskip}\selectfont%
242 {B\kern -.15em Y\kern -.15em:}}%
243 }
244 }
245 \fontfamily{\origfontfamily}\fontseries{\origfontseries}\selectfont
246 }
247 % \end{macrocode}
248 %
249 % \DescribeMacro{\text@ccnc}
250 % The ``NonCommercial'' logo has a barred USD symbol, surrounded by the usual
251 % circle. Since I used a \texttt{rotate} environment to typeset this logo,
252 % you may experience some troubles when viewing the \texttt{.dvi} document
253 % including this logo.
254 % \begin{macrocode}
255 \DeclareTextCommandDefault{\text@ccnc}{%
256 \let\origfontfamily\f@family
257 \let\origfontseries\f@series
258 \chardim\fontdimen6\font
259 \divide\chardim by 2
260 {
261 \fontfamily{phv}\fontseries{b}\selectfont%
262 \textcircled{%
263 \raisebox{.15ex}{\fontsize{\chardim}{\baselineskip}\selectfont%
264 \makebox[0cm][c]{\$}}%
265 \setlength{\chardim}{1.98\chardim}%
266 \fontsize{\chardim}{\baselineskip}\selectfont%
267 \raisebox{-.20ex}{\begin{rotate}{45}\textbackslash\end{rotate}}%
268 }
269 }
270 \fontfamily{\origfontfamily}\fontseries{\origfontseries}\selectfont
271 }
272 % \end{macrocode}
273 %
274 % \DescribeMacro{\text@ccsa}
275 % The ``Share-alike'' logo shows a reversed C with a strange serif: an arrow
276 % that points down. \emph{\c Ca va sans dire}, circled.
277 % \begin{macrocode}
278 \DeclareTextCommandDefault{\text@ccsa}{%
279 \let\origfontfamily\f@family
280 \let\origfontseries\f@series
281 \fontfamily{phv}\fontseries{b}\selectfont%
282 % \hskip.3em
283 \textcircled{%
284 \makebox[1em][l]{
285 \raisebox{.95ex}{\hskip-.45ex
286 \begin{rotate}{180}\scshape{c}\end{rotate}}}%
287 \chardim\fontdimen6\font
288 \divide\chardim by 6
289 \raisebox{.3ex}{\hspace{-5ex}
290 \SA@arrow}
291 }
292 \fontfamily{\origfontfamily}\fontseries{\origfontseries}\selectfont
293 }
294 % \end{macrocode}
295 %
296 % The following code defines the robust commands to typeset the logos: you can
297 % now use them in text mode and in math mode.
298 %
299 % \begin{macrocode}
300 \DeclareRobustCommand{\cc}{%
301 \ifmmode{\nfss@text{\text@cc}}\else\text@cc\fi}
302 \DeclareRobustCommand{\ccnd}{%
303 \ifmmode{\nfss@text{\text@ccnd}}\else\text@ccnd\fi}
304 \DeclareRobustCommand{\ccby}{%
305 \ifmmode{\nfss@text{\text@ccby}}\else\text@ccby\fi}
306 \DeclareRobustCommand{\ccnc}{%
307 \ifmmode{\nfss@text{\text@ccnc}}\else\text@ccnc\fi}
308 \DeclareRobustCommand{\ccsa}{%
309 \ifmmode{\nfss@text{\text@ccsa}}\else\text@ccsa\fi}
310 % \end{macrocode}
311 %
312 % Here are the commands that define the 11 \CC\ licenses. The licenses
313 % preceded by the ``attribution'' icon are \CC\ version 2.0, the others are
314 % version 1.0.
315 % \begin{macrocode}
316 \newcommand{\by}{\ccby}
317 \newcommand{\bynd}{\ccby\ccnd}
318 \newcommand{\byncnd}{\ccby\ccnc\ccnd}
319 \newcommand{\bync}{\ccby\ccnc}
320 \newcommand{\byncsa}{\ccby\ccnc\ccsa}
321 \newcommand{\bysa}{\ccby\ccsa}
322 \newcommand{\nd}{\ccnd}
323 \newcommand{\ndnc}{\ccnd\ccnc}
324 \newcommand{\nc}{\ccnc}
325 \newcommand{\ncsa}{\ccnc\ccsa}
326 \newcommand{\sa}{\ccsa}
327 \endinput
328 % \end{macrocode}
329 % \Finale
330 % \endinput