Adapt phantom patches for pdfTeX
This commit is contained in:
parent
5252cbc90d
commit
235815eb98
@ -1,33 +0,0 @@
|
|||||||
local properties = node.get_properties_table()
|
|
||||||
local if_vertical = token.create'ifv@'
|
|
||||||
local if_horizontal = token.create'ifh@'
|
|
||||||
local iftrue_index = token.create'iftrue'.index
|
|
||||||
|
|
||||||
local funcid = luatexbase.new_luafunction'__luamml_kernel_finalize_phantom:'
|
|
||||||
token.set_lua('__luamml_kernel_finalize_phantom:', funcid, 'protected')
|
|
||||||
lua.get_functions_table()[funcid] = function()
|
|
||||||
-- TODO: Error handling etc
|
|
||||||
-- At this point, box 0 contains the inner expression and the curent list ends with the noad whose nucleus should get replaced
|
|
||||||
local boxnum = 0
|
|
||||||
local startmath = tex.box[boxnum].list
|
|
||||||
assert(startmath.id == node.id"math")
|
|
||||||
local nucl = assert(tex.nest.top.tail.nucleus)
|
|
||||||
local props = properties[nucl]
|
|
||||||
if not props then -- very likely
|
|
||||||
props = {}
|
|
||||||
properties[nucl] = props
|
|
||||||
end
|
|
||||||
assert(not props.mathml_table)
|
|
||||||
local saved_props = assert(properties[startmath])
|
|
||||||
local saved_core = saved_props.saved_mathml_core
|
|
||||||
local saved = assert(saved_props.saved_mathml_table or saved_core)
|
|
||||||
-- The following could be optimized for the case that both if_vertical and if_horizontal
|
|
||||||
-- are set, but that should't happen ayway and is just supported for consistency.
|
|
||||||
if if_vertical.index ~= iftrue_index then
|
|
||||||
saved = {[0] = 'mpadded', height = 0, depth = 0, saved}
|
|
||||||
end
|
|
||||||
if if_horizontal.index ~= iftrue_index then
|
|
||||||
saved = {[0] = 'mpadded', width = 0, saved}
|
|
||||||
end
|
|
||||||
props.mathml_table, props.mathml_core = saved, saved_core
|
|
||||||
end
|
|
@ -1,17 +1,35 @@
|
|||||||
\ProvidesExplPackage {luamml-patches-kernel} {2021-05-30} {0.0.1-alpha}
|
\ProvidesExplPackage {luamml-patches-kernel} {2021-05-30} {0.0.1-alpha}
|
||||||
{Feel free to add a description here}
|
{Feel free to add a description here}
|
||||||
|
|
||||||
\lua_now:n { require'luamml-kernel' }
|
\cs_new:Npn \__luamml_kernel_phantom:nnn #1#2#3 {
|
||||||
|
|
||||||
\cs_set:Npn \mathph@nt #1 #2 {
|
|
||||||
\hbox_set:Nn \c_zero_int {
|
\hbox_set:Nn \c_zero_int {
|
||||||
$
|
$
|
||||||
\m@th
|
\m@th
|
||||||
#1
|
#2
|
||||||
{#2}
|
{#3}
|
||||||
\luamml_flag_save:nNn {} #1 {mphantom}
|
\luamml_flag_save:nNn {mathphant_#1} #2 {mphantom}
|
||||||
|
\luamml_pdf_write:
|
||||||
$
|
$
|
||||||
}
|
}
|
||||||
\finph@nt
|
\luamml_annotate:nen {1} {
|
||||||
\__luamml_kernel_finalize_phantom:
|
nucleus = true,
|
||||||
|
core = {[0] = 'mpadded',
|
||||||
|
\ifh@\else
|
||||||
|
width = 0,
|
||||||
|
\fi
|
||||||
|
\ifv@\else
|
||||||
|
height = 0, depth = 0,
|
||||||
|
\fi
|
||||||
|
data.mathml.mathphant_#1,
|
||||||
|
}
|
||||||
|
} {
|
||||||
|
\finph@nt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\cs_generate_variant:Nn \__luamml_kernel_phantom:nnn {V}
|
||||||
|
|
||||||
|
\int_new:N \g__luamml_kernel_phantom_int
|
||||||
|
\cs_set:Npn \mathph@nt {
|
||||||
|
\int_gincr:N \g__luamml_kernel_phantom_int
|
||||||
|
\__luamml_kernel_phantom:Vnn \g__luamml_kernel_phantom_int
|
||||||
}
|
}
|
||||||
|
@ -439,10 +439,11 @@
|
|||||||
% \end{macrocode}
|
% \end{macrocode}
|
||||||
% \end{macro}
|
% \end{macro}
|
||||||
%
|
%
|
||||||
%
|
% We currently provide minimal patching for the kernel, \pkg{amsmath} and \pkg{array}.
|
||||||
|
% Currently only the kernel code supports pdf\TeX, but it's planned to extend this.
|
||||||
% \begin{macrocode}
|
% \begin{macrocode}
|
||||||
%<*luatex>
|
|
||||||
\RequirePackage { luamml-patches-kernel }
|
\RequirePackage { luamml-patches-kernel }
|
||||||
|
%<*luatex>
|
||||||
\__luamml_patch_package:n {amsmath}
|
\__luamml_patch_package:n {amsmath}
|
||||||
\__luamml_patch_package:n {array}
|
\__luamml_patch_package:n {array}
|
||||||
%</luatex>
|
%</luatex>
|
||||||
|
Loading…
Reference in New Issue
Block a user