summaryrefslogtreecommitdiff
path: root/tex/context/base/cont-new.mkiv
blob: 5730e9d36c35de2ae259ef501886a5225ed61d5d (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
%D \module
%D   [       file=cont-new,
%D        version=1995.10.10,
%D          title=\CONTEXT\ Miscellaneous Macros,
%D       subtitle=New Macros,
%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.

\newcontextversion{2014.10.08 23:31}

%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.

\unprotect

% \writestatus\m!system{beware: some patches loaded from cont-new.mkiv}

% \attribute152\zerocount : marks ... lots of sweeps so best early in list

%D Maybe:

% \appendtoks
%     \inheritmaintextcolor
% \to \everybeforenoteinsert

% \appendtoks
%     \inheritmaintextcolor
% \to \everymargindatacontent

% This is experimental; if this changes we need to adapt the mb-mp style too. It's
% not in the core yet.
%
% \def\ActionY{\blank\inleftmargin{\shownofparlines}}
% \def\ActionN{\inleftmargin{\shownofparlines}}
%
% \saveparnumber
% ...
% \checknofparlines
% \ifnum\nofparlines<2
%   \ActionY
% \else
%   \ActionN
% \fi
% ...

\newcount\c_typo_par_current
\newcount\c_typo_par_saved
\newcount\c_typo_par_lines
\newcount\c_typo_par_temp

\appendtoks
    \advance\c_typo_par_current\plusone % local
   %\llap{\infofont[\the\c_typo_par_saved:\the\c_typo_par_current]\quad}%
\to \everypar

\unexpanded\def\saveparnumber % the upcoming number
  {\c_typo_par_saved\c_typo_par_current} % local

\def\savedparnumber  {\number\c_typo_par_saved}
\def\currentparnumber{\number\c_typo_par_current}
\def\nofparlines     {\number\c_typo_par_lines}

\unexpanded\def\shownofparlines
  {\dontleavehmode\hbox\bgroup
   \infofont[\savedparstate]%
   \egroup}

\unexpanded\def\checknofparlines
  {\c_typo_par_temp\numexpr\c_typo_par_saved+\plusone\relax
   \ifhmode
     \c_typo_par_lines\zerocount
     \edef\savedparstate{\number\c_typo_par_temp:\number\c_typo_par_current\space-}%
   \else\ifnum\c_typo_par_current=\c_typo_par_temp
     \c_typo_par_lines\prevgraf
     \edef\savedparstate{\number\c_typo_par_temp:\number\c_typo_par_current\space\number\prevgraf}%
   \else\ifnum\c_typo_par_temp>\c_typo_par_current
     \c_typo_par_lines\zerocount
     \edef\savedparstate{\number\c_typo_par_temp:\number\c_typo_par_current\space-}%
   \else
     \c_typo_par_lines\maxdimen
     \edef\savedparstate{\number\c_typo_par_temp:\number\c_typo_par_current\space+}%
   \fi\fi\fi}

%D Maybe:

\unexpanded\def\tightvbox{\dowithnextbox{\dp\nextbox\zeropoint\box\nextbox}\vbox}
\unexpanded\def\tightvtop{\dowithnextbox{\ht\nextbox\zeropoint\box\nextbox}\vtop}

%D Needs some work:

\unexpanded\def\startgridcorrection
  {\dosingleempty\spac_grid_correction_start}

\def\spac_grid_correction_start[#1]%
  {\ifgridsnapping
     \snaptogrid[#1]\vbox\bgroup
   \else
     \startbaselinecorrection
   \fi}

\unexpanded\def\stopgridcorrection
  {\ifgridsnapping
     \egroup
   \else
     \stopbaselinecorrection
   \fi}

\unexpanded\def\checkgridsnapping
  {\lineskip\ifgridsnapping\zeropoint\else\normallineskip\fi}

%D Probably obsolete:

\unexpanded\def\startcolumnmakeup % don't change
  {\bgroup
   \getrawnoflines\textheight % raw as we cna have topskip
   \setbox\scratchbox\vbox to \dimexpr\noflines\lineheight-\lineheight+\topskip\relax
     \bgroup
     \forgetall}

\unexpanded\def\stopcolumnmakeup
  {\egroup
   \dp\scratchbox\zeropoint
   \wd\scratchbox\textwidth
   \box\scratchbox
   \egroup
   \page_otr_command_synchronize_hsize}

%D Till we fixed all styles:

\let\\=\crlf

\protect \endinput