summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/koma-script/doc/english/scrlayer-notecolumn.tex
blob: a181dd5780d6e1dd745741a6abdc443f1953e6fe (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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
% ======================================================================
% scrlayer-notecolumn.tex
% Copyright (c) Markus Kohm, 2013-2017
%
% This file is part of the LaTeX2e KOMA-Script bundle.
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, version 1.3c of the license.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX 
% version 2005/12/01 or later and of this work.
%
% This work has the LPPL maintenance status "author-maintained".
%
% The Current Maintainer and author of this work is Markus Kohm.
%
% This work consists of all files listed in manifest.txt.
% ----------------------------------------------------------------------
% scrlayer-notecolumn.tex
% Copyright (c) Markus Kohm, 2013-2017
%
% Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz,
% Version 1.3c, verteilt und/oder veraendert werden.
% Die neuste Version dieser Lizenz ist
%   http://www.latex-project.org/lppl.txt
% und Version 1.3c ist Teil aller Verteilungen von LaTeX
% Version 2005/12/01 oder spaeter und dieses Werks.
%
% Dieses Werk hat den LPPL-Verwaltungs-Status "author-maintained"
% (allein durch den Autor verwaltet).
%
% Der Aktuelle Verwalter und Autor dieses Werkes ist Markus Kohm.
% 
% Dieses Werk besteht aus den in manifest.txt aufgefuehrten Dateien.
% ======================================================================
%
% Chapter about scrlayer-notecolumn of the KOMA-Script guide
% Maintained by Markus Kohm
%
% ----------------------------------------------------------------------
%
% Kapitel ueber scrlayer-notecolumn in der KOMA-Script-Anleitung
% Verwaltet von Markus Kohm
%
% ============================================================================

\KOMAProvidesFile{scrlayer-notecolumn.tex}
                 [$Date: 2014-03-07 09:40:24 +0100 (Fri, 07 Mar 2014) $
                  KOMA-Script guide (chapter:scrlayer-notecolumn)]

\translator{Markus Kohm\and Arndt Schubert}

% Date of the translated German file: 2017-02-08

\chapter{Note Columns with \Package{scrlayer-notecolumn}}
\labelbase{scrlayer-notecolumn}
\BeginIndexGroup
\BeginIndex{}{note>columns}%
\BeginIndex{Package}{scrlayer-notecolumn}%
Up to version~3.11b \KOMAScript{} supported note columns only by marginal
notes that get their contents from \DescRef{maincls.cmd.marginpar} and \DescRef{maincls.cmd.marginline}
(see  \autoref{sec:maincls.marginNotes},
\DescPageRef{maincls.cmd.marginline}). This kind of note columns has
several disadvantages:
\begin{itemize}
\item Marginal notes can be output only completely on one page. Page
  breaks\textnote{page break} inside marginal notes are not
  possible. Sometimes this results in margin notes located close to the lower
  page margin.
\item Marginal notes near page breaks sometimes float to the next page and
  then in
  case of two-sided layout with alternating marginal notes can be output at
  the wrong margin.\textnote{put it into the correct margin}. This problem can
  be solved by additional packages like
  \Package{mparhack}\IndexPackage{mparhack} or usage of \Macro{marginnote}
  provided by package \Package{marginnote}\IndexPackage{marginnote}.
\item Marginal notes inside floating environments\textnote{floating
    environments} or footnotes\textnote{footnotes} are not possible. This
  problem can be solved using \Macro{marginnote} of package
  \Package{marginnote}\IndexPackage{marginnote}, too.
\item There is only one marginal note column\textnote{several note columns} or
  at most two, if you work with \Macro{reversemarginpar} and
  \Macro{normalmarginpar}. You should know, that \Macro{reversemarginpar} is
  of less usability on two-sided documents.
\end{itemize}
Usage of \Package{marginnote}\IndexPackage{marginnote} results in one more
problem. Because the package does not have any collision detection, marginal
notes that are set near to each other can partially or totally
overlap. Moreover, usage of \Macro{marginnote} sometimes and depending on the
used settings can result in changes of the baseline distance of the normal
text.

Package \Package{scrlayer-notecolumn} should solve all these problems. To do
so, it uses the basic functionality of
\Package{scrlayer}\IndexPackage{scrlayer}. Nevertheless, there is a
disadvantage of using this package:\textnote{Attention!} Notes can be output
only on pages that use a \Package{scrlayer} based page style. This
disadvantage may be easily resolved and maybe changed into an advantage using
\Package{scrlayer-scrpage}\IndexPackage{scrlayer-scrpage}.

\section{Note about the State of Development}
\seclabel{draft}

Originally the package has been made as a so called \emph{proof of
  concept}\textnote{proof of concept} to demonstrate the potential of
\Package{scrlayer}. Despite the fact that it currently is in a very early
state of development, the stability of most parts is less a question of
\Package{scrlayer-notecolumn} but of \Package{scrlayer}. Nevertheless it is
assumed that there are still bugs in \Package{scrlayer-notecolumn}. You are
welcome to report such bugs whenever you find one. Some of the disabilities
are caused by minimisation of complexity. As an example note columns can break
to several pages, but there is not a new line break of the paragraphs. \TeX{}
itself does not provide this.

Because the package is more experimental\textnote{experimental}, the user
manual belongs to the second part of \iffree{the \KOMAScript{} manual}{this
  book}, recommended for experienced users. If you are a beginner or
a user on the way to become an expert\textnote{for experts}, some explanations
could be ambiguous or incomprehensible. \iffree{Please understand that I try
  to minimise the effort in time and work for the manual of an experimental
  package.}

\LoadCommonFile{options}% \section{Early or late Selection of Options}

\LoadCommonFile{textmarkup}% \section{Text Markup}

\section{Declaration of new Note Columns}
\seclabel{declaration}

Loading the package already declares a note column named \PValue{marginpar}
automatically. The name already adumbrates that this note column is placed in
the area of the normal marginal note column used by \DescRef{maincls.cmd.marginpar} and
\DescRef{maincls.cmd.marginline}. It even recognises the setting of \Macro{reversemarginpar}
and \Macro{normalmarginpar} page by page instead of note by note. So these
switches are irrelevant when the user defines a note but relevant when the
package outputs the note during \LaTeX's page building. If you want to use
notes at the left and at the right margin within one page, you should declare
at least one more note column.

The default settings for every newly declared note column is the same like
that of the predefined \PValue{marginpar}. But you can easily change them
during declaration.

You should note\textnote{Attention!} that note columns can be output only on
pages that use a page style made with package
\Package{scrlayer}\IndexPackage{scrlayer}. Package
\Package{scrlayer-notecolumn} automatically loads \Package{scrlayer}, which by
default provides only page style \PageStyle{empty}\IndexPagestyle{empty}. If
you need additional page styles, the use of
\Package{scrlayer-scrpage}\IndexPackage{scrlayer-scrpage} is recommended.

\begin{Declaration}
  \Macro{DeclareNoteColumn}%
  \OParameter{option list}\Parameter{note column name}%
  \Macro{DeclareNewNoteColumn}%
  \OParameter{option list}\Parameter{note column name}%
  \Macro{ProvideNoteColumn}%
  \OParameter{option list}\Parameter{note column name}%
  \Macro{RedeclareNoteColumn}%
  \OParameter{option list}\Parameter{note column name}%
\end{Declaration}
These commands can be used to declare note columns. \Macro{DeclareNoteColumn}
declares the note column independent of whether or not they already
exist. \Macro{DeclareNewNoteColumn} throws an error message if \PName{note
  column name} has already been used for another note
column. \Macro{ProvideNoteColumn} simply does nothing in the same
case. \Macro{RedeclareNoteColumn} can be used only to declare an already
existing note column again.

By the way: Already existing notes of a already existing note column are not
lost if you re-declare it using \Macro{DeclareNoteColumn} or
\Macro{RedeclareNoteColumn}.

\BeginIndexGroup
\BeginIndex{FontElement}{notecolumn.\PName{note column name}}%
\BeginIndex{FontElement}{notecolumn.marginpar}%
\LabelFontElement{notecolumn.marginpar}%
Declaring a new note column does also define a new element of which you can
change the font attributes using \DescRef{\LabelBase.cmd.setkomafont} and
\DescRef{\LabelBase.cmd.addtokomafont} if such a element does not already
exist. The name of the new element is \PValue{notecolumn.}\PName{note column
  name}. Because of this the predefined note column \PValue{marginnote} has a
element \FontElement{notecolumn.marginpar}. The initial setting of the
element's font can be done using option \Option{font} as part of the
\PName{option list}.%
\EndIndexGroup


The \PName{option list} is a comma separated list of keys with or without
values, also known as options. The available options are shown in
\autoref{tab:scrlayer-notecolumn.note.column.options}. Option\textnote{default:
  option \Option{marginpar}} \Option{marginpar} is set by default. But you can
overwrite this default with your individual settings.

\begin{table}
  \caption[Options for the declaration of note columns]%
  {%
    Options for the declaration of note columns%
  }%
  \label{tab:scrlayer-notecolumn.note.column.options}%
  \begin{desctabular}
    \entry{\OptionVName{font}{font declaration}}{%
      The initial font attributes to be used for the note column. Everything,
      that is allowed to be set by \DescRef{\LabelBase.cmd.setkomafont} or
      \DescRef{\LabelBase.cmd.addtokomafont} can be used as \PName{font
        declaration} (see \autoref{sec:maincls.textmarkup},
      \DescPageRef{maincls.cmd.setkomafont}). Note that
      \Macro{normalfont}\Macro{normalsize} will be used before. So you don't
      need one of them at your own initialisation.\par%
      Default: \emph{empty}%
    }%
    \entry{\Option{marginpar}}{%
      Sets up \Option{position} and \Option{width} to use the marginal note
      column of \DescRef{maincls.cmd.marginpar}. Note that this option does
      not expect or allow any value.\par%
      Default: \emph{yes}%
    }%
    \entry{\Option{normalmarginpar}}{%
      Sets up \Option{position} and \Option{width} to use the normal marginal
      note column and ignore \Macro{reversemarginpar} and
      \Macro{normalmarginpar}. Note that this option does not expect or allow
      any value.\par%
      Default: \emph{no}%
    }%
    \entry{\OptionVName{position}{offset}}{%
      Sets up the horizontal offset of the note column from the left edge of
      the paper. The \PName{horizontal offset} can be either a \LaTeX{}
      length, a \TeX{} dimension, a \TeX{} skip, a length value, or a
      dimensional expression using \texttt{+}, \texttt{-}, \texttt{*},
      \texttt{/} and parenthesis (see \cite[section~3.5]{manual:eTeX} for more
      information about dimensional expressions). The value will be calculated
      at usage time not at definition time.\par%
      Default: \emph{by option \Option{marginpar}}%
    }%
    \entry{\Option{reversemarginpar}}{%
      Sets up \Option{position} and \Option{width} to use the reverse marginal
      note column and ignore \Macro{reversemarginpar} and
      \Macro{normalmarginpar}. Note that this option does not expect or allow
      any value.\par%
      Default: \emph{no}%
    }%
    \entry{\OptionVName{width}{length}}{%
      Sets up the horizontal size of the note column. You can use the same
      values for \PName{size} like for \PName{offset} of option
      \Option{position}.\par%
      Default: \emph{by option \Option{marginpar}}%
    }%
  \end{desctabular}
\end{table}

Because note columns are implemented using \Package{scrlayer}, each note
column also defines a layer\Index{layer}. The name\textnote{layer's name} of
the layer is the same as the name of the element,
\PValue{notecolumn.}\PName{note column name}. For more information about
layers see \autoref{sec:scrlayer.layers}, from
\autopageref{sec:scrlayer.layers}.
%
\begin{Example}
  Assuming, you are a German professor of weird rights and like to write a
  paper about the new ``Gesetz über die ausgelassene Verbreitung allgemeiner
  Späße e'', GüdaVaS. The main focus of the work should consist of comments to
  each section. So you use a two-columned layout. The comments would be the
  main text in the main column. The sections should be placed in a smaller
  note column on the right side of the main column using a smaller
  font\iffree{ and a different colour}{}.
\begin{lstcode}
  \documentclass{scrartcl}
  \usepackage[ngerman]{babel}
  \usepackage{selinput}
  \SelectInputMappings{
    adieresis={ä},
    germandbls={ß},
  }
  \usepackage[T1]{fontenc}
  \usepackage{lmodern}
  \usepackage{xcolor}

  \usepackage{scrjura}
  \setkomafont{contract.Clause}{\bfseries}
  \setkeys{contract}{preskip=-\dp\strutbox}

  \usepackage{scrlayer-scrpage}
  \usepackage{scrlayer-notecolumn}

  \newlength{\paragraphscolwidth}
  \AfterCalculatingTypearea{%
    \setlength{\paragraphscolwidth}{%
      .333\textwidth}%
    \addtolength{\paragraphscolwidth}{%
      -\marginparsep}%
  }
  \recalctypearea
  \DeclareNewNoteColumn[%
    position=\oddsidemargin+1in
             +.667\textwidth
             +\marginparsep,
    width=\paragraphscolwidth,
    font=\raggedright\footnotesize
         \color{blue}
  ]{paragraphs}
\end{lstcode}
  The paper should be a single-sided article. The German language (new
  spelling) is selected with package \Package{babel}\IndexPackage{babel}. The
  input encoding is selected and detected with package
  \Package{selinput}\IndexPackage{selinput} automatically. The font is Latin
  Modern in 8-bit coding.\iffree{ The colour selection uses package
    \Package{xcolor}\IndexPackage{xcolor}.}{}

  For usage of package \Package{scrjura}\IndexPackage{scrjura} to typeset laws
  and contracts see \iffree{the German manual of that
    package}{\autoref{cha:scrjura}}.

  Next package \Package{scrlayer-notecolumn}\textnote{note columns with
    \Package{scrlayer-notecolumn}} is loaded. The required width of the note
  column is calculated within
  \DescRef{typearea-experts.cmd.AfterCalculatingTypearea} after package
  \Package{typearea}'s each new calculation of the typing area. It should be
  one third of the typing area minus the distance between the main text and
  the note column. %

  With all this information we define the new note column. For
  the positions we simply use a dimension expression. Doing so, we have to
  note that \Length{oddsidemargin} is not the total left margin but for
  historical reasons the left margin minus 1\Unit{inch}. So we have to add
  this value.

  That is all of the declaration. But we have to note that currently the note
  column would be output inside the typing area. This means that the note
  column would overwrite the text.

\begin{lstcode}
  \begin{document}

  \title{Kommentar zum GüdaVaS}
  \author{Professor R. O. Tenase}
  \date{11.\,11.~2011}
  \maketitle
  \tableofcontents

  \section{Vormerkung}
  Das GüdaVaS ist ohne jeden Zweifel das wichtigste
  Gesetz, das in Spaßmanien in den letzten eintausend
  Jahren verabschiedet wurde. Die erste Lesung fand
  bereits am 11.\,11.~1111 im obersten spaßmanischen
  Kongress statt, wurde aber vom damaligen Spaßvesier
  abgelehnt. Erst nach Umwandlung der spaßmanischen,
  aberwitzigen Monarchie in eine repräsentative,
  witzige Monarchie durch W. Itzbold, 
  den Urkomischen, am 9.\,9.~1999 war der Weg für 
  dieses Gesetz endlich frei.
\end{lstcode}
  Because the text area has not been reduced\textnote{Attention!}, the
  preamble is output with the whole width of the typing area. To test this,
  you can temporarily add:
\begin{lstcode}
  \end{document}
\end{lstcode}
\end{Example}
%
Until now, the example does not give any answer to the question, how the text
of the comments will be printed with a smaller width. You will find this in
the continuation of the example below.%
\EndIndexGroup


\section{Making a Note}
\seclabel{makenote}

After having declared a note column, we can make notes for this column. But
these notes will not be output immediately. Instead of this, they are written
into a helper file with extension ``\File{.slnc}''. If you want to know the
exactly workout: First they are written to the \File{aux}-file and while
reading the \File{aux}-file inside of \Macro{end}\PParameter{document} they
will be copied to the \File{slnc}-file. Thereby setting of
\Macro{nofiles}\IndexCmd{nofiles} will be respected. At the next \LaTeX{} run,
the helper file will be read step by step depending on the progress of the
document and at the end of the page the note will be output.

But you should note\textnote{Attention!} that note columns are output only in
pages with a page style of package
\Package{scrlayer}\IndexPackage{scrlayer}. This package will be loaded by
\Package{scrlayer-notecolumn} automatically and by default provides only one
page style, \PageStyle{empty}\IndexPagestyle{empty}. Usage of additional
package \Package{scrlayer-scrpage}\IndexPackage{scrlayer-scrpage} is
recommended, if you need more page styles.

\begin{Declaration}
  \Macro{makenote}\OParameter{note column name}\Parameter{note}\\
  \Macro{makenote*}\OParameter{note column name}\Parameter{note}\\
\end{Declaration}
This command may be used to make a new \PName{note}. The current vertical
position is used as the vertical position of the start of the
\PName{note}. The horizontal position depends only on the defined position of
the note column. To work correct, the package needs
\Macro{pdfsavepos}\IndexCmd{pdfsavepos},
\Macro{pdflastypos}\IndexCmd{pdflastypos}, and
\Macro{pdfpageheight}\IndexLength{pdfpageheight}. Without these primitives
\Package{scrlayer-notecolumn} cannot be used. The primitives should act
exactly as they would using PDF\TeX.

However, if the package recognises a collision\textnote{collision avoidance}
with the output of a former \PName{note}, then the new \PName{note} will be
delayed until the end of the former \PName{note}. If the \PName{note} does not
fit into the page\textnote{page break}\Index{page>break}, it will be moved at
whole or only at part to the next page.

The optional argument \PName{note column name} determines which note column
should be used for the \PName{note}. The predefined note column
\PValue{marginpar} is used, if the optional argument is omitted.%
\begin{Example}
  Let's add a commented section into the example of the previous section. The
  section itself is put into the note column:
\begin{lstcode}
  \section{Analyse}
  \begin{addmargin}[0pt]{.333\textwidth}
    \makenote[paragraphs]{%
      \protect\begin{contract}
        \protect\Clause{%
          title={Kein Witz ohne Publikum}%
        }
        Ein Witz kann nur dort witzig sein, wo er 
        auf ein Publikum trifft.
      \protect\end{contract}%
    }
    Dies ist eine der zentralsten Aussagen des 
    Gesetzes. Sie ist derart elementar, dass es
    durchaus angebracht ist, sich vor der Weisheit 
    der Verfasser zu verbeugen.
\end{lstcode}
  Environment
  \DescRef{maincls.env.addmargin}\IndexEnv{addmargin}\textnote{column 
    width by \DescRef{maincls.env.addmargin}}, which is described in
  \autoref{sec:maincls.lists}, \DescPageRef{maincls.env.addmargin}, is
  used to reduce the width of the main text by the width of the section
  column.

  Here you can see one of the few problems of using
  \Macro{makenote}. Because the mandatory argument will be written into a
  helper file, commands\textnote{fragile commands} inside this argument
  unfortunately can \emph{break}. To avoid this, it is recommended to use
  \Macro{protect} in front of all commands that should not expand while
  writing the helper file. Otherwise using a command inside this argument
  could result in an error message.

  In principle you could finish this example already with:
\begin{lstcode}
  \end{addmargin}
  \end{document}
\end{lstcode}
  to see a first result.
\end{Example}
If you'll test this example, you will see that the \PName{paragraphs} column
is longer than the comment. If you would\textnote{Attention!} add one more
paragraph with one more section and comment, you may have the problem, that
the new command will be put immediately after the comment above and not after
the section. So the new section would move away from the corresponding
comment. Next we will get a solution of this problem.

The\ChangedAt{v0.1.2583}{\Package{scrlayer-notecolumn}} problem with breaking
commands, that has been mentioned in the example above, does not occur with
the star variant \Macro{makenote*}. Is uses \Macro{detokenize} to avoid
expansion of commands. But this means also that you should not use commands,
which change their definition inside the document, in the \PName{note}.%
\EndIndexGroup


\begin{Declaration}
  \Macro{syncwithnotecolumn}\OParameter{note column name}
\end{Declaration}
This command adds a
synchronisation\textnote{synchronisation}\Index{synchronisation} point into
the note column and into the main text of the document. Whenever a
synchronisation point is found while output of a note column or the main text,
a mark will be generated that consists of the current page and the current
vertical position.

Together with the generation of synchronisation points it is recognised
whether a mark has been set into the note column or the main text while the
previous \LaTeX{} run. If so, the values will be compared. If the mark of the
note column is lower at the current page or on a later page, the main text
will be moved down to the position of the mark.

It is recommended to use synchronisation points\textnote{Note!} not inside
paragraphs of the main text but only between paragraphs. If you use
\Macro{syncwithnotecolumn} inside a paragraph, the synchronisation point will
be delayed until the current line has been output. This behaviour is similar
to the usage of, e.\,g., \Macro{vspace}\IndexCmd{vspace}.

Because recognition of synchronisation points can be done first at the next
\LaTeX{} run,\textnote{several \LaTeX{} runs}, the mechanism needs at least
three \LaTeX{} runs. Because of the new synchronisation later synchronisation
points may be moved. This would result in the need of additional \LaTeX{}
runs. You should have a look at the message: ``\LaTeX{} Warning: Label(s) may
have changed. Rerun to get cross-references right.''to find out whether or not
additional \LaTeX{} runs are needed.

If you do not use the optional argument, the predefined note column
\PValue{marginpar} will be used. Please note, an empty optional argument is
not the same as omitting the optional argument!

You must not use\textnote{Attention!} \Macro{syncwithnotecolumn} inside a note
itself, this means inside the mandatory Argument of
\Macro{makenote}\IndexCmd{makenote}! Currently the package cannot recognise
such a mistake and would result in synchronisation point movement at each
\LaTeX{} run. So the process will never terminate. So synchronise two or more
note columns, you have to synchronise each of them with the main text. The
recommended command for this will be described next.%
%
\begin{Example}
  Let's extend the example above, now by adding a synchronisation point
  and one more section with one more comment:
\begin{lstcode}
    \syncwithnotecolumn[paragraphs]\bigskip
    \makenote[paragraphs]{%
      \protect\begin{contract}
        \protect\Clause{title={Komik der Kultur}}
        \setcounter{par}{0}%
        Die Komik eines Witzes kann durch das 
        kulturelle Umfeld, in dem er erzählt wird,
        bestimmt sein.

        Die Komik eines Witzes kann durch das 
        kulturelle Umfeld, in dem er spielt, 
        bestimmt sein.
      \protect\end{contract}
    }
    Die kulturelle Komponente eines Witzes ist 
    tatsächlich nicht zu vernachlässigen. Über die
    politische Korrektheit der Nutzung des
    kulturellen Umfeldes kann zwar trefflich 
    gestritten werden, nichtsdestotrotz ist die 
    Treffsicherheit einer solchen Komik im
    entsprechenden Umfeld frappierend. Auf der 
    anderen Seite kann ein vermeintlicher Witz im
    falschen kulturellen Umfeld auch zu einer 
    echten Gefahr für den Witzeerzähler werden.
\end{lstcode}
  Beside the synchronisation point a vertical distance is added by
  \Macro{bigskip} to better separate the section and the corresponding
  comments.

  Again\textnote{Attention}, one more potential problem is shown. Because the
  note columns uses boxes, that are build and split, counters\textnote{counter
    in note column} inside note columns can sometimes jitter. In the example
  the first paragraph would be numbered 2 instead of 1. This can easily be
  fixed by a courageous reset of the counter.

  Now, the example is almost finished. You just have to finish the
  environments:
\begin{lstcode}
  \end{addmargin}
  \end{document}
\end{lstcode}
  In fact, all other section of the law should also be commented. But let us
  focus on the main purpose.
\end{Example}
But stop! What, if the section in the \PName{paragraphs}
note column wouldn't fit to the last page? Would it be output on the next
pages? We will answer this question in the next paragraph.%
\EndIndexGroup


\begin{Declaration}
  \Macro{syncwithnotecolumns}\OParameter{list of note column names}
\end{Declaration}
This command will synchronise the main text with all note columns of the
comma-separated \PName{list of note column names}. To do so, the main text
will be synchronised with the note column, that have the mark closest to the
end of the document. As a side effect the note columns will be synchronised
with each other.

If the optional argument is omitted or empty (or begins with \Macro{relax}),
synchronisation will be done with all currently declared note columns.%
\EndIndexGroup


\section{Force Output of Note Columns}
\seclabel{clearnotes}

Sometimes it is necessary to have not only the normal note column output but
to be able to output all notes that haven't been output already. An example
for this effort could be that large notes result in moving lots of notes to
new pages. A good occasion to force the output\textnote{force output} could be
the end of a chapter or the end of the document.

\begin{Declaration}
  \Macro{clearnotecolumn}\OParameter{note column name}
\end{Declaration}
This command can be used to force the output of all notes\textnote{delayed
  notes} of a selected note column that haven't been output until the end of
the current page, but has been made in this page or previous pages. To force
the output empty pages will be generated. During the output of the delayed
notes of the selected note column, notes of other note columns are also output,
but only as long as there are still delayed notes of the selected note column.

During the output of the delayed notes, notes may be output by mistake that
have been placed to one of the inserted empty pages in the previous \LaTeX{}
run. This will be solved automatically by one of the next \LaTeX{}
runs. You can realise such movement of notes by the message: ``\LaTeX{}
Warning: Label(s) may have changed. Rerun to get cross-references right.''

The note column related to the output, is given by the optional
argument, \PName{note column name}. If this argument is omitted, the notes of
the predefined note column \PValue{marginpar} will be output.

Attentive readers\textnote{forced output cs. synchronisation} will have noticed
that the forced output is something similar to the synchronisation. But if the
forced output really results in an output you will be at the start of a new
page and not just at the end of the output afterwards. Nevertheless, a
forced output terminates with less \LaTeX{} runs.%
\EndIndexGroup


\begin{Declaration}
  \Macro{clearnotecolumns}\OParameter{list of note column names}
\end{Declaration}
This command is similar to \DescRef{\LabelBase.cmd.clearnotecolumn} with the
difference that the optional argument is not only the name of one note column
but a comma-separated \PName{list of note column names}. It forces the output
of the notes of all these note columns.

If you omit the optional argument, all delayed notes of all note columns will
be output.%
\EndIndexGroup


\begin{Declaration}
  \OptionVName{autoclearnotecolumns}{simple switch}
\end{Declaration}
Usually you would like to force the output of notes whenever a document
implicitly\,---\,e.\,g. because of a \DescRef{maincls.cmd.chapter}
command\,---\,or explicitly executes \DescRef{maincls.cmd.clearpage}. Note
that this is also the case at the end of the document inside
\Macro{end}\PParameter{document}. Option \Option{autoclearnotecolumns} manages
whether or not \DescRef{maincls.cmd.clearpage} should also executes
\DescRef{\LabelBase.cmd.clearnotecolumns} without any optional argument.

According to the author's preference the option is active by
default. But you can change this with proper values for simple switches (see
\autoref{tab:truefalseswitch}, \autopageref{tab:truefalseswitch}) at any time.

You should note, that deactivation of the option can result in lost notes at
the end of the document. So you should insert
\DescRef{\LabelBase.cmd.clearnotecolumns} before
\Macro{end}\PParameter{document} if you deactivate the option.

This should answer the question from the end of the last section. By default
the section would be output even if it would need the output of one more
page. But because this would be done after the end of the
\DescRef{maincls.env.addmargin} environment, the forced output could overlap
with main text after that environment. So it would be useful to either add one
more synchronisation point or to force the output explicitly immediately at
the end of the \DescRef{maincls.env.addmargin} environment.

The result of the example is shown in
\autoref{fig:scrlayer-notecolumn.example}.\iffree{}{ Only the colour has been
  changed from blue into grey.}

\begin{figure}
  \KOMAoptions{captions=bottombeside}%
  \setcapindent{0pt}%
  \begin{captionbeside}[{An example page to the example of
      \autoref{cha:scrlayer-notecolumn}}]{An example page to the example of
      this chapter\label{fig:scrlayer-notecolumn.example}}[l]
  \frame{\includegraphics[width=.5\textwidth,keepaspectratio]%
    {scrlayer-notecolumn-example}}
  \end{captionbeside}
\end{figure}
\EndIndexGroup
%
\EndIndexGroup

%%% Local Variables:
%%% mode: latex
%%% mode: flyspell
%%% coding: iso-latin-1
%%% ispell-local-dictionary: "en_GB"
%%% TeX-master: "../guide"
%%% End: