Debian Codegraph @

texmf-dist/doc/latex/memexsupp/memexsupp.tex

raw
1 \documentclass[
2 a4paper,
3 11pt,
4 article
5 ]{memoir}
6 \usepackage[latin1]{inputenc}
7 \usepackage[english]{babel}
8 \usepackage[T1]{fontenc}
9 \usepackage[widespace]{fourier}
10 \usepackage{memexsupp}
11 \pagestyle{headings}
12 \setsecnumdepth{part}
13 \setlength\cftbeforechapterskip{0pt}
14
15
16 \makeatletter
17 \newcommand*\Arg@s[1]{\textnormal{\texttt{#1}}}%
18 \newcommand*\Arg@n[1]{\textnormal{$\langle$\textit{#1}$\rangle$}}%
19 \newcommand*\Arg{\@ifstar{\Arg@s}{\Arg@n}}%
20 \newcommand*\marg@s[1]{\textnormal{\texttt{\{#1\}}}}
21 \newcommand*\marg@n[1]{%
22 \textnormal{\texttt{\{}$\langle$\textit{#1}$\rangle$\texttt{\}}}%
23 }
24 \renewcommand*\marg{\@ifstar{\marg@s}{\marg@n}}
25
26 \newcommand*\oarg@s[1]{\textnormal{\texttt{[#1]}}}
27 \newcommand*\oarg@n[1]{%
28 \textnormal{\texttt{[}$\langle$\textit{#1}$\rangle$\texttt{]}}%
29 }
30 \renewcommand*\oarg{\@ifstar{\oarg@s}{\oarg@n}}
31 \providecommand*\cs[1]{\textnormal{\texttt{\symbol{'134}#1}}}
32 \newenvironment{syntax}{%
33 \vskip.5\onelineskip%
34 \begin{adjustwidth}{\parindent}{0pt}
35 \parindent=0pt%
36 \obeylines%
37 \let\\=\relax%
38 }{%
39 \end{adjustwidth}%
40 \vskip.5\onelineskip%
41 }
42 \newoutputstream{SCS}
43 \newenvironment{SCSexample}{%
44 \openoutputfile{\jobname.ex}{SCS}%
45 \begingroup
46 \writeverbatim{SCS}%
47 }{%
48 \endwriteverbatim\relax%
49 \endgroup
50 \closeoutputstream{SCS}%
51 \verbatiminput{\jobname.ex}%
52 {\begin{minipage}{\linewidth-4mm}
53 \input{\jobname.ex}\end{minipage}}%
54 \par\bigskip\noindent
55 }
56 \makeatother
57
58
59 \begin{document}
60
61 \title{The Memoir Experimental Support package}
62 \author{Lars Madsen\thanks{Email: [email protected]}%
63 \thanks{Version: 0.1, 2008/03/20}}
64
65 \maketitle
66
67 \tableofcontents*
68
69
70 \chapter{Introduction}
71 \label{cha:introduction}
72
73 This package is meant as a sort of experimental playing
74 ground for code that at some later point might make it into
75 the memoir core.
76
77 Anyone with an interest in improving the memoir class is
78 encouraged to participate.
79
80 Whenever Peter Wilson decides to include something from this package
81 into the memoir core, this package will be updated and the macros,
82 earlier provided here, will be removed. For this reason, we
83 have prefixed all user macros with >>\verb+MXS+<<.
84
85 It is also the idea that the package by it self does not
86 alter anything in memoir by just loading the package. The
87 user has to do something actively to use the features in
88 this package.
89
90 \chapter{Making marks for page styles}
91 \label{cha:making-marks-page}
92
93 One of memoirs advantages over the standard classes is it much
94 improved system of page style. The page styles are often broken out
95 over different names, such as >>\verb+chapter+<< for chapter title
96 pages or >>\verb+cleared+<< for blank pages before a right-hand-side
97 chapter (via \verb+\cleardoublepage+). These styles can easily be
98 redefined or \emph{aliased}.
99
100 The downside of this improved system is that even though page styles
101 are now easy to handle, creating the \verb+\...mark+ commands is still
102 hard to understand for a novice, who might just want the standard
103 headers but without the uppercase stuff.
104
105 In an ealier version of this document we suggested some generic macros
106 for helping users to create these \verb+\...mark+ macros. Those older
107 macros was not particularly user friendly. In contrast, most users are
108 more or less happy with the usual \verb+\...mark+ definitions, though
109 they sometimes would like to change them a little bit. To help with
110 this we have created the following macros:
111 \begin{syntax}
112 \cs{MXScreatesimplemark}\marg{type}\marg{text}
113 \cs{MXScreatemark}\marg{type}\marg{macro-type}\marg{visib.}\marg{prefix}\marg{postfix}
114 \cs{MXSaddtopsmarks}\marg{pagestyle}\marg{before}\marg{after}
115 \end{syntax}
116 Explanation:
117 \begin{verbatim}
118 \MXScreatesimplemark{toc}{\contentsname}
119 \end{verbatim}
120 is the same as \cs{tocmark} being equal
121 to
122 \begin{verbatim}
123 \markboth{\memUChead{\contentsname}}{\memUChead{\contentsname}}
124 \end{verbatim}
125 where \verb+\memUChead+ is an internal memoir macro introduced in
126 MemPatch version 4.9a. Use the simple mark construction for
127 \texttt{toc}, \texttt{lot}, \texttt{lof}, \texttt{bib} and
128 \texttt{index}.
129
130 The in pseudo-code the \cs{MXScreatemark} macro corresponds to:
131 \begin{syntax}\ttfamily
132 if section or chapter number required
133 \qquad if mainmatter
134 \qquad\qquad if \Arg{visib.} equal \emph{true}
135 \qquad\qquad\qquad\Arg{prefix}\Arg{corresponding sectional number}\Arg{postfix}
136 \qquad\qquad end if
137 \qquad end if
138 end if
139 \Arg{the title given by \cs{chapter} etc.}
140 \end{syntax}
141 Whether this is given to \verb+\markright+ or \verb+\markboth+,
142 depends on the value of \Arg{macro-type}, possible values are:
143 \emph{both} or \emph{right}. The \Arg{type} here corresponds to
144 \texttt{chapter}, \texttt{section}, \texttt{subsection}, and
145 \texttt{subsubsection}.
146
147 Using \cs{MXSaddtopsmarks} one can add code at the beginning or the
148 end of an existing ps marks registration. The syntax for the last two
149 arguments is the same as for memoirs \verb+\addto+ macro.
150
151 Using the constructions above the marks settings for memoirs default
152 pagestyle, \emph{headings} can now be written as (for a twoside setup)
153 \begin{verbatim}
154 \makeatletter
155 \makepsmarks{headings}{
156 \MXScreatemark{chapter}{both}{true}{\@chapapp\ }{. \ }
157 \MXScreatemark{section}{right}{true}{}{. \ }
158 \MXScreatesimplemark{toc}{\contentsname}
159 \MXScreatesimplemark{lof}{\listfigurename}
160 \MXScreatesimplemark{lot}{\listtablename}
161 \MXScreatesimplemark{bib}{\bibname}
162 \MXScreatesimplemark{index}{\indexname}
163 }
164 \makeatother
165 \end{verbatim}
166 where \verb+\@chapapp+ is a standard macro which under normal
167 circumstances holds the chapter name, but under an appendix holds the
168 appendix name. Note the dots and the spaces. Quite clearly a lot
169 easier to understand than the actual code in the memoir source.
170
171 As one notices the standard \emph{headings} only includes marks for
172 chapter and section. But this is easy to fix:
173 \begin{verbatim}
174 \MXSaddtopsmarks{headings}{}% not adding anything at the beginning
175 {
176 \MXScreatemark{subsection}{right}{true}{}{. \ }
177 \MXScreatemark{subsubsection}{right}{true}{}{. \ }
178 }
179 \end{verbatim}
180 And if we just wanted to add the titles, but not the numbers, then
181 change \emph{true} to \emph{false}.
182
183
184 % Hence enter \verb+\MXSMakeSectionalMarks+:
185 % \begin{syntax}
186 % \verb+\MXSMakeSectionalMarks+\oarg{secname}
187 % \end{syntax}
188 % \Arg{secname} has its usual meaning from \cite{memman}.
189 % This macro is meant to be used as in
190 % \begin{syntax}
191 % \verb+\makepsmarks{mystyle}{\MXSMakeSectionalMarks[subsection]}+
192 % \end{syntax}
193 % Which will create \verb+\...mark+ commands for >>\texttt{chapter}<<,
194 % >>\texttt{section}<< and >>\texttt{subsection}<<, leaving
195 % >>\texttt{subsubsection}<< firing blanks.
196
197 % Internally \verb+\MXSMakeSectionalMarks+ will use
198 % \begin{syntax}
199 % \verb+\MXSDefineChapterMark+\marg{code}
200 % \verb+\MXSDefineSectionMark+\marg{code}
201 % \verb+\MXSDefineSubsectionMark+\marg{code}
202 % \verb+\MXSDefineSubsubsectionMark+\marg{code}
203 % \verb+\MXSMakeListMarks+
204 % \end{syntax}
205 % Each of the four first macros provide the normal text for either
206 % \verb+\leftmark+ (\verb+\chaptermark+ only) or \verb+\rightmark+. One
207 % slight change is that \verb+\chaptermark+ is defined such that it
208 % places an identical text in both \verb+\leftmark+ or
209 % \verb+\rightmark+, and not just the former, as in the usual case. (The
210 % section mark macros, only writes to \verb+\rightmark+ as usual.)
211
212 % \verb+\MXSMakeListMarks+ is defined as:
213 % \begin{verbatim}
214 % \newcommand\MXSMakeListMarks{%
215 % \def\tocmark{\markboth{\MXSMarksFormat{\contentsname}}%
216 % {\MXSMarksFormat{\contentsname}}}%
217 % \def\lofmark{\markboth{\MXSMarksFormat{\listfigurename}}%
218 % {\MXSMarksFormat{\listfigurename}}}%
219 % \def\lotmark{\markboth{\MXSMarksFormat{\listtablename}}%
220 % {\MXSMarksFormat{\listtablename}}}%
221 % \def\bibmark{\markboth{\MXSMarksFormat{\bibname}}%
222 % {\MXSMarksFormat{\bibname}}}%
223 % \def\indexmark{\markboth{\MXSMarksFormat{\indexname}}%
224 % {\MXSMarksFormat{\indexname}}}%
225 % }
226 % \end{verbatim}
227 % The macro \verb+\MXSMarksFormat+ is also used around the code used
228 % inside \verb+\chatermark+ throughout \verb+\subsubsectionmark+. By
229 % default it does nothing. Should you want the standard uppercase memoir
230 % \emph{headings} style marks, simply say
231 % \begin{syntax}
232 % \verb+\renewcommand\MXSMarksFormat{\MakeUppercase}+
233 % \end{syntax}
234 % One word of advice though, do \emph{not} add font changing
235 % macros into the \verb+\...mark+ definitions. Macros such as
236 % \verb+\bfseries+ or \verb+\small+ belongs in the page style
237 % configuration, not in the marks definition.
238
239
240
241 % \section{What goes on inside inside the \cs{MSXDefineXMark}?}
242 % \label{sec:what-inside-csdef}
243
244 % \chapterprecishere{Explanation for novice users}
245
246 % The \verb+\chaptermark+ is a bit complicated, so we will
247 % leave that for a moment. \verb+\sectionmark+,
248 % \verb+\subsectionmark+ and \verb+\subsubsection+ mark is
249 % much simpler to understand. In pseudocode it is:
250 % \begin{syntax}
251 % if sectional number required
252 % \qquad \Arg{sectional number plus a dot plus some space}
253 % end if
254 % \Arg{the title}
255 % \end{syntax}
256 % So the code for \verb+\sectionmark+ can be written:
257 % \begin{verbatim}
258 % \renewcommand\sectionmark[1]{%
259 % \markright{\MXSMarkFormat{%
260 % \ifnum\value{secnumdepth}>0
261 % \thesection. \ %
262 % \fi
263 % #1}}%
264 % }
265 % \end{verbatim}
266 % Here >>\texttt{0}<< is the number representation for >>chapter<<, so
267 % if the >>\texttt{secnumdepth}<< is larger than sero, then we need to
268 % have section numbers as well. The number sequence goes as
269 % \texttt{part=-1}, \texttt{chapter=0}, \texttt{section=1},\dots
270
271 % Just remember that we will have to use \verb+##1+ in the
272 % code since the above goes inside
273 % \verb+\MXSDefineSectionMark+. The code we actually use is
274 % slightly different, since we save some memory by writing a
275 % few things using \LaTeX\ internals, but it is essentially
276 % the same as above. The actual code used for \verb+\DefineSectionMark+
277 % is
278 % \begin{verbatim}
279 % \newcommand\MXSDefineSectionMark{%
280 % \def\sectionmark##1{%
281 % \markright{\MXSMarksFormat{%
282 % \ifnum \c@secnumdepth > \z@
283 % \thesection. \ %
284 % \fi
285 % ##1}}}%
286 % }
287 % \end{verbatim}
288 % But it is equivalent with the code mentioned above (just saves some
289 % internal memory).
290
291
292
293 % For \verb+\chaptermark+ there are two complications: First
294 % we have to write to both \verb+\leftmark+ and
295 % \verb+\rightmark+ (we just duplicate the code) and because
296 % \verb+\chatermark+ usually includes the word
297 % >>\emph{\chaptername}<< we also have to test whether we are
298 % inside the front matter, where this text should not be
299 % printed. So the pseudocode here becomes
300 % \begin{syntax}
301 % if chapter number required
302 % \qquad if mainmatter
303 % \qquad\qquad\Arg{Chapter/Appendix name plus number plus a dot plus some space}
304 % \qquad end if
305 % end if
306 % \Arg{the title}
307 % \end{syntax}
308 % Automatic distinction between >>\emph{\chaptername}<< and
309 % >>\emph{\appendixname}<< is handled through the internal
310 % macro \verb+\@chapapp+, so we will have to use
311 % \verb+\makeatletter+ and \verb+\makeatother+ if one have to mess with
312 % \verb+\chaptermark+ in the preamble. The code might look like
313 % this:
314 % \begin{verbatim}
315 % \renewcommand\chaptermark[1]{%
316 % \markboth{\MXSMarkFormat{%
317 % \ifnum\value{secnumdepth} > -1
318 % \if@mainmatter
319 % \@chapapp\ \thechapter. \ %
320 % \fi
321 % \fi
322 % #1}}{%
323 % exact copy of the above
324 % }}
325 % \end{verbatim}
326 % Again remember to use >>\verb+##1+<< when using this inside
327 % \verb+\MXSDefineChapterMark+.
328
329 \chapter{Chapterprecis in article mode}
330 \label{cha:chapt-article-mode}
331
332 % In article mode vertical space is not added below the chapter title
333 % (which now simply resembles \cs{section}). So when you use
334 % \cs{chapterprecishere}, the precis text is listed too high.
335
336 % \verb+\MXSArticlePreChapterPrecis+ fixes this by redefining
337 % \verb+\prechapterprecis+ to not include
338 % \verb+\vspace*{-2\baselineskip}+, see \cite{memman} p. 121.
339 % Just add
340 % \begin{syntax}
341 % \verb+\MXSArticlePreChapterPrecis+
342 % \end{syntax}
343 % to the preamble, if you are using the memoir article option. If used
344 % whenever the `article' options is not in effect, a warning is issued.
345
346 Removed, fixed in mempatch 4.9.
347
348
349 \chapter{Multi page titlingpage}
350 \label{cha:mult-titl}
351
352 If one does a naive multi page titlingpage in memoir, such as
353 \begin{verbatim}
354 \documentclass{memoir}
355 \begin{document}
356 \begin{titlingpage}
357 \begin{center}
358 cover page
359 \end{center}
360 \newpage
361 \begin{center}
362 back of cover page
363 \end{center}
364 \newpage
365 \begin{center}
366 title page
367 \end{center}
368 \newpage
369 \begin{center}
370 back of title page
371 \end{center}
372 \end{titlingpage}
373 \end{document}
374 \end{verbatim}
375 You will soon discover that some of these pages actually have headers
376 or footers in contrast to the fact that the \emph{titlingpage}
377 environment should use the \emph{titlingpage} page style for its
378 pages. There is no easy way around this so the \texttt{MXStitlingpage}
379 environment solves this problem by redefining macros such as
380 \verb+\newpage+ and \verb+\clearpage+ to locally make sure the
381 \emph{titlingpage} page style is used on the next page.
382
383 Just remember that if you have the habit of using \verb+\cleartorecto+
384 then you might end up with a page where the page style actually used,
385 is not \emph{titlingpage} but rather \emph{cleared} (they are
386 initially aliased to the same page style).
387
388 \begin{quote}
389 \itshape
390 If anyone have better ideas for fixing this problem regarding the
391 \emph{titlingpage} environment, please let me know.
392 \end{quote}
393
394
395 \begin{thebibliography}{9}
396 \bibitem{memman} Peter Wilson, \emph{The Memoir Class for Configurable
397 Typesetting}, The Herres Press, 2004.
398 \bibitem{memmanadd}
399 Peter Wilson, \emph{Addendum -- The Memoir Class for Configurable Typesetting;
400 User Guide}, 2007.
401 \end{thebibliography}
402
403
404 \end{document}
405
406
407
408 %%% Local Variables:
409 %%% mode: latex
410 %%% TeX-master: t
411 %%% End:
412
413