Debian Codegraph @

texmf-dist/doc/latex/dlfltxb/dlfltxbmarkup.tex

raw
1 \RequirePackage{etex}
2 \documentclass[11pt,oneside,a4paper,oldfontcommands,danish,english,article]{memoir}
3 \usepackage[T1]{fontenc}
4 \usepackage[widespace]{fourier}
5 \usepackage{babel}
6 \usepackage{calc}
7 \usepackage[round]{natbib}
8
9 \makeatletter
10 \DeclareRobustCommand{\LaTeX}{L\kern-.28em%
11 {\sbox\z@ T%
12 \vbox to\ht\z@{\hbox{\check@mathfonts
13 \fontsize\sf@size\z@
14 \math@fontsfalse\selectfont
15 A}%
16 \vss}%
17 }%
18 \kern-.15em%
19 \TeX}
20 \makeatother
21
22 \setlxvchars[\normalfont]
23
24 \settypeblocksize{*}{1.3\lxvchars}{1.618}
25
26 % for print
27 \setlrmargins{*}{*}{1.6}
28 \setulmargins{*}{*}{1.3}
29
30 % for online
31 \setlrmargins{*}{*}{0.7}
32 \setulmargins{*}{*}{1}
33 \setlength\marginparwidth{4cm}
34
35 \checkandfixthelayout
36
37
38 \hfuzz=30pt
39
40 \newif\ifhyperlinks
41 \hyperlinksfalse
42 \hyperlinkstrue
43
44 \ifhyperlinks
45 \usepackage{nameref}
46 \fi
47
48 \ifhyperlinks
49 \usepackage{color}
50 \usepackage[colorlinks,breaklinks]{hyperref}
51 \definecolor{linkcolour}{rgb}{0,0.2,0.6}
52 \definecolor{citecolour}{rgb}{0,0.6,0.2}
53 % \definecolor{filecolor}{rgb}{0,0.2,0.6}
54 \definecolor{urlcolour} {rgb}{0.8,0,0.8}
55
56 \hypersetup{
57 pdftitle={The dlfltxbmarkup package},
58 pdfauthor={Copyright \textcopyright\ number\year\ Lars Madsen},
59 linkcolor=linkcolour,citecolor=citecolour,
60 filecolor=urlcolour,urlcolor=urlcolour,
61 plainpages=false,
62 }
63
64 \ifpdf\else\usepackage{breakurl}\fi
65 \usepackage{memhfixc}
66 \fi
67
68 \clubpenalty=300
69 \widowpenalty=300
70
71
72 \ifpdf
73 \usepackage[protrusion=true,expansion=true]{microtype}
74 \else
75 \usepackage[protrusion=true]{microtype}
76 \fi
77
78 \makeatother
79
80
81 \usepackage[loadsampleconfig]{dlfltxbmarkup}
82 \usepackage{dlfltxbmisc}
83
84 \renewcommand\felineMarginAdjustment{\RaggedLeft}
85
86 \setlength\marginparsep{2em}
87 \setlength\marginparwidth{3cm}
88
89 \chapterstyle{article}
90
91 \setsecheadstyle{\normalfont\large\bfseries\raggedright}
92
93
94 \reversemarginpar
95 \reversesidepartrue
96 \twocolumnfootnotes
97
98 \setsecnumdepth{part}
99
100 \pagestyle{plain}
101
102 \hyphenation{felineWrite-InMargin felineMargin-Adjustment}
103
104 \begin{document}
105
106 \title{The \textsf{dlfltxbmarkup} package\thanks{Version: 0.6}}
107 \author{Lars Madsen\thanks{Email: [email protected]}}
108 \maketitle
109
110 \noindent
111 This package implements the \markup[nomk]{markup} features that are
112 used extensively in \cite{ltxb}.
113
114
115 \section{Requirements}
116 \label{sec:requirements}
117
118 This package depends on several \markup[nomk,cls]{memoir} internals so
119 it can only be used together with the \markup[nomk,cls]{memoir}
120 class. Further requirements are \markup[nomk,sty]{keyval} and
121 \markup[nomk,sty]{ragged2e}.
122
123
124 \section{Usage}
125 \label{sec:usage}
126
127 The \markup[nomk]{markup} macro is intended to be used for
128 categorising various types of keywords. These can then be
129 automatically written in the text as well as in the (outer) margin and
130 added to the index.
131 \begin{syntax}
132 \markup{markup}\oarg{keys}\marg{text}
133 \end{syntax}
134 The key list is a mix of control keys and user defined category
135 keys. How to created the user defined keys are explained later.
136 The control keys are listed below.
137 \begingroup
138 \renewcommand\descriptionlabel[1]{%
139 \hspace\labelsep%
140 \settowidth\unitlength{\texttt{#1}}%
141 \addtolength\unitlength{\labelsep}%
142 \ifdim\unitlength>\leftmargin%
143 \parbox[t]{\textwidth}{\normalsize\texttt{#1}}%
144 \else%
145 \parbox[t]{\leftmargin-\labelsep}{\normalsize\texttt{#1}}%
146 \fi%
147 }
148 \begin{description}\firmlist\firmlist
149 \small
150 %\define@key{FelineIndex}{notxt} []{\@feline@txtfalse} % = nowr
151 \item[notxt] do not write anything in the text
152
153 %\define@key{FelineIndex}{nowr} []{\@feline@txtfalse} % no writing in text
154 \item[nowr] alias for \texttt{notxt}
155 %\define@key{FelineIndex}{nomk} []{\@feline@mrgnfalse} % no mark in margin
156 \item[nomk] do not write anything in the margin
157 %\define@key{FelineIndex}{noidx} []{\@feline@idxfalse} % no adding index
158 \item[noidx] do not add anything to the index
159 %\define@key{FelineIndex}{hsp} []{\@feline@hsptrue}
160 %\item[hsp] secret
161 % locally use a different index command
162 %\define@key{FelineIndex}{idxit} []{\renewcommand\feline@index@cmd{\itindex}}
163 \item[idxit] index entry in italic (i.e. page number in italic)
164 %\define@key{FelineIndex}{idxbf} []{\renewcommand\feline@index@cmd{\bfindex}}
165 \item[idxbf] index entry in bold face
166 %\define@key{FelineIndex}{idxn} []{\renewcommand\feline@index@cmd{\index}}
167 \item[idxn] normal index entry
168
169 %\define@key{FelineIndex}{addtospvrt}{\addtolength{\feline@spvs@addto}{#1\onelineskip}}
170 \item[addtospvrt=\Arg{number}] to be used in situations where we use
171 \markup[nomk]{sidepar} instead of \markup[nomk]{marginpar}. This key
172 will move the text further down in the margin. It is a unit-less
173 number (\markup[length,nomk]{onelineskip} is the unit).
174
175 %\define@key{FelineIndex}{vaddtosp} {\addtolength{\feline@spvs@addto}{#1\onelineskip}}
176
177 \item[vaddtosp=\Arg{number}] alias for \texttt{addtospvrt}
178
179 % force the use of \sidepar, don't think I've ever used this
180 %\define@key{FelineIndex}{forcesidepar}[true]{\dlf@M@setbool{#1}{@feline@forcesidepar}}
181 \item[forcesidepar] forces the use of \markup[nomk]{sidepar} instead
182 of \markup[nomk]{marginpar}
183
184 \end{description}
185 \endgroup
186 \noindent
187 The package has one option >>\texttt{loadsampleconfig}<< which
188 will auto load the\linebreak >>\path{dlfltxbmarkup-sample.cfg}<< sample file (which
189 actually contains the categories that I use for the creation of
190 \cite{ltxb}).
191
192
193 \section{Defining your own categories}
194 \label{sec:defining-your-own}
195
196 The main macro for defining your own category keys are
197 \begin{syntax*}
198 \markup{felineKeyGenerator}\marg{key}\marg{description}\marg{margin
199 code}\marg{index code}\marg{text code}
200 \end{syntax*}
201 In each of the last three arguments >>\texttt{\#1}<< will refer to the
202 mandatory argument given to \markup[nomk]{markup}. The reason for
203 adding the \Arg{description} part will be explained later. For the
204 code to be used in the three last arguments we have a few helper
205 macros that might be useful
206 \begin{syntax}
207 \markup{cs}\marg{text}
208 \end{syntax}
209 for writing the name of \LaTeX\ macros.
210 \begin{syntax}
211 \markup{css}\marg{text}
212 \end{syntax}
213 like \markup[nomk]{cs} but to be used in the index, it will typeset
214 the >>\verb+\+<< in the left margin.
215 \begin{syntax}
216 \markup{felineWriteInMargin}\marg{text}
217 \end{syntax}
218 Depending on whether \markup{NoMarginparAvail} is true or not,
219 it will use \markup[nomk]{sidepar} (when \markup[nomk]{marginpar} is
220 unavailable) and \markup[nomk]{marginpar} otherwise (unless of course the
221 >>\texttt{forcesidepar}<< key is in effect). A
222 \markup[nomk]{marginpar} can for example not be used from inside a
223 \markup[nomk,env]{framed} or \markup[nomk,env]{shaded} environment. So
224 in such an environment one can just make sure that
225 \markup[nomk]{NoMarginparAvail} is set to true and then we will still
226 have some thing in the margin. It is recommended to use
227 \begin{syntax}
228 \markup{strictpagechecktrue}
229 \end{syntax}
230 in order to get more rigorous side checking. Internally we use
231 \markup[nomk]{checkoddpage} and \markup[nomk]{ifodd} to test whether
232 we are in the left or right margin. We also use
233 \begin{syntax}
234 \markup{felineMarginAdjustment}
235 \end{syntax}
236 to ensure that the margin text has the correct adjustment. The default
237 setting is
238 \begin{verbatim}
239 \newcommand\felineMarginAdjustment{%
240 \ifoddpage\RaggedRight\else\RaggedLeft\fi}
241 \end{verbatim}
242 In this documentation which is not twosided, it has been redefined to
243 be \markup[nomk]{RaggedLeft}.
244
245
246 For index entries we recommend the use of
247 \begin{syntax}
248 \markup{felineIndexCmd}
249 \end{syntax}
250 which initially is defined to be \markup[nomk]{index}. The
251 >>\texttt{idxit}<< control key redefines it to be
252 \markup[nomk]{itindex}, which is
253 \begin{verbatim}
254 \newcommand\itindex[1]{\index{#1|textitindex}}
255 \end{verbatim}
256 where \markup[nomk]{textitindex} is just
257 \markup[nomk]{textit}. Similar for >>\texttt{idxbf}<<.
258
259 Let us now create a category key for \LaTeX\ packages.
260 \begin{verbatim}
261 \felineKeyGenerator{sty}%
262 {for registering package names}%
263 {\felineWriteInMargin{\foreignlanguage{english}{#1}}}%
264 {\felineIndexCmd{#1 (package)@#1 (package)}%
265 \felineIndexCmd{packages!#1}}%
266 {\foreignlanguage{english}{\texttt{\hyphenchar\font=`\-#1}}}
267 \end{verbatim}
268 The rather odd last line is to ensure that the package name is written
269 under English hyphenation rules, and the
270 >>\verb+\hyphenchar\font=`\-+<< is to ensure that we can get
271 hyphenation in the typewriter font. As you can see we create two index
272 entries, one for the name it self (marking it as the name of a
273 package) and one as a sub item to a list of mentioned packages.
274
275 Here is another key for mathematical symbols
276 \begin{verbatim}
277 \def\felinenameuse#1{\@nameuse{#1}}
278 \felineKeyGenerator{msym}%
279 {mathematical symbols}
280 {\felineWriteInMargin{\cs{#1} \textnormal{($\@nameuse{#1}$)}}}%
281 {\felineIndexCmd{#1@\protect\css{#1} ($\protect\felinenameuse{#1}$)}}%
282 {\cs{#1}}
283 \end{verbatim}
284 \verb+\@nameuse+ is used to transform the name of the macro into the
285 macro it self (for those that didn't already know
286 \verb+\@nameuse+). The shortcut \markup[nomk]{felinenameuse} is used
287 here because \verb+\@nameuse+ might not be permissible in the index
288 (because of the >>\texttt{@}<<.
289
290 You can place these keys either in your preamble or in
291 >>\path{dlfltxbmarkup.cfg}<< which will be auto loaded if found. If
292 you have used the package option >>\texttt{loadsampleconfig}<<
293 then >>\texttt{dlfltxbmarkup-sample.cfg}<< will be loaded at the very end of
294 the package, i.e. \emph{after} >>\texttt{dlfltxbmarkup-sample.cfg}<<.
295
296 The default category key to be used by \markup[nomk]{markup} is
297 controlled by
298 \begin{syntax}
299 \markup{felineStandardKey}
300 \end{syntax}
301 Just redefine it to be the key you want. Notice that by using
302 >>\texttt{loadsampleconfig}<< the default key is set to
303 >>\texttt{macro}<<.
304
305 \section{The descriptions}
306 \label{sec:descriptions}
307
308 For a long project like \cite{ltxb} the list of category keys may grow
309 quite big, and one might loose track of the keys and what they should
310 be used for. Under normal use of the this package, the description is
311 ignored. But internally in \markup[nomk]{felineKeyGenerator} we call
312 the macro \markup{felineMarkupDescription} with all five arguments. By
313 default it does nothing. But the user can define it to do something
314 before loading the package.
315
316 Located with this manual you should find the file
317 >>dlfltxbmarkup-showkeys.tex<< which will print a new document showing
318 they keys and their description. If you move a \texttt{\%} in that
319 file you will get a list of the keys used for \cite{ltxb}.
320
321
322 \bibliographystyle{plainnat}
323 \bibliography{package_doc}
324
325
326 \end{document}
327
328
329 %%% Local Variables:
330 %%% mode: latex
331 %%% TeX-master: t
332 %%% End:
333