\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: