summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/dlfltxb/dlfltxbmarkup.tex
blob: 2fc969ca62a8446dd490f8f8a69fc75adffcf984 (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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
\RequirePackage{etex}
\documentclass[11pt,oneside,a4paper,oldfontcommands,danish,english,article]{memoir}
\usepackage[T1]{fontenc}
\usepackage[widespace]{fourier}
\usepackage{babel}
\usepackage{calc}
\usepackage[round]{natbib}

\makeatletter
\DeclareRobustCommand{\LaTeX}{L\kern-.28em%
        {\sbox\z@ T%
         \vbox to\ht\z@{\hbox{\check@mathfonts
                              \fontsize\sf@size\z@
                              \math@fontsfalse\selectfont
                              A}%
                        \vss}%
        }%
        \kern-.15em%
        \TeX}
\makeatother

\setlxvchars[\normalfont]

\settypeblocksize{*}{1.3\lxvchars}{1.618}

% for print
\setlrmargins{*}{*}{1.6}
\setulmargins{*}{*}{1.3}

% for online
\setlrmargins{*}{*}{0.7}
\setulmargins{*}{*}{1}
\setlength\marginparwidth{4cm}

\checkandfixthelayout


\hfuzz=30pt

\newif\ifhyperlinks
\hyperlinksfalse
\hyperlinkstrue

\ifhyperlinks 
\usepackage{nameref}
\fi

\ifhyperlinks
  \usepackage{color}
  \usepackage[colorlinks,breaklinks]{hyperref}
  \definecolor{linkcolour}{rgb}{0,0.2,0.6}
  \definecolor{citecolour}{rgb}{0,0.6,0.2}
  % \definecolor{filecolor}{rgb}{0,0.2,0.6}
  \definecolor{urlcolour} {rgb}{0.8,0,0.8}
  
  \hypersetup{
    pdftitle={The dlfltxbmarkup package},
    pdfauthor={Copyright \textcopyright\ number\year\ Lars Madsen},
    linkcolor=linkcolour,citecolor=citecolour,
    filecolor=urlcolour,urlcolor=urlcolour,
    plainpages=false,
  }
  
  \ifpdf\else\usepackage{breakurl}\fi
  \usepackage{memhfixc}
\fi

\clubpenalty=300
\widowpenalty=300


\ifpdf
\usepackage[protrusion=true,expansion=true]{microtype}
\else
\usepackage[protrusion=true]{microtype}
\fi

\makeatother


\usepackage[loadsampleconfig]{dlfltxbmarkup}
\usepackage{dlfltxbmisc}

\renewcommand\felineMarginAdjustment{\RaggedLeft}

\setlength\marginparsep{2em}
\setlength\marginparwidth{3cm}

\chapterstyle{article}

\setsecheadstyle{\normalfont\large\bfseries\raggedright}


\reversemarginpar
\reversesidepartrue
\twocolumnfootnotes

\setsecnumdepth{part}

\pagestyle{plain}

\hyphenation{felineWrite-InMargin felineMargin-Adjustment}

\begin{document}

\title{The \textsf{dlfltxbmarkup} package\thanks{Version: 0.6}}
\author{Lars Madsen\thanks{Email: daleif@imf.au.dk}}
\maketitle

\noindent
This package implements the \markup[nomk]{markup} features that are
used extensively in \cite{ltxb}.


\section{Requirements}
\label{sec:requirements}

This package depends on several \markup[nomk,cls]{memoir} internals so
it can only be used together with the \markup[nomk,cls]{memoir}
class. Further requirements are \markup[nomk,sty]{keyval} and
\markup[nomk,sty]{ragged2e}. 


\section{Usage}
\label{sec:usage}

The \markup[nomk]{markup} macro is intended to be used for
categorising various types of keywords. These can then be
automatically written in the text as well as in the (outer) margin and 
added to the index.
\begin{syntax}
  \markup{markup}\oarg{keys}\marg{text}
\end{syntax}
The key list is a mix of control keys and user defined category
keys. How to created the user defined keys are explained later.
The control keys are listed below.
\begingroup
\renewcommand\descriptionlabel[1]{%
  \hspace\labelsep%
  \settowidth\unitlength{\texttt{#1}}%
  \addtolength\unitlength{\labelsep}%
  \ifdim\unitlength>\leftmargin%
    \parbox[t]{\textwidth}{\normalsize\texttt{#1}}%
  \else%
    \parbox[t]{\leftmargin-\labelsep}{\normalsize\texttt{#1}}%
  \fi%
}
\begin{description}\firmlist\firmlist
\small
%\define@key{FelineIndex}{notxt} []{\@feline@txtfalse}  % = nowr
\item[notxt] do not write anything in the text

%\define@key{FelineIndex}{nowr}  []{\@feline@txtfalse}  % no writing in text
\item[nowr] alias for \texttt{notxt}
%\define@key{FelineIndex}{nomk}  []{\@feline@mrgnfalse} % no mark in margin
\item[nomk] do not write anything in the margin
%\define@key{FelineIndex}{noidx} []{\@feline@idxfalse}  % no adding index
\item[noidx] do not add anything to the index
%\define@key{FelineIndex}{hsp}   []{\@feline@hsptrue}
%\item[hsp] secret
% locally use a different index command
%\define@key{FelineIndex}{idxit} []{\renewcommand\feline@index@cmd{\itindex}}
\item[idxit] index entry in italic (i.e. page number in italic)
%\define@key{FelineIndex}{idxbf} []{\renewcommand\feline@index@cmd{\bfindex}}
\item[idxbf] index entry in bold face
%\define@key{FelineIndex}{idxn}  []{\renewcommand\feline@index@cmd{\index}}
\item[idxn] normal index entry

%\define@key{FelineIndex}{addtospvrt}{\addtolength{\feline@spvs@addto}{#1\onelineskip}}
\item[addtospvrt=\Arg{number}] to be used in situations where we use
  \markup[nomk]{sidepar} instead of \markup[nomk]{marginpar}. This key
  will move the text further down in the margin. It is a unit-less
  number (\markup[length,nomk]{onelineskip} is the unit).

%\define@key{FelineIndex}{vaddtosp}  {\addtolength{\feline@spvs@addto}{#1\onelineskip}}

\item[vaddtosp=\Arg{number}] alias for \texttt{addtospvrt}

% force the use of \sidepar, don't think I've ever used this
%\define@key{FelineIndex}{forcesidepar}[true]{\dlf@M@setbool{#1}{@feline@forcesidepar}}
 \item[forcesidepar] forces the use of \markup[nomk]{sidepar} instead
   of \markup[nomk]{marginpar}

\end{description}
\endgroup
\noindent
The package has one option >>\texttt{loadsampleconfig}<< which
will auto load the\linebreak >>\path{dlfltxbmarkup-sample.cfg}<< sample file (which
actually contains the categories that I use for the creation of
\cite{ltxb}). 


\section{Defining your own categories}
\label{sec:defining-your-own}

The main macro for defining your own category keys are
\begin{syntax*}
  \markup{felineKeyGenerator}\marg{key}\marg{description}\marg{margin
    code}\marg{index code}\marg{text code}
\end{syntax*}
In each of the last three arguments >>\texttt{\#1}<< will refer to the
mandatory argument given to \markup[nomk]{markup}. The reason for
adding the \Arg{description} part will be explained later. For the
code to be used in the three last arguments we have a few helper
macros that might be useful
\begin{syntax}
  \markup{cs}\marg{text}
\end{syntax}
for writing the name of \LaTeX\ macros.
\begin{syntax}
  \markup{css}\marg{text}
\end{syntax}
like \markup[nomk]{cs} but to be used in the index, it will typeset
the >>\verb+\+<< in the left margin.
\begin{syntax}
  \markup{felineWriteInMargin}\marg{text}
\end{syntax}
Depending on whether \markup{NoMarginparAvail} is true or not,
it will use \markup[nomk]{sidepar} (when \markup[nomk]{marginpar} is
unavailable) and \markup[nomk]{marginpar} otherwise (unless of course the
>>\texttt{forcesidepar}<< key is in effect). A
\markup[nomk]{marginpar} can for example not be used from inside a
\markup[nomk,env]{framed} or \markup[nomk,env]{shaded} environment. So
in such an environment one can just make sure that
\markup[nomk]{NoMarginparAvail} is set to true and then we will still
have some thing in the margin. It is recommended to use 
\begin{syntax}
  \markup{strictpagechecktrue}
\end{syntax}
in order to get more rigorous side checking. Internally we use
\markup[nomk]{checkoddpage} and \markup[nomk]{ifodd} to test whether
we are in the left or right margin. We also use
\begin{syntax}
  \markup{felineMarginAdjustment}
\end{syntax}
to ensure that the margin text has the correct adjustment. The default
setting is
\begin{verbatim}
\newcommand\felineMarginAdjustment{%
  \ifoddpage\RaggedRight\else\RaggedLeft\fi}
\end{verbatim}
In this documentation which is not twosided, it has been redefined to
be \markup[nomk]{RaggedLeft}.


For index entries we recommend the use of
\begin{syntax}
  \markup{felineIndexCmd}
\end{syntax}
which initially is defined to be \markup[nomk]{index}. The
>>\texttt{idxit}<< control key redefines it to be
\markup[nomk]{itindex}, which is
\begin{verbatim}
\newcommand\itindex[1]{\index{#1|textitindex}}
\end{verbatim}
where \markup[nomk]{textitindex} is just
\markup[nomk]{textit}. Similar for >>\texttt{idxbf}<<.

Let us now create a category key for \LaTeX\ packages.
\begin{verbatim}
\felineKeyGenerator{sty}%
  {for registering package names}%
  {\felineWriteInMargin{\foreignlanguage{english}{#1}}}%
  {\felineIndexCmd{#1 (package)@#1 (package)}%
    \felineIndexCmd{packages!#1}}%
  {\foreignlanguage{english}{\texttt{\hyphenchar\font=`\-#1}}}
\end{verbatim}
The rather odd last line is to ensure that the package name is written
under English hyphenation rules, and the
>>\verb+\hyphenchar\font=`\-+<< is to ensure that we can get
hyphenation in the typewriter font. As you can see we create two index
entries, one for the name it self (marking it as the name of a
package) and one as a sub item to a list of mentioned packages.

Here is another key for mathematical symbols
\begin{verbatim}
\def\felinenameuse#1{\@nameuse{#1}}
\felineKeyGenerator{msym}%
  {mathematical symbols}
  {\felineWriteInMargin{\cs{#1} \textnormal{($\@nameuse{#1}$)}}}%
  {\felineIndexCmd{#1@\protect\css{#1} ($\protect\felinenameuse{#1}$)}}%
  {\cs{#1}}
\end{verbatim}
\verb+\@nameuse+ is used to transform the name of the macro into the
macro it self (for those that didn't already know
\verb+\@nameuse+). The shortcut \markup[nomk]{felinenameuse} is used
here because \verb+\@nameuse+ might not be permissible in the index
(because of the >>\texttt{@}<<.

You can place these keys either in your preamble or in
>>\path{dlfltxbmarkup.cfg}<< which will be auto loaded if found. If
you have used the package option >>\texttt{loadsampleconfig}<<
then >>\texttt{dlfltxbmarkup-sample.cfg}<< will be loaded at the very end of
the package, i.e. \emph{after} >>\texttt{dlfltxbmarkup-sample.cfg}<<.

The default category key to be used by \markup[nomk]{markup} is
controlled by
\begin{syntax}
  \markup{felineStandardKey}
\end{syntax}
Just redefine it to be the key you want. Notice that by using
>>\texttt{loadsampleconfig}<< the default key is set to
>>\texttt{macro}<<. 

\section{The descriptions}
\label{sec:descriptions}

For a long project like \cite{ltxb} the list of category keys may grow
quite big, and one might loose track of the keys and what they should
be used for. Under normal use of the this package, the description is
ignored. But internally in \markup[nomk]{felineKeyGenerator} we call
the macro \markup{felineMarkupDescription} with all five arguments. By
default it does nothing. But the user can define it to do something
before loading the package.

Located with this manual you should find the file
>>dlfltxbmarkup-showkeys.tex<< which will print a new document showing
they keys and their description. If you move a \texttt{\%} in that
file you will get a list of the keys used for \cite{ltxb}.


\bibliographystyle{plainnat}
\bibliography{package_doc}


\end{document}


%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: