summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex/bidi/multicol-xetex-bidi.def
blob: d9e248ab424831c04ea91a3728af9ce7f3a74f7b (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
%%
%% This is file `multicol-xetex-bidi.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bidi.dtx  (with options: `table,multicol-xetex-bidi.def')
%% 
%%   __________________________________________________
%%   Copyright (c) 2009--2018  Vafa Khalighi
%% 
%%   It may be distributed and/or modified under the LaTeX Project Public License,
%%   version 1.3c or higher (your choice). The latest version of
%%   this license is at: http://www.latex-project.org/lppl.txt
%% 
%%   This work is “author-maintained” (as per LPPL maintenance status)
%%   by Vafa Khalighi.
%% 
%% 
%% \CheckSum{50046}
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\ProvidesFile{multicol-xetex-bidi.def}[2018/10/07 v1.1 bidi adaptations for multicol package for XeTeX engine]
\def\page@sofar{%
   \process@cols\mult@rightbox
       {\ifvoid\count@
          \setbox\count@\hbox to\hsize{}%
        \else
          \wd\count@\hsize
        \fi}%
   \count@\col@number \advance\count@\m@ne
   \mult@info\z@
    {Column spec: \the\full@width\space = indent
                  + columns + sep =\MessageBreak
        \the\multicol@leftmargin\space
        + \the\col@number\space
        x \the\hsize\space
        + \the\count@\space
        x \the\columnsep
     }%
\ifvmode\else\errmessage{Multicol Error}\fi
   \nointerlineskip
   \setbox\z@\hbox{p}\global\dimen\tw@\dp\z@
   \moveright\multicol@leftmargin
    \hbox to\full@width{%
       \bidi@multicol@align@columns
       \rlap{\phantom p}%
    }%
 \prevdepth\z@
 \kern-\dimen\tw@
 \ifdim\dimen\tw@ > \mc@gridwarn
   \PackageWarning{multicol}%
     {Very deep columns!\MessageBreak
      Grid alignment might be broken}%
 \fi
}
\def\LTR@column@boxes{%
    \process@cols\mult@gfirstbox{%
       \ifdim\dp\count@>\dimen\tw@
         \global\dimen\tw@\dp\count@ \fi
       \mc@col@status@write
       \box\count@
       \hss{\columnseprulecolor\vrule
              \@width\columnseprule}\hss}%
     \ifdim\dp\mult@rightbox>\dimen\tw@
       \global\dimen\tw@\dp\mult@rightbox \fi
     \mc@lastcol@status@write
     \box\mult@rightbox
}

\def\RTL@column@boxes{%
  \ifnum\col@number<\tw@
     \LTR@column@boxes
  \else
     \process@cols\mult@gfirstbox{%
       \hskip\hsize
       \hss{\columnseprulecolor\vrule
              \@width\columnseprule}\hss
     }%
     \hskip\hsize
     \process@cols\mult@gfirstbox{%
       \ifdim\dp\count@>\dimen\tw@
         \global\dimen\tw@\dp\count@ \fi
       \hskip-\hsize
       \mc@col@status@write
       \box\count@
       \hskip-\hsize
       \hskip-\columnsep
     }%
     \ifdim\dp\mult@rightbox>\dimen\tw@
       \global\dimen\tw@\dp\mult@rightbox \fi
     \hskip-\hsize
     \mc@lastcol@status@write
     \box\mult@rightbox
     \hskip-\hsize
     \hskip\full@width
  \fi
 }
\newcommand\RTLmulticolcolumns
    {\let\bidi@multicol@align@columns
         \RTL@column@boxes}
\newcommand\LTRmulticolcolumns
    {\let\bidi@multicol@align@columns
      \LTR@column@boxes}
\newcommand\bidi@multicol@align@columns
    {\if@RTLmain\RTL@column@boxes\else\LTR@column@boxes\fi}
\bidi@AtEndPreamble{%
  \if@bidi@csdef{footinsv@l}{%
    \def\footnoterule{\kern-3\p@
      \hrule \@width \textwidth \kern 2.6\p@}%
  }{}%
}
\def\multicols#1{\col@number#1\relax
  \ifnum\col@number<\tw@
     \PackageWarning{multicol}%
      {Using `\number\col@number'
       columns doesn't seem a good idea.^^J
       I therefore use two columns instead}%
     \col@number\tw@ \fi
  \ifnum\col@number>10
     \PackageError{multicol}%
      {Too many columns}%
      {Current implementation doesn't
       support more than 10 columns.%
       \MessageBreak
       I therefore use 10 columns instead}%
     \col@number10 \fi
     \ifx\@footnotetext\mult@footnotetext\else
       \let\orig@footnotetext\@footnotetext
       \let\@footnotetext\mult@footnotetext
     \fi
     \ifx\@LTRfootnotetext\mult@LTRfootnotetext\else
       \let\orig@LTRfootnotetext\@LTRfootnotetext
       \let\@LTRfootnotetext\mult@LTRfootnotetext
     \fi
     \ifx\@RTLfootnotetext\mult@RTLfootnotetext\else
       \let\orig@RTLfootnotetext\@RTLfootnotetext
       \let\@RTLfootnotetext\mult@RTLfootnotetext
     \fi
  \@ifnextchar[\mult@cols{\mult@cols[]}}
\long\def\mult@footnotetext#1{\begingroup
         \hsize\textwidth
         \columnwidth\textwidth
         \orig@footnotetext{#1}\endgroup}
\long\def\mult@LTRfootnotetext#1{\begingroup
         \hsize\textwidth
         \columnwidth\textwidth
         \orig@LTRfootnotetext{#1}\endgroup}
\long\def\mult@RTLfootnotetext#1{\begingroup
         \hsize\textwidth
         \columnwidth\textwidth
         \orig@RTLfootnotetext{#1}\endgroup}
\def\right@footnoterule{%
  \kern-3\p@
  \hbox to \textwidth{\hskip \dimexpr\textwidth-.4\columnwidth\relax \hrulefill }
  \kern2.6\p@}
\def\textwidth@footnoterule{\kern-3\p@
  \hrule \@width \textwidth \kern 2.6\p@}
\def\bidi@leave@mult@copyins{%
   \advance\dimen@-\skip\@bidi@copyins@
   \advance\dimen@-\ht\@bidi@copyins@
}
\bidi@AtEndPreamble{%
  \if@bidi@csdef{footinsv@l}{%
    \def\bidi@leave@mult@footins@vr{%
       \advance\dimen@-\skip\footinsv@r
       \advance\dimen@-\ht\footinsv@r
     }%
    \def\bidi@leave@mult@footins@vl{%
       \advance\dimen@-\skip\footinsv@l
       \advance\dimen@-\ht\footinsv@l
     }%
    \def\bidi@init@mult@footinsv@r{%
      \multiply\count\footinsv@r\col@number
      \multiply\skip \footinsv@r\col@number
    }%
    \def\bidi@init@mult@footinsv@l{%
      \multiply\count\footinsv@l\col@number
      \multiply\skip \footinsv@l\col@number
    }%
    \def\bidi@reinsert@footnotesv@r{\ifvoid\footinsv@r\else
             \insert\footinsv@r{}\fi}%
    \def\bidi@reinsert@footnotesv@l{\ifvoid\footinsv@l\else
             \insert\footinsv@l{}\fi}%
    \bidi@patchcmd{\prepare@multicols}{%
      \reinsert@footnotes
    }{%
      \reinsert@footnotes
      \bidi@init@mult@footinsv@r
      \bidi@reinsert@footnotesv@r
      \bidi@init@mult@footinsv@l
      \bidi@reinsert@footnotesv@l
    }{}{}%
    \bidi@patchcmd{\multi@column@out}{%
      \ifnum \c@tracingmulticols>\thr@@
    }{%
       \ifvoid\footinsv@r
         \ifvoid\footinsv@l
         \else
           \PackageWarning{multicol}%
            {I moved some lines to
             the next page.\MessageBreak
             Footnotes on page
             \thepage\space might be wrong}%
         \fi
       \else
         \PackageWarning{multicol}%
          {I moved some lines to
           the next page.\MessageBreak
           Footnotes on page
           \thepage\space might be wrong}%
       \fi
  \ifnum \c@tracingmulticols>\thr@@
}{}{}%
\bidi@patchcmd{\endmulticols}{%
  \reinsert@footnotes
}{%
  \reinsert@footnotes
  \bidi@reinsert@footnotesv@r
  \bidi@reinsert@footnotesv@l
}{}{}%
\bidi@patchcmd{\speci@ls}{%
  \reinsert@footnotes
}{%
  \reinsert@footnotes
  \bidi@reinsert@footnotesv@r
  \bidi@reinsert@footnotesv@l
}{}{}%
\bidi@patchcmd{\speci@ls}{%
  \reinsert@footnotes
}{%
  \reinsert@footnotes
  \bidi@reinsert@footnotesv@r
  \bidi@reinsert@footnotesv@l
}{}{}%
  }{}%
  \bidi@patchcmd{\multi@column@out}{%
     \let\ifshr@kingsaved\ifshr@king
  }{%
    \if@bidi@csdef{footinsv@l}{%
      \divide\skip\footinsv@r\col@number
       \ifvoid\footinsv@r \else
          \bidi@leave@mult@footins@vr
       \fi
      \divide\skip\footinsv@l\col@number
       \ifvoid\footinsv@l \else
          \bidi@leave@mult@footins@vl
       \fi
     }{}%
     \ifvoid\@bidi@copyins@ \else
        \bidi@leave@mult@copyins
     \fi
     \let\ifshr@kingsaved\ifshr@king
  }{}{}%
}
\endinput
%%
%% End of file `multicol-xetex-bidi.def'.