summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/dlfltxb/dlfltxbmisc.tex
blob: 0454d2a2a0d39a0eeb085a769ccf924a995f3a4b (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
\RequirePackage{etex}
\documentclass[11pt,oneside,a4paper,oldfontcommands,danish,english,article]{memoir}
\usepackage[T1]{fontenc}
\usepackage[widespace]{fourier}
\usepackage{babel}
\usepackage{calc,amsmath}
\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}

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

\checkandfixthelayout

\hfuzz=30pt

\usepackage{color}
\usepackage[colorlinks,breaklinks]{hyperref}
\definecolor{linkcolour}{rgb}{0,0.2,0.6}
\definecolor{citecolour}{rgb}{0,0.6,0.2}
\definecolor{urlcolour} {rgb}{0.8,0,0.8}

\hypersetup{
  pdftitle={The dlfltxbmisc 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}

\clubpenalty=300
\widowpenalty=300

\usepackage{microtype}


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


\begin{document}

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

\noindent
This package provides a variety of macros that are used for
\cite{ltxb}.

\section{For typesetting arguments}

\begin{flushleft}
  \NoMarginparAvailtrue
  \begin{tabularx}{\textwidth}{XX}
    \markup{Arg}\marg{text} & \Arg{text} \\
    \markup{Arg*}\marg{text} & \Arg*{text} \\
    \markup{marg}\marg{text} & \marg{text} \\
    \markup{marg*}\marg{text} & \marg*{text} \\
    \markup{oarg}\marg{text} & \oarg{text} \\
    \markup{oarg*}\marg{text} & \oarg*{text} \\
    \markup{parg}\marg{text} & \parg{text} \\
    \markup{parg*}\marg{text} & \parg*{text} \\
  \end{tabularx}
\end{flushleft}

\section{Syntax}
\label{sec:syntax}



Environments \markup[env]{syntax} and \markup[env]{syntax*} for
explaining syntax. In the unstared version \markup[nomk]{obeylines} is
in effect and \cs{}\cs{} is disabled. In the stared version we are in
a normal situation and \cs{}\cs{} has its normal line changing
behavior. Text contents of the two environments are indented by
\markup[nomk,length]{parindent}.

\section{Special wrapping urls in bibliographies}
\label{sec:spec-wrapp-urls}

In the bibliography of \cite{ltxb} we refer to a lot of \LaTeX\
packages and their URLs on \textsc{ctan}. In order to make those URLs
look nice and space some space the URL wraps it self up into the
bibliography item above. The effect can be seen here:
\medskip
\noindent
\begin{adjustwidth}{\bibhang}{0pt}
  text text text text text text
  text text text text text\qquad
  \addurl{http://www.imf.au.dk/system/latex/bog/}{}
\end{adjustwidth}

The effect is achieved with the macro
\begin{syntax}
  \markup{addurl}\oarg{pre text}\marg{url}\marg{see below}
\end{syntax}
\markup[nomk]{addurl} is only intended to be used in bibliographies,
i.e. inside the \markup[nomk]{thebibliography} environment (it uses
\markup[nomk,length]{bibhang} internally).  The macro was created to
be used with Bib\TeX, where one adds it as the very last item in the
>>\texttt{note}<< field. As most Bib\TeX\ styles add a >>\texttt{.}<<
at the end of the entry we simply let \markup[nomk]{addurl} `eat' that
>>\texttt{.}<< by just specifying the first argument. So if you use
this macro by hand (i.e.\ not using Bib\TeX), you will need to specify
the last argument as an empty argument. By default \oarg{pre text} is
set to >>\verb+\textsc{url}:+<<.

\markup[nomk]{addurl} works this way:
\begin{enumerate}[(i)]
\item \label{item:1} We start a new paragraph and measure the length
  of the last line in the preceding paragraph.
\item In the new paragraph we set everything
  \markup[nomk]{RaggedLeft}, and start the text by setting a
  phantom-like width corresponding to the measured length found
  in~\eqref{item:1}. If the measured length is larger than
  0.6\markup[nomk]{linewidth}, then we do not activate the wrapping,
  instead the URL is just typeset ragged left below the bibliographic
  entry. 
\item Then we simply typeset the URL using \markup[nomk]{url}.
\end{enumerate}

There is one small problem with \markup[nomk]{addurl}: If we get close
to a page break the wrapping URL may be moved to the next page. One
method for fixing this is to make \markup[nomk,length]{itemsep} more
flexible inside the \markup[nomk,env]{thebibliography}, for example
using
\begin{verbatim}
\let\oldthebibliography\thebibliography
\renewcommand\thebibliography[1]{%
  \oldthebibliography{#1}%
  \setlength\itemsep{10pt plus 3pt minus 5pt}
}
\end{verbatim}

Additionally, we also have a \markup[nomk]{addCTAN} macro where the
argument will be replaced by (if using \markup[nomk,sty]{hyperref})
\begin{verbatim}
\href{http://mirror.ctan.org/#2}{#1\path{#2}}
\end{verbatim}
e.g. \verb+\addCTAN{/fonts/kpfonts/}+ $\to$
\begin{verbatim}
\href{http://mirror.ctan.org/fonts/kpfonts}{\textsc{ctan}:\path{#2}}
\end{verbatim}

Since \verb?\addCTAN? is also useful in the regular text, we also
support a \markup{CTAN}\marg{path} macro.


\section{Example text in math}
\label{sec:example-text-math}

In \cite{ltxb} we use the macro \markup{dbx}\oarg{width} to illustrate
some math instead of writing random formulas. It just typesets \dbx\
where the width is adjustable using the optional argument.


\section{Acknowledgement}
\label{sec:acknodlegement}

Special thanks to Morten H\o gholm and Dan Luecking for their help
with various parts of \markup[nomk]{addurl}.


\bibliographystyle{plainnat}
\bibliography{package_doc}


\end{document}


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