-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathximera.cfg
More file actions
342 lines (287 loc) · 10.9 KB
/
ximera.cfg
File metadata and controls
342 lines (287 loc) · 10.9 KB
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
%%
%% This is file `ximera.cfg',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% ximera.dtx (with options: `cfgXimera')
%% src/pagesetup.dtx (with options: `cfgXimera')
%% src/packages.dtx (with options: `cfgXimera')
%% src/jax.dtx (with options: `cfgXimera')
%% src/css.dtx (with options: `cfgXimera')
%% src/sectioning.dtx (with options: `cfgXimera')
%% src/enumerate.dtx (with options: `cfgXimera')
%% src/title.dtx (with options: `cfgXimera')
%% src/abstract.dtx (with options: `cfgXimera')
%% src/image.dtx (with options: `cfgXimera')
%% src/outcomes.dtx (with options: `cfgXimera')
%% src/textcolor.dtx (with options: `cfgXimera')
%% src/verbatim.dtx (with options: `cfgXimera')
%% src/html.dtx (with options: `cfgXimera')
%% src/ending.dtx (with options: `cfgXimera')
%% ------------:| ------------------------------------------------------------
%% ximera:| Simultaneously writing print and online interactive materials
%% Author:| Jim Fowler and Oscar Levin and Jason Nowell and Wim Obbels and Hans Parshall and Bart Snapp and Jeffrey Kuan
%% E-mail:| bart.snapp@gmail.com
%% License:| Released under the LaTeX Project Public License v1.3c or later
%% See:| http://www.latex-project.org/lppl.txt
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Preamble{xhtml,mathjax,minipage-width}
\ExplSyntaxOn
% Get the value of rowhead key and save it in the \lTblrRowHeadInt for later use
\def\:setrowhead{
\int_set:Nn \lTblrRowHeadInt
{ \__tblr_prop_item:ne { inner } { rowhead } + 0 }
}
% Get the value of xmcolhead key and save it in the \lTblrxmColHeadInt for later use and \lTblrxmColDiffInt is the difference in location
% between the column header and the actual column
\def\:setcellinfo{
\int_set:Nn \lTblrxmColHeadInt
{ \__tblr_prop_item:ne { inner } { xmcolhead } + 0 }
\int_set:Nn \lTblrxmColDiffInt
{ \HCol - \lTblrxmColHeadInt }
\int_set:Nn \lTblrxmRowDiffInt
{ \HRow - \lTblrRowHeadInt }
%\prop_get_to_int:NnN \l__tblr_testing_prop { Y} \lTblrxmColGroupCheck
%\prop_get_to_int:NnN \l__tblr_colgrouptest_prop { first } \myInteger
%\xdef\output{\@arabic\lTblrxmColGroupCheck}
%\string_to_int_var:nN \lTblrxmColGroupCheck \myInteger
%\int_set:Nn \lTblrxmColGroupCheck {\prop_item:Ne \l__tblr_testing_prop {first} }
%\int_set:Nn \output_test{\@arabic\lTblrxmColGroupCheck}
}
% print either th with scope or td ...
\def\:testcell{
\ifnum\lTblrxmColDiffInt<1
\ifnum\lTblrxmRowDiffInt<1
td
\else
\ifnum\HRowspan>1
th \space scope="rowgroup"
\else
th \space scope="row"
\fi
\fi
\else
\ifnum\lTblrxmRowDiffInt<1
\ifnum\HMultispan>1
th \space scope="colgroup"
\else
th \space scope="col"
\fi
\else
td
\fi
\fi}
\ExplSyntaxOff
% this is the configuration for the tabularray package with the support for <th>
\catcode`\:=11
\makeatletter
\Configure{tabularray}{%
\ifvmode\IgnorePar\fi\EndP%
\gHAdvance\Next:TableNo by 1 \global\let\TableNo=\Next:TableNo%
\HCode{<table class="tabularray \@currenvir" id="tbl-\TableNo">}
}{\ifvmode\IgnorePar\fi\EndP\HCode{</table>}}
{\:setrowhead\HCode{<tr id="row-\TableNo-\HRow-">}}{\HCode{</tr>}}
{\:setcellinfo\HCode{<\:testcell\space\:colgroupcheck \:testcheck colspan="\HMultispan" rowspan="\HRowspan" id="cell\TableNo-\HRow-\HCol" style="\CellStyle" \CellAttributes>}}{\HCode{</\:testcell>}}
%{\Configure{tabularrayattributes}{rowspan="\lTblrCellRowSpanInt"}}
%the line below cannot be deleted
{\Configure{tabularrayattributes}{}}{}
\catcode`\:=12
\makeatother
\NoFonts
\Configure{@HEAD}{\HCode{<meta name="ximera" content="version 2.5.1" />\Hnewline}}
\Configure{@HEAD}{\HCode{<link href="https://ximera.osu.edu/public/stylesheets/standalone.css" rel="stylesheet" media="screen"/>\Hnewline}}
\Configure{@HEAD}{\HCode{<script type="text/javascript" async src="https://ximera.osu.edu/public/javascripts/standalone.min.js"></script>\Hnewline}}
\catcode`\%=11
\Configure{@BODY}{\HCode{<style>
.activity-body pre {
white-space: pre;
background-color: lightgray;
}
.xmyoutube {
aspect-ratio: 16/9;
min-width: 75%;
}
.image-environment img {
width: unset;
}
</style>\Hnewline}}
\catcode`\%=14
\Configure{BVerbatimInput}{}{}{}{}
\Configure{verbatiminput}{}{}{}{}
\makeatletter
\def\FV@Space{\space}
\makeatother
\Configure{BODY}{%
\HCode{<body>\Hnewline}%
\Tg<div class="preamble">%
%% 202501: removed .jax inclusion (see luaxake)
%% Include the .ids file
\IfFileExists{\jobname.ids}{\HCode{<script type="text/javascript">\Hnewline}%
\BVerbatimInput{\jobname.ids}%
\HCode{</script>\Hnewline}%
}{}
\Tg</div>%
}{%
\ifvmode\IgnorePar\fi\EndP\HCode{</body>\Hnewline}%
}
\ScriptEnv{matlabEquation}{\ifvmode \IgnorePar\fi \EndP\HCode{<script type="math/tex; mode=display"> \string\begin{equation}\Hnewline}\HtmlParOff}{\HtmlParOn\HCode{\string\end{equation}</script>}}
\makeatletter
\newwrite\xmcss@out
\immediate\openout\xmcss@out=\jobname.xmcss
\def\xmCSS{\begingroup\catcode`\%=12 \xmcss@grab}
\long\def\xmcss@grab#1{%
\begingroup
\immediate\write\xmcss@out{#1}%
\endgroup
\endgroup
}
\newcount\mini@count
\ExplSyntaxOn
\let\oldiimini\@iiiminipage
\def\@iiiminipage#1#2[#3]#4{%
% calculate minipage dimensions and save it to the CSS file
\xmCSS{\#minipage\the\mini@count{width:\fp_eval:n{#4/\textwidth*100}\%;}}%
\global\advance\mini@count by 1\relax%
\oldiimini{#1}{#2}[#3]{#4}%
}
\ExplSyntaxOff
%% Should be in image.dtx !!
%%%\ConfigureEnv{image}{%
%%% \ifvmode \IgnorePar\fi \EndP%
%%% \HCode{<div class="image-environment" role="img" aria-labelledby="image-alt-\arabic{imagealt}">}%
%%%}{\HCode{</div>}}{}{}
\ConfigureEnv{minipage}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="minipage" id="minipage\the\mini@count">}}
{\ifvmode\IgnorePar\fi\EndP\HCode{</div>\Hnewline}%
}{}{}
\makeatother
\Css{div.minipage {
float: left;
}
}
\Css{div.minipage:last-child {
clear: none;
float: right;
}
}
\Css{ div.minipage + :not(.minipage) {clear:both;overflow:auto;width:100\%;}}
\renewcommand{\paragraph}[1]{%
\HCode{<span class="paragraphHead">}%
#1%
\HCode{</span>}\par\IgnorePar}
\renewcommand{\subparagraph}[1]{%
\HCode{<span class="subparagraphHead">}%
#1%
\HCode{</span>}\par\IgnorePar}
\catcode`\:=11
\ConfigureEnv{thebibliography}{\ifvmode\IgnorePar\fi \EndP \HCode{<section role="doc-bibliography" class="thebibliography">}}{\ifvmode\IgnorePar\fi \EndP \HCode{</section>}}{}{}
\ConfigureList{thebibliography}%
{\ifvmode\IgnorePar\fi\EndP\HCode{<dl><dt>}\let\en:bib=\empty}% opening tags
{\ifvmode\IgnorePar\fi\EndP\HCode{</dd></dl>}} % closing tags
{\en:bib\def\en:bib{\ifvmode\IgnorePar\fi\HCode{</dd><dt>}}}% at the bibitem
{\HCode{</dt><dd>}}% after biblabel
\catcode`\:=12
\Css{.thebibliography dl {
display: grid;
grid-auto-columns: min-content 1fr;
grid-auto-flow: column;
}}
\Css{.thebibliography dt {
grid-column: 1;
margin-bottom: 0.5em;
}}
\catcode`\:=11
\ConfigureList{enumerate}%
{\EndP\HCode{<ol \a:enumerate:\space
class="enumerate\expandafter\the\csname @enumdepth\endcsname"
\a:LRdir
>}\PushMacro\end:itm
\global\let\end:itm=\empty
}
{\PopMacro\end:itm \global\let\end:itm \end:itm
\EndP\HCode{</li></ol>}\ShowPar
}
{\end:itm \gdef\end:itm{\EndP\Tg</li>}\DeleteMark
}
{{\Configure{Link}{li}{}{ class="enumerate" id=}{}%
\let\EndLink=\empty\par\ShowPar
\AnchorLabel }%
}
\catcode`\:=12
\ifvmode\IgnorePar\fi\EndP
\ConfigureEnv{abstract}{\ifvmode\IgnorePar\fi\EndP\HCode{\Hnewline<div class="abstract">}\par}{\ifvmode\IgnorePar\fi\EndP\HCode{\Hnewline</div>}\par}{}{}
%% Although we accept many formats, SVG is preferred on the web.
%% Since we have a different mechanism for producing |alt| text, we
%% want to ignore tex4ht's own method fo producing alt text.
%% 2024: is now in TeX4ht ...
\ifcsname ifstandalone\endcsname
\ifstandalone
\renewcommand\includegraphics[2][]{}
\fi
\renewcommand{\outcome}[1]{
\Configure{@HEAD}{\HCode{<meta name="learning-outcome" content="#1"/>\Hnewline}}
}
\IfFileExists{\jobname.oc}{\input{\jobname.oc}}{}
\renewcommand{\outcome}[1]{%
\HCode{<span class="learning-outcome">#1</span>}
}
\makeatletter
\Configure{textcolor}{\HCode{<span style="color:\#\tsf@color;">}}{\HCode{</span>}}
\let\oldtextcolor\textcolor
\renewcommand\textcolor[2]{%
% we need to convert the current color to hexadecimal form usable in the style attribute
% the \tsf@color macro is used in the \Configure{textcolor} configuration to insert the
% CSS color
\extractcolorspec{#1}{\tsf@color}%
\expandafter\convertcolorspec\tsf@color{HTML}\tsf@color%
% call the original command
\oldtextcolor{#1}{#2}%
}%
\makeatother
\renewenvironment{javascriptCode}{\NoFonts}{\EndNoFonts}
\ScriptEnv{javascriptCode}{\stepcounter{identification}\ifvmode \IgnorePar\fi \EndP\HCode{<div class="javascript-code" id="javascript\arabic{identification}"><script type="text/text">}\HtmlParOff}{\HtmlParOn\HCode{\Hnewline</script></div>}}
%%% On the web, translate verbatim and lstlisting blocks into |<pre>|
%%% elements.
%%% \begin{macrocode}
%%%<*cfgXimera>
%%\ConfigureEnv{verbatim}{\ifvmode\IgnorePar\fi\EndP\HCode{<pre style="white-space: pre; background-color: lightgray;" >}}{\ifvmode\IgnorePar\fi\EndP\HCode{</pre>}}{}{}
%%\ConfigureEnv{lstlisting}{\ifvmode\IgnorePar\fi\EndP\HCode{<pre>}}{\ifvmode\IgnorePar\fi\EndP\HCode{</pre>}}{}{}
%%%</cfgXimera>
%%% \end{macrocode}
\Configure{textbf}{\ifvmode\ShowPar\fi\HCode{<strong>}}{\HCode{</strong>}}
\Configure{textit}{\ifvmode\ShowPar\fi\HCode{<em>}}{\HCode{</em>}}
\Configure{emph}{\ifvmode\ShowPar\fi\HCode{<em>}}{\HCode{</em>}}
\Configure{texttt}{\ifvmode\ShowPar\fi\HCode{<code>}}{\HCode{</code>}}
\begin{document}
\EndPreamble
%%
%% Copyright (C) 2024 by Bart Snapp <bart.snapp@gmail.com> and Jim Fowler <kisonecat@gmail.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
%% version 1.3c of this license or (at your option) any later
%% version. The latest version of this license is in the file:
%%
%% http://www.latex-project.org/lppl.txt
%%
%% This work is "maintained" (as per LPPL maintenance status) by
%% Bart Snapp. The source code can be found at:
%%
%% https://github.com/XimeraProject/ximeraLatex
%%
%% This work consists of the file ximera.dtx, the associated files
%% under src/, and a Makefile.
%%
%% Running "make" generates the derived files README, ximera.pdf, ximera.cls, xourse.cls.
%%
%% Running "make inst" installs the files in the user's TeX tree.
%%
%% Running "make install" installs the files in the local TeX tree.
%%
%%
%% End of file `ximera.cfg'.