| 1 |
% ====================================================================== |
| 2 |
% scrlayer-notecolumn-en.tex |
| 3 |
% Copyright (c) Markus Kohm, 2013-2024 |
| 4 |
% |
| 5 |
% This file is part of the LaTeX2e KOMA-Script bundle. |
| 6 |
% |
| 7 |
% This work may be distributed and/or modified under the conditions of |
| 8 |
% the LaTeX Project Public License, version 1.3c of the license. |
| 9 |
% The latest version of this license is in |
| 10 |
% http://www.latex-project.org/lppl.txt |
| 11 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 12 |
% version 2005/12/01 or later and of this work. |
| 13 |
% |
| 14 |
% This work has the LPPL maintenance status "author-maintained". |
| 15 |
% |
| 16 |
% The Current Maintainer and author of this work is Markus Kohm. |
| 17 |
% |
| 18 |
% This work consists of all files listed in MANIFEST.md. |
| 19 |
% ====================================================================== |
| 20 |
% |
| 21 |
% Chapter about scrlayer-notecolumn of the KOMA-Script guide |
| 22 |
% Maintained by Markus Kohm |
| 23 |
% |
| 24 |
% ============================================================================ |
| 25 |
|
| 26 |
\KOMAProvidesFile{scrlayer-notecolumn-en.tex} |
| 27 |
[$Date: 2018-02-05 01:50:56 -0800 (Mon, 05 Feb 2018) $ |
| 28 |
KOMA-Script guide (chapter:scrlayer-notecolumn)] |
| 29 |
|
| 30 |
\translator{Markus Kohm\and Arndt Schubert\and Karl Hagen} |
| 31 |
|
| 32 |
\chapter{Note Columns with \Package{scrlayer-notecolumn}} |
| 33 |
\labelbase{scrlayer-notecolumn} |
| 34 |
|
| 35 |
\BeginIndexGroup |
| 36 |
\BeginIndex{Package}{scrlayer-notecolumn}% |
| 37 |
Through version~3.11b, \KOMAScript{} supported note columns only in the form |
| 38 |
of marginal notes that get their contents from \DescRef{maincls.cmd.marginpar} |
| 39 |
and \DescRef{maincls.cmd.marginline} (see \autoref{sec:maincls.marginNotes}, |
| 40 |
\DescPageRef{maincls.cmd.marginline}). This kind of note column has several |
| 41 |
disadvantages: |
| 42 |
\begin{itemize} |
| 43 |
\item Marginal notes must be set completely on a single page. Page |
| 44 |
breaks\textnote{page break} inside marginal notes are not possible. This |
| 45 |
sometimes causes the marginal notes to protrude into the lower margin. |
| 46 |
\item Marginal notes near page breaks sometimes float to the next page and |
| 47 |
then, in the case of two-sided printing, cause alternate marginal columns to |
| 48 |
appear in the wrong margin.\textnote{assignment to the correct margin}. This |
| 49 |
problem can be solved with the additional package |
| 50 |
\Package{mparhack}\IndexPackage{mparhack} or by using \Macro{marginnote} |
| 51 |
from the \Package{marginnote}\IndexPackage{marginnote} package (see |
| 52 |
\cite{package:marginnote}). |
| 53 |
\item Marginal notes inside floating environments\textnote{floating |
| 54 |
environments} or footnotes\textnote{footnotes} are not possible. This |
| 55 |
problem can also be solved with \Macro{marginnote} of the |
| 56 |
\Package{marginnote}\IndexPackage{marginnote} package. |
| 57 |
\item There is only one marginal note column\textnote{several note columns}, |
| 58 |
or at most two if you use \Macro{reversemarginpar} and |
| 59 |
\Macro{normalmarginpar}. Note that \Macro{reversemarginpar} is of less |
| 60 |
utility with two-sided documents. |
| 61 |
\end{itemize} |
| 62 |
Using \Package{marginnote}\IndexPackage{marginnote} leads to one more problem. |
| 63 |
Because the package does not have any collision detection, marginal notes that |
| 64 |
are set near to each other can partially or totally overlap. Moreover, |
| 65 |
depending on the settings used, \Macro{marginnote} sometimes changes the |
| 66 |
baseline distance of the normal text. |
| 67 |
|
| 68 |
The \Package{scrlayer-notecolumn} package should solve all these problems. To |
| 69 |
do so, it relies on the basic functionality of |
| 70 |
\hyperref[cha:scrlayer]{\Package{scrlayer}}\IndexPackage{scrlayer}% |
| 71 |
\important{\hyperref[cha:scrlayer]{\Package{scrlayer}}}. However, using this |
| 72 |
package has a drawback:\textnote{Attention!} you can only output notes on |
| 73 |
pages that use a page style based on |
| 74 |
\hyperref[cha:scrlayer]{\Package{scrlayer}}. This disadvantage, however, can |
| 75 |
easily be resolved, or even turned into an advantage, with the help of |
| 76 |
\hyperref[cha:scrlayer-scrpage]{\Package{scrlayer-scrpage}}% |
| 77 |
\important{\hyperref[cha:scrlayer-scrpage]{\Package{scrlayer-scrpage}}}% |
| 78 |
\IndexPackage{scrlayer-scrpage}. |
| 79 |
|
| 80 |
\section{Note about the State of Development} |
| 81 |
\seclabel{draft} |
| 82 |
|
| 83 |
This package was originally developed as a so-called \emph{proof of |
| 84 |
concept}\textnote{proof of concept} to demonstrate the potential of |
| 85 |
\hyperref[cha:scrlayer]{\Package{scrlayer}}% |
| 86 |
\important{\hyperref[cha:scrlayer]{\Package{scrlayer}}}. Although it is still |
| 87 |
in its early stages of development, most of its stability is less a question |
| 88 |
of \Package{scrlayer-notecolumn} than of |
| 89 |
\hyperref[cha:scrlayer]{\Package{scrlayer}}. Nevertheless, you can assume that |
| 90 |
there are still bugs in \Package{scrlayer-notecolumn}. Please report such bugs |
| 91 |
whenever you find them. Some of the package's shortcomings are caused by the |
| 92 |
attempt to minimise complexity. For example, although note columns can break |
| 93 |
across several pages, there is no new paragraph break. \TeX{} itself does not |
| 94 |
provide this. |
| 95 |
|
| 96 |
Because the package is rather experimental\textnote{experimental}, its |
| 97 |
instructions are found here in the second part of \iffree{the \KOMAScript{} |
| 98 |
manual}{this book}. Accordingly, it is primarily directed towards experienced |
| 99 |
users. If you are a beginner or a user on the way to become an |
| 100 |
expert\textnote{for experts}, some of the following explanations may be |
| 101 |
unclear or even incomprehensible. |
| 102 |
\iffree{Please understand that I want to keep the effort spent on the manual |
| 103 |
to something halfway bearable when it comes to experimental packages.}{% |
| 104 |
However, this should be enough to solve simple tasks with |
| 105 |
\Package{scrlayer-notecolumn}. At the same time, developers will hopefully |
| 106 |
find useful stimulus for their own ideas.} |
| 107 |
|
| 108 |
\iffalse% Umbruchoptimierung |
| 109 |
Note also\textnote{Attention!} that the author of \KOMAScript{} does not |
| 110 |
guarantee the further development of this package and offers only limited |
| 111 |
support for it. This is the nature of a package written solely for the |
| 112 |
purposes of demonstration.% |
| 113 |
\fi |
| 114 |
|
| 115 |
\LoadCommonFile{options}% \section{Early or late Selection of Options} |
| 116 |
|
| 117 |
\LoadCommonFile{textmarkup}% \section{Text Markup} |
| 118 |
|
| 119 |
\section{Declaring New Note Columns} |
| 120 |
\seclabel{declaration} |
| 121 |
|
| 122 |
Loading the package automatically declares a note column named |
| 123 |
\PValue{marginpar}. As the name implies, this note column is placed in the |
| 124 |
area of the normal marginal column used by \DescRef{maincls.cmd.marginpar} and |
| 125 |
\DescRef{maincls.cmd.marginline}. The \Macro{reversemarginpar} and |
| 126 |
\Macro{normalmarginpar} settings are also taken into account, but only for all |
| 127 |
the notes on a page instead of note by note. The relevant setting is the one |
| 128 |
that applies at the end of the page, namely during the output of the note |
| 129 |
column. If you want to have notes in both the left and right margin of the |
| 130 |
same page, you should define a second note column. |
| 131 |
|
| 132 |
The default settings for all newly declared note columns are the same as the |
| 133 |
defaults for \PValue{marginpar}. % |
| 134 |
\iftrue% Umbruchoptimierung |
| 135 |
But you can easily change them during their initialisation.% |
| 136 |
\fi |
| 137 |
|
| 138 |
Note\textnote{Attention!} that note columns can be output only on pages that |
| 139 |
use a page style based on the |
| 140 |
\hyperref[cha:scrlayer]{\Package{scrlayer}}\IndexPackage{scrlayer}% |
| 141 |
\important{\hyperref[cha:scrlayer]{\Package{scrlayer}}} package. The |
| 142 |
\Package{scrlayer-notecolumn} package automatically loads |
| 143 |
\hyperref[cha:scrlayer]{\Package{scrlayer}}, which by default provides only |
| 144 |
\PageStyle{empty}\IndexPagestyle{empty} page style. If you need additional |
| 145 |
page styles, \hyperref[cha:scrlayer-scrpage]{\Package{scrlayer-scrpage}}% |
| 146 |
\IndexPackage{scrlayer-scrpage}% |
| 147 |
\important{\hyperref[cha:scrlayer-scrpage]{\Package{scrlayer-scrpage}}} is |
| 148 |
recommended. |
| 149 |
|
| 150 |
\begin{Declaration} |
| 151 |
\Macro{DeclareNoteColumn}% |
| 152 |
\OParameter{option~list}\Parameter{note~column~name}% |
| 153 |
\Macro{DeclareNewNoteColumn}% |
| 154 |
\OParameter{option~list}\Parameter{note~column~name}% |
| 155 |
\Macro{ProvideNoteColumn}% |
| 156 |
\OParameter{option~list}\Parameter{note~column~name}% |
| 157 |
\Macro{RedeclareNoteColumn}% |
| 158 |
\OParameter{option~list}\Parameter{note~column~name}% |
| 159 |
\end{Declaration} |
| 160 |
You can use these commands to create note columns. \Macro{DeclareNoteColumn} |
| 161 |
creates the note column regardless of whether it already exists. |
| 162 |
\Macro{DeclareNewNoteColumn} throws an error if the \PName{note column name} |
| 163 |
has already been used for another note column. \Macro{ProvideNoteColumn} |
| 164 |
simply does nothing in that case. You can use \Macro{RedeclareNoteColumn} only |
| 165 |
to reconfigure an existing note column. |
| 166 |
|
| 167 |
By the way, when reconfiguring existing note columns with |
| 168 |
\Macro{DeclareNoteColumn} or \Macro{RedeclareNoteColumn}, the notes that have |
| 169 |
already been generated for this column are retained. |
| 170 |
|
| 171 |
\BeginIndex{FontElement}{notecolumn.\PName{note column name}}% |
| 172 |
\BeginIndex{FontElement}{notecolumn.marginpar}% |
| 173 |
Declaring a new note column always defines a new element for changing its font |
| 174 |
attributes with \DescRef{\LabelBase.cmd.setkomafont} and |
| 175 |
\DescRef{\LabelBase.cmd.addtokomafont}, if such an element does not yet exist. |
| 176 |
The name of the element is \PValue{notecolumn.}\PName{note column name}. For |
| 177 |
this reason, the default note column \PValue{marginnote} has the |
| 178 |
element\textnote{element name} \FontElement{notecolumn.marginpar}. You can |
| 179 |
directly specify the initial setting of the element's font when declaring a |
| 180 |
note column by using the \Option{font} option within the \PName{option list}.% |
| 181 |
\EndIndex{FontElement}{notecolumn.marginpar}% |
| 182 |
\EndIndex{FontElement}{notecolumn.\PName{note column name}}% |
| 183 |
|
| 184 |
The \PName{option list} is a comma-separated list of keys with or without |
| 185 |
values, also known as options. The available options are listed in |
| 186 |
\autoref{tab:scrlayer-notecolumn.note.column.options}, |
| 187 |
\autopageref{tab:scrlayer-notecolumn.note.column.options}. |
| 188 |
The\textnote{default: option \Option{marginpar}} \Option{marginpar} option is |
| 189 |
set by default, but you can overwrite this default with your individual |
| 190 |
settings. |
| 191 |
|
| 192 |
Because note columns are implemented using \Package{scrlayer}, a |
| 193 |
layer\Index{layer} is created for each note column. The layer |
| 194 |
name\textnote{layer name} is the same as the name of the element, |
| 195 |
\PValue{notecolumn.}\PName{note column name}. For more information about |
| 196 |
layers see \autoref{sec:scrlayer.layers}, starting on |
| 197 |
\autopageref{sec:scrlayer.layers}. |
| 198 |
% |
| 199 |
\begin{Example} |
| 200 |
Suppose you are a professor of comedy law and want to write a treatise on |
| 201 |
the new ``Statute Concerning the Riotous Airing of Common Humour'', SCRACH |
| 202 |
for short. The better part of the work will consist of commentary on |
| 203 |
individual paragraphs of the statute. You decide on a two-column layout, |
| 204 |
with the comments in the main column and the paragraphs placed in a smaller |
| 205 |
note column on the right of the main column using a font that is |
| 206 |
smaller\iffree{ and in a different colour}{}. |
| 207 |
\begin{lstcode} |
| 208 |
\documentclass{scrartcl} |
| 209 |
\usepackage{lmodern} |
| 210 |
\usepackage{xcolor} |
| 211 |
|
| 212 |
\usepackage{contract} |
| 213 |
\setkomafont{contract.Clause}{\bfseries} |
| 214 |
\setkeys{contract}{preskip=-\dp\strutbox} |
| 215 |
|
| 216 |
\usepackage{scrlayer-scrpage} |
| 217 |
\usepackage{scrlayer-notecolumn} |
| 218 |
|
| 219 |
\newlength{\paragraphscolwidth} |
| 220 |
\AfterCalculatingTypearea{% |
| 221 |
\setlength{\paragraphscolwidth}{% |
| 222 |
.333\textwidth}% |
| 223 |
\addtolength{\paragraphscolwidth}{% |
| 224 |
-\marginparsep}% |
| 225 |
} |
| 226 |
\recalctypearea |
| 227 |
\DeclareNewNoteColumn[% |
| 228 |
position=\oddsidemargin+1in |
| 229 |
+.667\textwidth |
| 230 |
+\marginparsep, |
| 231 |
width=\paragraphscolwidth, |
| 232 |
font=\raggedright\footnotesize |
| 233 |
\color{blue} |
| 234 |
]{paragraphs} |
| 235 |
\end{lstcode} |
| 236 |
The treatise should be a one-sided article. The font is Latin Modern, and |
| 237 |
the colour selection uses the \Package{xcolor}\IndexPackage{xcolor} package. |
| 238 |
|
| 239 |
For formatting legal texts\textnote{legal texts with |
| 240 |
\href{https://www.ctan.org/pkg/contract}{\Package{contract}}} with the |
| 241 |
\href{https://www.ctan.org/pkg/contract}{\Package{contract}}\IndexPackage{contract} |
| 242 |
package, see the user manual of the package. |
| 243 |
|
| 244 |
Since this document uses a page style\textnote{page style with |
| 245 |
\hyperref[cha:scrlayer-scrpage]{\Package{scrlayer-scrpage}}} with a |
| 246 |
page number, the |
| 247 |
\hyperref[cha:scrlayer-scrpage]{\Package{scrlayer-scrpage}}% |
| 248 |
\IndexPackage{scrlayer-scrpage} package is loaded. Thus, note columns can be |
| 249 |
output on all pages. |
| 250 |
|
| 251 |
Next, the \Package{scrlayer-notecolumn}\textnote{note columns with |
| 252 |
\Package{scrlayer-notecolumn}} package is loaded. The required width of the |
| 253 |
note column is calculated with |
| 254 |
\DescRef{typearea-experts.cmd.AfterCalculatingTypearea}% |
| 255 |
\IndexPackage{typearea}\IndexCmd{AfterCalculatingTypearea} after any |
| 256 |
recalculation\textnote{type area with |
| 257 |
\hyperref[cha:typearea]{\Package{typearea}}}% |
| 258 |
\IndexPackage{typearea} of the type area. It should be one third of the type |
| 259 |
area minus the distance between the main text and the note column. % |
| 260 |
|
| 261 |
With this information, we define the new note column. For the positions, we |
| 262 |
use a simple dimension expression. Note that \Length{oddsidemargin} is not |
| 263 |
the total left margin but for historical reasons the left margin minus |
| 264 |
1\Unit{inch}. So we have to add this value. |
| 265 |
|
| 266 |
This concludes the definition. Note that the note column would currently be |
| 267 |
placed inside the type area. This means that the note column would overwrite |
| 268 |
the text. |
| 269 |
|
| 270 |
\begin{lstcode} |
| 271 |
\begin{document} |
| 272 |
|
| 273 |
\title{Commentary on the SCRACH} |
| 274 |
\author{Professor R. O. Tenase} |
| 275 |
\date{11/11/2011} |
| 276 |
\maketitle |
| 277 |
\tableofcontents |
| 278 |
|
| 279 |
\section{Preamble} |
| 280 |
The SCRACH is without doubt the most important law |
| 281 |
on the manners of humour that has been passed in |
| 282 |
the last thousand years. The first reading took |
| 283 |
place on 11/11/1111 in the Supreme Manic Fun |
| 284 |
Congress, but the law was rejected by the Vizier |
| 285 |
of Fun. Only after the ludicrous, Manic Fun |
| 286 |
monarchy was transformed into a representative, |
| 287 |
witty monarchy by W. Itzbold, on 9/9/1999 was |
| 288 |
the way finally clear for this law. |
| 289 |
\end{lstcode} |
| 290 |
Because\textnote{Attention!} the text area was not reduced, the preamble is |
| 291 |
output extending over the whole width of the type area. To test this, you |
| 292 |
can temporarily add: |
| 293 |
\begin{lstcode} |
| 294 |
\end{document} |
| 295 |
\end{lstcode} |
| 296 |
\end{Example} |
| 297 |
% |
| 298 |
In the example, the question of how the text for the commentary can be set in |
| 299 |
a narrower column remains unresolved. You will discover how to do this by |
| 300 |
continuing the example below.% |
| 301 |
% |
| 302 |
%\begin{table}% Umbruchoptimierung: Tabelle hinter das Beispiel verschoben |
| 303 |
\begin{desclist} |
| 304 |
\desccaption{% |
| 305 |
% \caption[Available settings for declaring note columns]{% |
| 306 |
Available settings for declaring note columns% |
| 307 |
% }% |
| 308 |
\label{tab:scrlayer-notecolumn.note.column.options}% |
| 309 |
}{% |
| 310 |
Available settings for declaring note columns |
| 311 |
(\emph{continued})% |
| 312 |
}% |
| 313 |
% \begin{desctabular} |
| 314 |
\entry{\OptionVName{font}{font attribute}}{% |
| 315 |
The font attributes of the note column set with |
| 316 |
\DescRef{\LabelBase.cmd.setkomafont}. For possible values, refer to |
| 317 |
\autoref{sec:maincls.textmarkup}, |
| 318 |
\DescPageRef{maincls.cmd.setkomafont}.\par% |
| 319 |
Default: \emph{empty}% |
| 320 |
}% |
| 321 |
\entry{\Option{marginpar}}{% |
| 322 |
Sets \Option{position} and \Option{width} to correspond to the marginal |
| 323 |
note column of \DescRef{maincls.cmd.marginpar}. Switching between |
| 324 |
\Macro{reversemarginpar}\IndexCmd{reversemarginpar} and |
| 325 |
\Macro{normalmarginpar}\IndexCmd{normalmarginpar} is only considered at |
| 326 |
the end of the page when the note column is output. Note that this |
| 327 |
option does not expect or allow any value.\par% |
| 328 |
Default: \emph{yes}% |
| 329 |
}% |
| 330 |
\entry{\Option{normalmarginpar}}{% |
| 331 |
Sets \Option{position} and \Option{width} to use the normal marginal |
| 332 |
note column and ignore \Macro{reversemarginpar} and |
| 333 |
\Macro{normalmarginpar}. Note that this option does not expect or allow |
| 334 |
a value.\par% |
| 335 |
Default: \emph{no}% |
| 336 |
}% |
| 337 |
\entry{\OptionVName{position}{offset}}{% |
| 338 |
Sets the horizontal offset of the note column from the left edge of the |
| 339 |
paper. The \PName{offset} can be a complex expression as long as it is |
| 340 |
fully expandable and expands to a length or a dimensional expression at |
| 341 |
the time the note column is output. See \cite[section~3.5]{manual:eTeX} |
| 342 |
for more information about dimensional expressions.\par% |
| 343 |
Default: \emph{through the \Option{marginpar} option}% |
| 344 |
}% |
| 345 |
\entry{\Option{reversemarginpar}}{% |
| 346 |
Sets \Option{position} and \Option{width} to use the reverse marginal |
| 347 |
note column of \DescRef{maincls.cmd.marginpar} with the |
| 348 |
\Macro{reversemarginpar} setting. Note that this option does not expect |
| 349 |
or allow a value.\par% |
| 350 |
Default: \emph{no}% |
| 351 |
}% |
| 352 |
\entry{\OptionVName{width}{length}}{% |
| 353 |
Sets the width of the note column. The \PName{length} can be a complex |
| 354 |
expression as long as it is fully expandable and expands to a length or |
| 355 |
a dimensional expression at the time the note column is output. See |
| 356 |
\cite[section~3.5]{manual:eTeX} for more information about dimensional |
| 357 |
expressions.\par% |
| 358 |
Default: \emph{through the \Option{marginpar} option}% |
| 359 |
}% |
| 360 |
% \end{desctabular} |
| 361 |
%\end{table} |
| 362 |
\end{desclist} |
| 363 |
\EndIndexGroup |
| 364 |
|
| 365 |
|
| 366 |
\section{Making a Note} |
| 367 |
\seclabel{makenote} |
| 368 |
|
| 369 |
After you declare a note column, you can create notes for this column. But |
| 370 |
these notes are not be output immediately. Initially, they are written to an |
| 371 |
auxiliary file with extension ``\File{.slnc}''. Specifically, they are first |
| 372 |
written to the \File{aux}-file and, when the \File{aux}-file is read inside |
| 373 |
\Macro{end}\PParameter{document}, they are copied to the \File{slnc}-file. If |
| 374 |
necessary, the \Macro{nofiles}\IndexCmd{nofiles} setting is also taken into |
| 375 |
account. At the next \LaTeX{} run, this auxiliary file will be read piece by |
| 376 |
piece, according to the progress of the document, and at the end of the page |
| 377 |
the notes for that page will be output. |
| 378 |
|
| 379 |
Note\textnote{Attention!}, however, that note columns are output only on pages |
| 380 |
whose page style is based on the \Package{scrlayer}\IndexPackage{scrlayer} |
| 381 |
package. This package is loaded automatically by \Package{scrlayer-notecolumn} |
| 382 |
and by default provides only the \PageStyle{empty}\IndexPagestyle{empty} page |
| 383 |
style. If you need additional page styles, the |
| 384 |
\Package{scrlayer-scrpage}\IndexPackage{scrlayer-scrpage} package is |
| 385 |
recommended. |
| 386 |
|
| 387 |
\begin{Declaration} |
| 388 |
\Macro{makenote}\OParameter{note-column name}\Parameter{note}\\ |
| 389 |
\Macro{makenote*}\OParameter{note-column name}\Parameter{note}\\ |
| 390 |
\end{Declaration} |
| 391 |
You can use this command to make a new \PName{note}. The current vertical |
| 392 |
position is used as the vertical position for the start of the \PName{note}. |
| 393 |
The horizontal position for the note results from the defined position of the |
| 394 |
note column. To work correctly, the package relies on |
| 395 |
\Macro{pdfsavepos}\IndexCmd{pdfsavepos}, |
| 396 |
\Macro{pdflastypos}\IndexCmd{pdflastypos}, and |
| 397 |
\Macro{pdfpageheight}\IndexLength{pdfpageheight} or their equivalent in newer |
| 398 |
\LuaTeX{} versions. Without these commands, \Package{scrlayer-notecolumn} will |
| 399 |
not work. The primitives should act exactly as they would using pdf\TeX. |
| 400 |
|
| 401 |
However, if the package detects a collision\textnote{collision avoidance} with |
| 402 |
a previous \PName{note} in the same note column, the new \PName{note} is moved |
| 403 |
below that earlier \PName{note}. If the \PName{note} does not fit on the |
| 404 |
page\textnote{page break}\Index{page>break}, it will be moved completely or |
| 405 |
partially to the next page. |
| 406 |
|
| 407 |
The optional argument \PName{note column name} determines which note column |
| 408 |
should be used for the \PName{note}. If the optional argument is omitted, the |
| 409 |
default note column \PValue{marginpar} is used.% |
| 410 |
\begin{Example} |
| 411 |
Let's add a commented paragraph to the example of the previous section. The |
| 412 |
paragraph itself should be placed in the newly defined note column: |
| 413 |
\begin{lstcode} |
| 414 |
\section{Analysis} |
| 415 |
\begin{addmargin}[0pt]{.333\textwidth} |
| 416 |
\makenote[paragraphs]{% |
| 417 |
\protect\begin{contract} |
| 418 |
\protect\Clause[% |
| 419 |
title={No Joke without an Audience}% |
| 420 |
] |
| 421 |
A joke can only be funny if is has an |
| 422 |
audience. |
| 423 |
\protect\end{contract}% |
| 424 |
} |
| 425 |
This is one of the most central statements of |
| 426 |
the law. It is so fundamental that it is quite |
| 427 |
appropriate to bow to the wisdom of the authors. |
| 428 |
\end{lstcode} |
| 429 |
The \DescRef{maincls.env.addmargin}\IndexEnv{addmargin}% |
| 430 |
\textnote{column width with \DescRef{maincls.env.addmargin}} environment, |
| 431 |
which is described in \autoref{sec:maincls.lists}, |
| 432 |
\DescPageRef{maincls.env.addmargin}, is used to reduce the width of the main |
| 433 |
text by the width of the column for the paragraphs. |
| 434 |
|
| 435 |
Here you can see one of the few problems of using \Macro{makenote}. Because |
| 436 |
the mandatory argument is written to an auxiliary file, |
| 437 |
commands\textnote{fragile commands} inside this argument can, unfortunately, |
| 438 |
\emph{break}. To avoid this, you should use \Macro{protect} in front of all |
| 439 |
commands that should not expand when written to the auxiliary file. |
| 440 |
Otherwise, using a command inside this argument could result in error |
| 441 |
messages. |
| 442 |
|
| 443 |
In principle you could now finish this example with |
| 444 |
\begin{lstcode} |
| 445 |
\end{addmargin} |
| 446 |
\end{document} |
| 447 |
\end{lstcode} |
| 448 |
to see a preliminary result. |
| 449 |
\end{Example} |
| 450 |
If you test this example, you will see that the column for the legal text is |
| 451 |
longer than that of the commentary. If\textnote{Attention!} you add another |
| 452 |
section with another paragraph, you may encounter the problem that the |
| 453 |
commentary will not continue below the legal text but immediately after the |
| 454 |
previous comment. Next you will find a solution to this problem. |
| 455 |
|
| 456 |
The\ChangedAt{v0.1.2583}{\Package{scrlayer-notecolumn}} problem with fragile |
| 457 |
commands mentioned in the example above does not occur with the starred |
| 458 |
variant\important{\Macro{makenote*}}. It uses \Macro{detokenize} to prevent |
| 459 |
the expansion of commands. But this also means that you should not use |
| 460 |
commands in the \PName{note} that change their definition within the |
| 461 |
document. |
| 462 |
|
| 463 |
Unfortunately, both commands have two other known |
| 464 |
limitations\textnote{Attention!}. The first issue is related to colours using |
| 465 |
\Package{color}\IndexPackage{color} or \Package{xcolor}\IndexPackage{xcolor} |
| 466 |
within the note columns. To make such colour changes possible each note column |
| 467 |
requires its own colour management using so-called \emph{colour stacks}. |
| 468 |
Because the package was designed only as a \emph{proof of concept} and because |
| 469 |
\XeTeX{} does not support multiple colour stacks, \XeTeX{} colour switching is |
| 470 |
restricted to the attributes of the font element |
| 471 |
\FontElement{notecolumn.\PName{note column name}}, a limitation which |
| 472 |
eliminates the time and effort required to implement custom colour management. |
| 473 |
|
| 474 |
The second issue is of a more conceptual nature. The content of the auxiliary |
| 475 |
file that contains the note-column information is read while processing the |
| 476 |
page header. This has consequences in particular if the read occurs while |
| 477 |
an environment like \Environment{verbatim} is active. In this case, the |
| 478 |
\Macro{catcode} settings of this environment would be active while reading the |
| 479 |
auxiliary file. This will inevitably lead to errors in processing and output. |
| 480 |
To attenuate this risk, the \Macro{catcodes} of the characters from |
| 481 |
\Macro{dospecials}\IndexCmd{dospecials} are stored during |
| 482 |
\Macro{begin}\PParameter{document} and explicitly restored when reading from |
| 483 |
the auxiliary file.% |
| 484 |
\EndIndexGroup |
| 485 |
|
| 486 |
|
| 487 |
\begin{Declaration} |
| 488 |
\Macro{syncwithnotecolumn}\OParameter{note column name} |
| 489 |
\end{Declaration} |
| 490 |
This command adds a |
| 491 |
synchronisation\textnote{synchronisation}\Index{synchronisation} point in a |
| 492 |
note column and in the main text of the document. Whenever a synchronisation |
| 493 |
point is reached during the output of a note column or the main text, a mark |
| 494 |
will be generated that consists of the current page and the current vertical |
| 495 |
position. |
| 496 |
|
| 497 |
In parallel with the generation of synchronisation points, |
| 498 |
\Package{scrlayer-notecolumn} determines whether a mark has been set in the |
| 499 |
note column or the main text during the previous \LaTeX{} run. If so, it |
| 500 |
compares their values. If the mark of the note column is lower on the current |
| 501 |
page or on a later page, the main text will be moved down to the position of |
| 502 |
the mark. |
| 503 |
|
| 504 |
As a rule,\textnote{Hint!} you should not place synchronisation points within |
| 505 |
paragraphs of the main text but only between them. If you nonetheless use |
| 506 |
\Macro{syncwithnotecolumn} inside a paragraph, the synchronisation point will |
| 507 |
be delayed until the current line has been output. This behaviour is similar |
| 508 |
to that of, e.\,g., \Macro{vspace}\IndexCmd{vspace} in this respect. |
| 509 |
|
| 510 |
Because synchronisation points are not recognized until the next \LaTeX{} |
| 511 |
run\textnote{several \LaTeX{} runs}, this mechanism requires at least three |
| 512 |
\LaTeX{} runs. Any new synchronisation may also result in shifts of later |
| 513 |
synchronisation points, which in turn will require additional \LaTeX{} runs. |
| 514 |
Such shifts are usually indicated by the message: ``\LaTeX{} Warning: Label(s) |
| 515 |
may have changed. Rerun to get cross-references right.'' But reports about |
| 516 |
undefined labels may also indicate the need for another \LaTeX{} run. |
| 517 |
|
| 518 |
If you omit the optional argument, the default note column \PValue{marginpar} |
| 519 |
will be used. Note\textnote{Attention!} that an empty optional argument is not |
| 520 |
the same as omitting the optional argument! |
| 521 |
|
| 522 |
You cannot use\textnote{Attention!} \Macro{syncwithnotecolumn} inside a note |
| 523 |
itself, that is, inside the mandatory argument of |
| 524 |
\Macro{makenote}\IndexCmd{makenote}! Currently the package cannot recognise |
| 525 |
such a mistake, and it causes new shifts of the synchronisation point with |
| 526 |
each \LaTeX{} run, so the process will never terminate. To synchronise two or |
| 527 |
more note columns, you have to synchronise each of them with the main text. |
| 528 |
The recommended command for this is described below.% |
| 529 |
% |
| 530 |
\begin{Example} |
| 531 |
Let's extend the example above by first adding a synchronisation point |
| 532 |
and then another paragraph with a comment: |
| 533 |
\begin{lstcode} |
| 534 |
\syncwithnotecolumn[paragraphs]\bigskip |
| 535 |
\makenote[paragraphs]{% |
| 536 |
\protect\begin{contract} |
| 537 |
\protect\Clause[title={Humor of a Culture}] |
| 538 |
\setcounter{par}{0}% |
| 539 |
The humour of a joke can be determined by the |
| 540 |
cultural environment in which it is told. |
| 541 |
|
| 542 |
The humour of a joke can be determined by the |
| 543 |
cultural environment in which it acts. |
| 544 |
\protect\end{contract} |
| 545 |
} |
| 546 |
The cultural component of a joke is, in fact, not |
| 547 |
negligible. Although the political correctness of |
| 548 |
using the cultural environment can easily be |
| 549 |
disputed, nonetheless the accuracy of such comedy |
| 550 |
in the appropriate environment is striking. On |
| 551 |
the other hand, a supposed joke in the wrong |
| 552 |
cultural environment can also be a real danger |
| 553 |
for the joke teller. |
| 554 |
\end{lstcode} |
| 555 |
In addition to the synchronisation point, a vertical skip has been added |
| 556 |
with \Macro{bigskip} to better distinguish each paragraph and the |
| 557 |
corresponding comments. |
| 558 |
|
| 559 |
Further\textnote{Attention}, this example illustrates another potential |
| 560 |
problem. Because the note columns uses boxes that are assembled and |
| 561 |
disassembled, counters\textnote{counter in note column} inside note columns |
| 562 |
can sometimes jitter. In the example, therefore, the first paragraph would |
| 563 |
be numbered 2 instead of 1. This, however, can easily be fixed by a direct |
| 564 |
reset of the corresponding counter. |
| 565 |
|
| 566 |
The example is almost complete. You just have to close the environments: |
| 567 |
\begin{lstcode} |
| 568 |
\end{addmargin} |
| 569 |
\end{document} |
| 570 |
\end{lstcode} |
| 571 |
In reality, of course, all the remaining section of the law should also be |
| 572 |
commented. But let us focus on the main purpose. |
| 573 |
\end{Example} |
| 574 |
But stop! What if, in this example, the \PName{paragraphs} would no longer fit |
| 575 |
on the page? Would it be printed on the next page? We will answer this |
| 576 |
question in the next section.% |
| 577 |
\EndIndexGroup |
| 578 |
|
| 579 |
|
| 580 |
\begin{Declaration} |
| 581 |
\Macro{syncwithnotecolumns}\OParameter{list of note column names} |
| 582 |
\end{Declaration} |
| 583 |
This command synchronises the main text with all note columns of the |
| 584 |
comma-separated \PName{list of note column names}. The main text |
| 585 |
will be synchronised with the note column whose mark is closest to the |
| 586 |
end of the document. As a side effect, the note columns will be synchronised |
| 587 |
with each other. |
| 588 |
|
| 589 |
If the optional argument is omitted or empty (or begins with \Macro{relax}), |
| 590 |
synchronisation will be done with all currently declared note columns.% |
| 591 |
\EndIndexGroup |
| 592 |
|
| 593 |
|
| 594 |
\section{Forced Output of Note Columns} |
| 595 |
\seclabel{clearnotes} |
| 596 |
|
| 597 |
In addition to the normal output of note columns described in the previous |
| 598 |
section, you may sometimes need to output all collected notes that have |
| 599 |
not yet been output. This is especially useful when large notes cause more and |
| 600 |
more notes to be moved down to new pages. A good time to force the |
| 601 |
output\textnote{force output} is, for example, the end of a chapter or the end |
| 602 |
of the document. |
| 603 |
|
| 604 |
\begin{Declaration} |
| 605 |
\Macro{clearnotecolumn}\OParameter{note column name} |
| 606 |
\end{Declaration} |
| 607 |
This command prints all notes\textnote{pending notes} of a particular note |
| 608 |
column that have not yet been output by the end of the current page but which |
| 609 |
were created on that or a previous page. Blank pages are generated as needed |
| 610 |
to output these pending notes. During the output of the pending notes of this |
| 611 |
note column, notes of other note columns may also be output, but only as |
| 612 |
necessary to output the pending notes of the specified note column. |
| 613 |
|
| 614 |
During the output of the pending notes, notes created in the previous \LaTeX{} |
| 615 |
run on the pages that are now replaced by the inserted blank pages may be |
| 616 |
output by mistake. This will be corrected automatically in one of the |
| 617 |
subsequent \LaTeX{} runs. Such shifts are usually indicated by the message: |
| 618 |
``\LaTeX{} Warning: Label(s) may have changed. Rerun to get cross-references |
| 619 |
right.'' |
| 620 |
|
| 621 |
The note column whose pending notes are to be output is indicated by the |
| 622 |
optional argument \PName{note column name}. If this argument is omitted, the |
| 623 |
notes of the default note column \PValue{marginpar} will be output. |
| 624 |
|
| 625 |
The attentive reader\textnote{forced output vs. synchronisation} will have |
| 626 |
noticed that the forced output of a note column is not unlike synchronisation. |
| 627 |
But if the forced output actually results in an output, it will be at the |
| 628 |
start of a new page and not just below the previous output. Nonetheless, a |
| 629 |
forced output usually results in fewer \LaTeX{} runs.% |
| 630 |
\EndIndexGroup |
| 631 |
|
| 632 |
|
| 633 |
\begin{Declaration} |
| 634 |
\Macro{clearnotecolumns}\OParameter{list of note column names} |
| 635 |
\end{Declaration} |
| 636 |
This command is similar to \DescRef{\LabelBase.cmd.clearnotecolumn}, but the |
| 637 |
the optional argument here can be not only the name of one note column but a |
| 638 |
comma-separated \PName{list of note column names}. The pending notes of all |
| 639 |
these note columns are then ouput. |
| 640 |
|
| 641 |
If you omit the optional argument or leave it empty, all pending notes of all |
| 642 |
note columns will be output.% |
| 643 |
\EndIndexGroup |
| 644 |
|
| 645 |
|
| 646 |
\begin{Declaration} |
| 647 |
\OptionVName{autoclearnotecolumns}{simple switch} |
| 648 |
\end{Declaration} |
| 649 |
As a rule, pending notes will always be output if a document |
| 650 |
implicitly\,---\,e.\,g. because of a \DescRef{maincls.cmd.chapter} |
| 651 |
command\,---\,or explicitly executes \DescRef{maincls.cmd.clearpage}. This is |
| 652 |
also the case at the end of the document within |
| 653 |
\Macro{end}\PParameter{document}. The \Option{autoclearnotecolumns} option can |
| 654 |
be used to control whether \DescRef{\LabelBase.cmd.clearnotecolumns} should be |
| 655 |
executed automatically without arguments when running |
| 656 |
\DescRef{maincls.cmd.clearpage}. |
| 657 |
|
| 658 |
Since this is generally the desired behaviour, the option is active by |
| 659 |
default. But you can change this with the appropriate value for a simple |
| 660 |
switch (see \autoref{tab:truefalseswitch}, \autopageref{tab:truefalseswitch}) |
| 661 |
at any time. |
| 662 |
|
| 663 |
Note\textnote{Attention!} that disabling the automatic output of pending notes |
| 664 |
can result in lost notes at the end of the document. So in this case you |
| 665 |
should insert \DescRef{\LabelBase.cmd.clearnotecolumns} before |
| 666 |
\Macro{end}\PParameter{document} fore safety's sake. |
| 667 |
|
| 668 |
The question from the end of the last section should now be answered. If the |
| 669 |
paragraph is to be completely output, it had to be wrapped to the next page. |
| 670 |
This is, of course, the default setting. However, since this would happen |
| 671 |
after the end of the \DescRef{maincls.env.addmargin} environment, the forced |
| 672 |
output could still overlap with subsequent text. So in the example it would |
| 673 |
make sense to add another synchronisation point after the |
| 674 |
\DescRef{maincls.env.addmargin} environment. |
| 675 |
|
| 676 |
The result of the example is shown in |
| 677 |
\autoref{fig:scrlayer-notecolumn.example}.\iffree{}{ Only the colour has been |
| 678 |
changed from blue to grey.} |
| 679 |
|
| 680 |
\begin{figure} |
| 681 |
\KOMAoptions{captions=bottombeside}% |
| 682 |
\setcapindent{0pt}% |
| 683 |
\begin{captionbeside}[{A sample page for the example in |
| 684 |
\autoref{cha:scrlayer-notecolumn}}]{A sample page for the example in |
| 685 |
this chapter\label{fig:scrlayer-notecolumn.example}}[l] |
| 686 |
\frame{\includegraphics[width=.5\textwidth,keepaspectratio]% |
| 687 |
{scrlayer-notecolumn-example-en}} |
| 688 |
\end{captionbeside} |
| 689 |
\end{figure} |
| 690 |
\EndIndexGroup |
| 691 |
% |
| 692 |
\EndIndexGroup |
| 693 |
|
| 694 |
%%% Local Variables: |
| 695 |
%%% mode: latex |
| 696 |
%%% TeX-master: "scrguide-en.tex" |
| 697 |
%%% coding: utf-8 |
| 698 |
%%% ispell-local-dictionary: "en_GB" |
| 699 |
%%% eval: (flyspell-mode 1) |
| 700 |
%%% End: |