blob: 3881d929e1cef35d9bd1b6d8a0deaeee0f4268c1 (
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
|
%D \module
%D [ file=attr-alt,
%D version=2007.06.06,
%D title=\CONTEXT\ Attribute Macros,
%D subtitle=Alternates,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
\writestatus{loading}{ConTeXt Attribute Macros / Alternates}
\registerctxluafile{attr-alt}{autosuffix}
%D The main reason for providing this is that we need to make sure we have no
%D dangling end markers when we cross a page. Public viewers don't seem to support
%D actual text at all and acrobat has some funny selection issues.
%D
%D \starttyping
%D test
%D \startalternate[text={A}]
%D \dorecurse{10}{A }
%D \startalternate[text={B}]
%D \dorecurse{10}{B }
%D \stopalternate
%D \dorecurse{10}{A }
%D \stopalternate
%D test \par
%D \stoptyping
%D
%D \starttyping
%D test \startalternate[text={e=mc^2}]!$e=mc^2$\stopalternate\par
%D test \alternate{e=mc^2}{copy:}\nbsp$e=mc^2$\par
%D \stoptyping
\unprotect
\permanent\protected\def\startalternate[#1]% maybe better/also: [text={...}]
{\begingroup
\getdummyparameters[\c!text=,#1]%
\clf_setalternate text {\dummyparameter\c!text}\relax}
\permanent\protected\def\stopalternate
{\endgroup}
\permanent\protected\def\alternate#1%
{\groupedcommand{\clf_setalternate text {#1}\relax}{}}
\permanent\protected\def\setalternate #1{\clf_setalternate text {#1}\relax}
\permanent\protected\def\resetalternate {\clf_resetalternate}
\protect \endinput
|