1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Anchoring Macros Backgrounds}
15
16
17
18
19
20
21\unprotect
22
23
24
25
26
27
28
29
30
31
32\newcount\c_anch_backgrounds_text_n
33
34\def\v_anch_backgrounds_text_current {tbg:0}
35\def\v_anch_backgrounds_anchor_current_b{b:\v_anch_backgrounds_text_current}
36\def\v_anch_backgrounds_anchor_current_e{e:\v_anch_backgrounds_text_current}
37
38\def\anch_backgrounds_text_initialize_next
39 {\global\advance\c_anch_backgrounds_text_n\plusone
40 \edef\v_anch_backgrounds_text_current{tbg:\number\c_anch_backgrounds_text_n}}
41
42
43
44
45
46
47
48\unexpanded\def\anch_backgrounds_text_initialize
49 {\doifelsepositionsused\enableparpositions\donothing
50 \glet\anch_backgrounds_text_initialize\relax}
51
52\appendtoks
53 \anch_backgrounds_text_initialize
54\to \everystarttext
55
56
57
58\newcount\MPparcounter
59
60\def\MPself {\MPvar{self}}
61\def\MPbself {b:\MPvar{self}}
62\def\MPeself {e:\MPvar{self}}
63\def\MPparanchor{p:\number\MPparcounter}
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\newcount\c_anch_backgrounds_text_level
91
92\installcorenamespace{textbackground}
93\installcorenamespace{textbackgroundlevel}
94
95\installcommandhandler \??textbackground {textbackground} \??textbackground
96
97\appendtoks
98 \setuevalue{\currenttextbackground}{\groupedcommand{\starttextbackground[\currenttextbackground]}{\stoptextbackground}}
99 \setuevalue{\e!start\currenttextbackground}{\starttextbackground[\currenttextbackground]}
100 \setuevalue{\e!stop \currenttextbackground}{\stoptextbackground}
101\to \everydefinetextbackground
102
103\newconstant \c_anch_backgrounds_pos_state
104\newconditional\c_anch_backgrounds_pos_no_shape
105
106\def\anch_backgrounds_bpos
107 {\ifconditional\c_anch_backgrounds_pos_no_shape
108 \bposkind\v_anch_backgrounds_text_current\plusthree
109 \else
110 \bposkind\v_anch_backgrounds_text_current\c_anch_backgrounds_pos_state
111 \fi}
112
113\def\anch_backgrounds_epos
114 {\ifconditional\c_anch_backgrounds_pos_no_shape
115 \eposkind\v_anch_backgrounds_text_current\plusthree
116 \else
117 \eposkind\v_anch_backgrounds_text_current\c_anch_backgrounds_pos_state
118 \fi}
119
120\unexpanded\def\starttextbackground
121 {\begingroup
122 \advance\c_anch_backgrounds_text_level\plusone
123 \dodoubleempty\anch_backgrounds_text_start}
124
125\def\anch_backgrounds_text_start[#tag][#settings]
126 {
127 \def\currenttextbackground{#tag}
128 \anch_backgrounds_text_initialize_next
129 \ifsecondargument
130 \setupcurrenttextbackground[#settings]
131 \fi
132 \doifelse{\textbackgroundparameter\c!state}\v!start
133 \anch_backgrounds_text_preset_yes
134 \anch_backgrounds_text_preset_nop
135 \anch_backgrounds_text_start_indeed}
136
137
138
139\newcount \c_anch_backgrounds_text_count
140\newcount \c_anch_backgrounds_text_check
141\newconstant\c_anch_backgrounds_text_state
142
143\unexpanded\def\starttextbackground
144 {\begingroup
145 \global\advance\c_anch_backgrounds_text_count\plusone
146 \advance\c_anch_backgrounds_text_level\plusone
147 \dodoubleempty\anch_backgrounds_text_start}
148
149\def\anch_backgrounds_text_level_start
150 {\c_anch_backgrounds_text_check\c_anch_backgrounds_text_count}
151
152\def\anch_backgrounds_text_level_stop
153 {\c_anch_backgrounds_text_state
154 \ifnum\c_anch_backgrounds_text_count>\c_anch_backgrounds_text_check
155 \plusone
156 \else
157 \zerocount
158 \fi}
159
160
161
162
163
164
165\let\anch_backgrounds_text_start_indeed\relax
166\let\anch_backgrounds_text_stop_indeed \relax
167
168\setvalue{\??textbackgroundlevel\v!text}
169 {\let\anch_backgrounds_text_start_indeed\anch_backgrounds_text_start_txt
170 \let\anch_backgrounds_text_stop_indeed \anch_backgrounds_text_stop_txt}
171
172\setvalue{\??textbackgroundlevel\v!paragraph}
173 {\ifnum\c_anch_backgrounds_text_level>\textbackgroundparameter\c!criterium\relax
174 \let\anch_backgrounds_text_start_indeed\anch_backgrounds_text_start_txt
175 \let\anch_backgrounds_text_stop_indeed \anch_backgrounds_text_stop_txt
176 \else
177 \let\anch_backgrounds_text_start_indeed\anch_backgrounds_text_start_par
178 \let\anch_backgrounds_text_stop_indeed \anch_backgrounds_text_stop_par
179 \fi}
180
181\setvalue{\??textbackgroundlevel\v!always}
182 {\let\anch_backgrounds_text_start_indeed\anch_backgrounds_text_start_par
183 \let\anch_backgrounds_text_stop_indeed \anch_backgrounds_text_stop_par}
184
185\setvalue{\??textbackgroundlevel\v!none}
186 {\anch_backgrounds_text_preset_nop}
187
188\def\anch_backgrounds_text_preset_nop
189 {\let\anch_backgrounds_text_start_indeed\relax
190 \let\anch_backgrounds_text_stop_indeed \relax}
191
192\def\anch_backgrounds_text_preset_yes
193 {\anch_backgrounds_text_preset_nop
194 \csname\??textbackgroundlevel\textbackgroundparameter\c!location\endcsname
195 \edef\p_anch_backgrounds_text_frame {\textbackgroundparameter\c!frame}
196 \edef\p_anch_backgrounds_text_corner {\textbackgroundparameter\c!corner}
197 \edef\p_anch_backgrounds_text_background{\textbackgroundparameter\c!background}
198 \ifx\p_anch_backgrounds_text_frame\v!on
199 \ifx\p_anch_backgrounds_text_corner\v!round
200 \let\p_anch_backgrounds_text_frame\!!plustwo
201 \else
202 \let\p_anch_backgrounds_text_frame\!!plusone
203 \fi
204 \else
205 \let\p_anch_backgrounds_text_frame\!!zerocount
206 \fi
207 \ifx\p_anch_backgrounds_text_background\v!color
208 \let\p_anch_backgrounds_text_background\!!plusone
209 \else
210 \let\p_anch_backgrounds_text_background\!!zerocount
211 \fi
212 \startpositionoverlay{\textbackgroundoverlay{\textbackgroundparameter\c!level}}
213 \anch_backgrounds_text_meta_graphic
214 \stoppositionoverlay}
215
216\def\anch_backgrounds_text_meta_graphic
217 {\normalexpanded
218 {\setMPpositiongraphicrange
219 {\v_anch_backgrounds_anchor_current_b}
220 {\v_anch_backgrounds_anchor_current_e}
221 {\textbackgroundparameter\c!method}
222 {self=\v_anch_backgrounds_text_current,
223 mp=\textbackgroundparameter\c!mp,
224 gridtype=\textbackgroundparameter\c!alternative,
225 filltype=\p_anch_backgrounds_text_background,
226 linetype=\p_anch_backgrounds_text_frame,
227 dashtype=\textbackgroundparameter\c!dash,
228 gridcolor=\textbackgroundparameter\c!framecolor,
229 linecolor=\textbackgroundparameter\c!framecolor,
230 lineoffset=\textbackgroundparameter\c!frameoffset,
231 fillcolor=\textbackgroundparameter\c!backgroundcolor,
232 filloffset=\textbackgroundparameter\c!backgroundoffset,
233 gridwidth=\textbackgroundparameter\c!rulethickness,
234 gridshift=\textbackgroundparameter\c!voffset,
235 linewidth=\textbackgroundparameter\c!rulethickness,
236 lineradius=\textbackgroundparameter\c!radius}}}
237
238\unexpanded\def\stoptextbackground
239 {\anch_backgrounds_text_stop_indeed
240 \carryoverpar\endgroup}
241
242\unexpanded\def\starttextbackgroundmanual
243 {\begingroup
244 \c_anch_backgrounds_pos_state\plusone
245 \usetextbackgroundstyleandcolor\c!style\c!color
246 \anch_backgrounds_bpos}
247
248\unexpanded\def\stoptextbackgroundmanual
249 {\anch_backgrounds_epos
250 \carryoverpar\endgroup}
251
252\def\anch_backgrounds_text_start_txt
253 {\ifvmode \dontleavehmode \fi
254 \begingroup
255 \c_anch_backgrounds_pos_state\plusone
256 \usetextbackgroundstyleandcolor\c!style\c!color
257 \anch_backgrounds_bpos}
258
259\def\anch_backgrounds_text_stop_txt
260 {\anch_backgrounds_epos
261 \carryoverpar\endgroup}
262
263\newskip\textbackgroundskip
264
265
266
267\def\anch_backgrounds_reset_attributes
268 {\scratchcounter\c_attr_snapmethod
269 \resetallattributes
270 \c_attr_snapmethod\scratchcounter}
271
272\def\anch_backgrounds_text_start_par
273 {\endgraf
274 \textbackgroundparameter\c!before
275 \begingroup
276 \c_anch_backgrounds_pos_state\plustwo
277 \begingroup
278 \anch_backgrounds_reset_attributes
279 \noindent
280 \ifgridsnapping
281 \spac_helpers_assign_skip\textbackgroundskip{\textbackgroundparameter\c!topoffset}
282 \ifdim\textbackgroundskip>\zeropoint
283 \struttedbox
284 {\hpack{\raise\textbackgroundskip\hpack{\anch_backgrounds_bpos}}}
285 \else
286 \anch_backgrounds_bpos
287 \fi
288 \else
289 \anch_backgrounds_bpos
290 \fi
291 \endgraf
292 \endgroup
293 \nobreak
294 \vskip\lineheight
295 \nobreak
296 \ifgridsnapping \else
297 \spac_helpers_assign_skip\textbackgroundskip{\textbackgroundparameter\c!topoffset}
298 \ifdim\textbackgroundskip>\zeropoint
299 \kern\textbackgroundskip\nobreak
300 \fi
301 \fi
302 \dosetleftskipadaption{\textbackgroundparameter\c!leftoffset}
303 \advance\leftskip\leftskipadaption
304 \dosetleftskipadaption{\textbackgroundparameter\c!rightoffset}
305 \advance\rightskip\leftskipadaption
306
307 \dosetraggedcommand{\textbackgroundparameter\c!align}
308 \raggedcommand
309
310 \usetextbackgroundstyleandcolor\c!style\c!color
311 \nowhitespace
312 \seteffectivehsize
313 \doinhibitblank
314 \par}
315
316\def\anch_backgrounds_text_stop_par
317 {\par
318 \removelastskip
319 \spac_helpers_assign_skip\textbackgroundskip{\textbackgroundparameter\c!bottomoffset}
320 \ifdim\lastskip>\zeropoint
321 \advance\textbackgroundskip\lastskip
322 \fi
323 \ifgridsnapping \else \ifdim\textbackgroundskip>\zeropoint
324 \kern\textbackgroundskip\nobreak
325 \fi \fi
326 \nobreak
327 \vskip\dimexpr\lineheight\parskip\relax
328 \nobreak
329 \endgroup
330 \begingroup
331 \forgeteverypar
332 \anch_backgrounds_reset_attributes
333 \nobreak \noindent \strut \hfill \kern\zeropoint
334
335 \spac_helpers_assign_skip\textbackgroundskip{\textbackgroundparameter\c!bottomoffset}
336 \ifgridsnapping
337 \ifdim\textbackgroundskip>\zeropoint
338 \struttedbox
339 {\hpack{\lower\textbackgroundskip\hpack{\anch_backgrounds_epos}}}
340 \else
341 \anch_backgrounds_epos
342 \fi
343 \else
344 \anch_backgrounds_epos
345 \fi
346 \endgraf
347 \carryoverpar\endgroup
348 \endgraf
349 \textbackgroundparameter\c!after}
350
351\unexpanded\def\checkpositionoverlays
352 {\ifproductionrun
353 \enabletextarearegistration
354 \enablehiddenbackground
355 \glet\checkpositionoverlays\relax
356 \fi}
357
358
359
360\definesystemattribute[textbackground][public]
361
362
363
364
365\def\anch_backgrounds_bpos
366 {\ifconditional\c_anch_backgrounds_pos_no_shape
367 \c_attr_textbackground\attributeunsetvalue
368 \bposkind\v_anch_backgrounds_text_current\plusthree
369 \else\ifnum\c_anch_backgrounds_pos_state=\plusone
370 \bposkind\v_anch_backgrounds_text_current\c_anch_backgrounds_pos_state
371 \clf_registerbackground{\v_anch_backgrounds_text_current}
372 \else
373 \bposkind\v_anch_backgrounds_text_current\c_anch_backgrounds_pos_state
374 \c_attr_textbackground\attributeunsetvalue
375 \fi\fi}
376
377
378
379\def\strc_floats_wrap_free_region
380 {\global\setbox\floatbox\hpack
381 {\ifconditional\c_strc_floats_trace_free
382 \strc_floats_show_free_region
383 \fi
384 \box\floatbox}}
385
386\startuseMPgraphic{floatfree}
387 draw_free_region(
388 \the\wd\floatbox,
389 \the\ht\floatbox,
390 \the\dp\floatbox,
391 \the\d_free_offset_left,
392 \the\d_free_offset_right,
393 \the\d_free_offset_top,
394 \the\d_free_offset_bottom
395 ) ;
396\stopuseMPgraphic
397
398\def\strc_floats_show_free_region
399 {\lower\dp\floatbox\hpack to \zeropoint {\useMPgraphic{floatfree}}}
400
401\newconditional\c_strc_floats_mark_as_free
402\newconditional\c_strc_floats_trace_free
403\newconstant \c_free_offset_kind
404\newdimen \d_free_offset_left
405\newdimen \d_free_offset_right
406\newdimen \d_free_offset_top
407\newdimen \d_free_offset_bottom
408
409\installtextracker{floats.freeregion}
410 {\settrue \c_strc_floats_trace_free}
411 {\setfalse\c_strc_floats_trace_free}
412
413\def\strc_floats_mark_as_free#1#2#3#4#5
414 {\c_free_offset_kind #1
415 \d_free_offset_left #2
416 \d_free_offset_right #3
417 \d_free_offset_top #4
418 \d_free_offset_bottom#5
419 \strc_floats_wrap_free_region
420 \anch_mark_tagged_box_free
421 \floatbox
422 \c_free_offset_kind
423 \d_free_offset_left
424 \d_free_offset_right
425 \d_free_offset_top
426 \d_free_offset_bottom}
427
428\ifx\strc_floats_mark_pag_as_free\relax \else
429 \writestatus{error}{wrong place for pagasfree}\wait
430\fi
431
432\ifx\strc_floats_mark_par_as_free\relax \else
433 \writestatus{error}{wrong place for parasfree}\wait
434\fi
435
436\def\strc_floats_mark_pag_as_free
437 {\ifpositioning
438 \ifconditional\c_strc_floats_mark_as_free
439 \strc_floats_mark_as_free
440 \plusone
441 \zeropoint
442 \zeropoint
443 \d_strc_floats_top
444 \d_strc_floats_bottom
445 \fi
446 \fi}
447
448\def\strc_floats_mark_par_as_free
449 {\ifpositioning
450 \ifconditional\c_strc_floats_mark_as_free
451 \ifcase\c_page_sides_float_type
452 \or
453 \strc_floats_mark_as_free
454 \plustwo
455 \zeropoint
456 \d_page_sides_rightoffset
457 \d_page_sides_topskip
458 \d_page_sides_bottomskip
459 \or
460 \strc_floats_mark_as_free
461 \plustwo
462 \zeropoint
463 \d_page_sides_rightoffset
464 \d_page_sides_topskip
465 \d_page_sides_bottomskip
466 \or
467 \strc_floats_mark_as_free
468 \plustwo
469 \zeropoint
470 \d_page_sides_rightoffset
471 \d_page_sides_topskip
472 \d_page_sides_bottomskip
473 \or
474 \strc_floats_mark_as_free
475 \plustwo
476 \d_page_sides_leftskip
477 \d_page_sides_margin
478 \d_page_sides_topskip
479 \d_page_sides_bottomskip
480 \or
481 \strc_floats_mark_as_free
482 \plusthree
483 \d_page_sides_margin
484 \d_page_sides_rightskip
485 \d_page_sides_topskip
486 \d_page_sides_bottomskip
487 \or
488 \strc_floats_mark_as_free
489 \plusthree
490 \d_page_sides_leftoffset
491 \zeropoint
492 \d_page_sides_topskip
493 \d_page_sides_bottomskip
494 \or
495 \strc_floats_mark_as_free
496 \plusthree
497 \d_page_sides_leftoffset
498 \zeropoint
499 \d_page_sides_topskip
500 \d_page_sides_bottomskip
501 \or
502 \strc_floats_mark_as_free
503 \plusthree
504 \d_page_sides_leftoffset
505 \zeropoint
506 \d_page_sides_topskip
507 \d_page_sides_bottomskip
508 \fi
509 \fi
510 \fi}
511
512
513
514\setuptextbackground
515 [\c!mp=mpos:region:draw,
516 \c!method=mpos:region,
517 \c!state=\v!start,
518 \c!location=\v!text,
519 \c!leftoffset=\!!zeropoint,
520 \c!rightoffset=\textbackgroundparameter\c!leftoffset,
521 \c!topoffset=\!!zeropoint,
522 \c!bottomoffset=\textbackgroundparameter\c!topoffset,
523 \c!criterium=\plusone,
524 \c!level=1,
525 \c!alternative=0,
526 \c!align=,
527 \c!dash=0,
528 \c!background=\v!color,
529 \c!backgroundcolor=lightgray,
530 \c!backgroundoffset=\!!zeropoint,
531 \c!corner=\v!rectangular,
532 \c!radius=.5\bodyfontsize,
533 \c!voffset=\!!zeropoint,
534 \c!frame=\v!on,
535 \c!framecolor=blue,
536 \c!frameoffset=\!!zeropoint,
537 \c!rulethickness=\linewidth]
538
539
540
541
542
543
544\setupMPvariables
545 [mpos:region]
546 [mp=mpos:region:unset,
547 gridtype=0,
548 linetype=1,
549 filltype=1,
550 dashtype=0,
551 gridcolor=red,
552 linecolor=blue,
553 fillcolor=lightgray,
554 filloffset=\!!zeropoint,
555 linewidth=\linewidth,
556 gridwidth=\linewidth,
557 gridshift=\!!zeropoint,
558 lineradius=.5\bodyfontsize,
559 lineoffset=\!!zeropoint,
560 dashtype=1]
561
562\startuseMPgraphic{mpos:region:setup}
563 boxgridtype := \MPvar{gridtype} ;
564 boxlinetype := \MPvar{linetype} ;
565 boxfilltype := \MPvar{filltype} ;
566 boxdashtype := \MPvar{dashtype} ;
567 boxfilloffset := \MPvar{filloffset} ;
568 boxlinewidth := \MPvar{linewidth} ;
569 boxgridwidth := \MPvar{gridwidth} ;
570 boxgridshift := \MPvar{gridshift} ;
571 boxlineradius := \MPvar{lineradius} ;
572 boxlineoffset := \MPvar{lineoffset} ;
573
574 def boxgridcolor = \MPvar{gridcolor} enddef ;
575 def boxlinecolor = \MPvar{linecolor} enddef ;
576 def boxfillcolor = \MPvar{fillcolor} enddef ;
577
578 def boxgridoptions = withcolor boxgridcolor enddef ;
579 def boxlineoptions = withcolor boxlinecolor enddef ;
580 def boxfilloptions = withcolor boxfillcolor enddef ;
581\stopuseMPgraphic
582
583\startuseMPgraphic{mpos:region:extra}
584
585\stopuseMPgraphic
586
587\startuseMPgraphic{mpos:region:anchor}
588 setbounds currentpicture to multibox ;
589\stopuseMPgraphic
590
591\startMPpositiongraphic{mpos:region}{fillcolor,filloffset,linecolor,gridcolor,linewidth,gridwidth,gridshift,lineradius,lineoffset}
592 \includeMPgraphic{mpos:region:setup} ;
593 \includeMPgraphic{mpos:region:extra} ;
594 \MPgetmultipars{\MPvar{self}}{\MPanchorid} ;
595 \includeMPgraphic{\MPvar{mp}} ;
596 \includeMPgraphic{mpos:region:anchor} ;
597\stopMPpositiongraphic
598
599
600
601\startMPpositiongraphic{mpos:box}{fillcolor,linecolor,linewidth}
602 string tag; tag := "\MPvar{self}" ;
603 path box ; box := positionbox(tag) ;
604
605 box := box enlarged \MPvar{filloffset} ;
606 fill box withcolor \MPvar{fillcolor} ;
607 draw box withcolor \MPvar{linecolor} withpen pencircle scaled \MPvar{linewidth} ;
608
609 positioninregion;
610\stopMPpositiongraphic
611
612\startMPpositionmethod{mpos:region}
613 \MPpositiongraphic{mpos:region}{}
614\stopMPpositionmethod
615
616\startuseMPgraphic{mpos:region:draw}
617 draw_multi_pars
618\stopuseMPgraphic
619
620\startuseMPgraphic{mpos:region:show}
621 show_multi_pars
622\stopuseMPgraphic
623
624\startuseMPgraphic{mpos:region:kind}
625 show_multi_kind
626\stopuseMPgraphic
627
628\startuseMPgraphic{mpos:region:sideline}
629 draw_multi_side
630\stopuseMPgraphic
631
632\startuseMPgraphic{mpos:region:sideline:dashed}
633 draw_multi_side_path dashed evenly ;
634\stopuseMPgraphic
635
636
637
638\definetextbackground
639 [\v!grid]
640 [\c!state=\v!stop,
641 \c!location=\v!paragraph,
642 \c!frame=\v!off,
643 \c!framecolor=red,
644 \c!background=,
645 \c!alternative=1]
646
647\ifx\basegrid\undefined \else \letvalue\v!grid=\basegrid \fi
648
649
650
651\setupMPvariables
652 [mpos:encircle]
653 [fillcolor=lightgray,
654 filloffset=\!!zeropoint,
655 linecolor=blue,
656 lineoffset=5pt,
657 linewidth=1pt]
658
659\startMPpositiongraphic{mpos:encircle}{linecolor,fillcolor,linewidth,lineoffset}
660 \MPgetposboxes{\MPvar{self}}{\MPanchorid}
661 if nofposboxes = 1 :
662 posboxes[1] := posboxes[1] enlarged \MPvar{lineoffset} cornered \MPvar{lineoffset} ;
663 fill posboxes[1] withcolor \MPvar{fillcolor} ;
664 draw posboxes[1] withpen pencircle scaled \MPvar{linewidth} withcolor \MPvar{linecolor} ;
665 fi ;
666\stopMPpositiongraphic
667
668\setupMPvariables
669 [mpos:connect]
670 [linecolor=red,
671 lineoffset=.25ex,
672 linewidth=1pt]
673
674\startMPpositiongraphic{mpos:connect}{linecolor,lineoffset,linewidth}
675 boxlinewidth := \MPvar{linewidth} ;
676 boxlineoffset := \MPvar{lineoffset} ;
677 def boxlineoptions = withcolor \MPvar{linecolor} enddef ;
678 \MPgetposboxes{\MPvar{from},\MPvar{to}}{\MPanchorid}
679 connect_positions ;
680\stopMPpositiongraphic
681
682\protect \endinput
683
684\definetextbackground[underline] [location=text,alternative=1,background=,frame=off]
685\definetextbackground[overstrike] [location=text,alternative=2,background=,frame=off]
686\definetextbackground[exlines] [location=text,alternative=3,background=,frame=off]
687\definetextbackground[strikethrough][location=text,alternative=4,background=,frame=off]
688
689\definestartstop [underline]
690 [before={\starttextbackground[underline]},
691 after=\stoptextbackground]
692
693\definestartstop
694 [overstrike]
695 [before={\starttextbackground[overstrike]},
696 after=\stoptextbackground]
697
698\definestartstop
699 [exlines]
700 [before={\starttextbackground[exlines]},
701 after=\stoptextbackground]
702
703\definestartstop
704 [strikethrough]
705 [before={\starttextbackground[strikethrough]},
706 after=\stoptextbackground]
707
708\definetextbackground
709 [sideline]
710 [mp=mpos:region:sideline,
711 location=paragraph,
712 framecolor=red,
713 frameoffset=5mm]
714
715\definestartstop [sideline]
716 [before={\starttextbackground[sideline]},
717 after=\stoptextbackground]
718
719\starttext
720
721 \startunderline \input tufte \stopunderline \blank
722 \startoverstrike \input tufte \stopoverstrike \blank
723 \startexlines \input tufte \stopexlines \blank
724 \startstrikethrough \input tufte \stopstrikethrough \blank
725 \startsideline \input tufte \stopsideline \blank
726
727 \page
728
729 \startpositionoverlay{text1}
730 \setMPpositiongraphic{connect1b}{mpos:connect}{from=connect1b,to=connect1e}
731 \setMPpositiongraphic{connect1e}{mpos:connect}{from=connect1b,to=connect1e}
732 \stoppositionoverlay
733
734 \startpositionoverlay{text1}
735 \setMPpositiongraphic{encircle1}{mpos:encircle}{self=encircle1}
736 \stoppositionoverlay
737
738 test \hpos{connect1b}{START}
739 \dorecurse{10}{\input ward}
740 \hpos{encircle1}{\strut HERE}
741 \dorecurse{10}{\input ward}
742 \hpos{connect1e}{STOP} test
743
744\stoptext
745 |