diff --git a/luamml-patches-kernel.sty b/luamml-patches-kernel.sty index e150a33..e03a991 100644 --- a/luamml-patches-kernel.sty +++ b/luamml-patches-kernel.sty @@ -33,3 +33,27 @@ \int_gincr:N \g__luamml_kernel_phantom_int \__luamml_kernel_phantom:Vnn \g__luamml_kernel_phantom_int } + +\@ifpackageloaded {unicode-math} {} { + \cs_new:Npn \__luamml_kernel_define_character:Nnn #1#2#3 { + \cs_set:cpx { \cs_to_str:N #1 ~ } { + \luamml_annotate:nen {#2} { + nucleus = true, core = {[0] = 'mi', '\string\u{#3}'}, + } { + \exp_not:v { \cs_to_str:N #1 ~ } + } + } + } + + \__luamml_kernel_define_character:Nnn \models {3} {22a7} + \__luamml_kernel_define_character:Nnn \hookrightarrow {3} {21aa} + \__luamml_kernel_define_character:Nnn \hookleftarrow {3} {21a9} + \__luamml_kernel_define_character:Nnn \bowtie {3} {22c8} + \__luamml_kernel_define_character:Nnn \Longrightarrow {3} {27f9} + \__luamml_kernel_define_character:Nnn \longrightarrow {3} {27f6} + \__luamml_kernel_define_character:Nnn \Longleftarrow {3} {27f8} + \__luamml_kernel_define_character:Nnn \longleftarrow {3} {27f5} + \__luamml_kernel_define_character:Nnn \Longleftrightarrow {3} {27fa} + \__luamml_kernel_define_character:Nnn \longleftrightarrow {3} {27f7} + \__luamml_kernel_define_character:Nnn \longmapsto {4} {27fc} +} diff --git a/pdfmml-showlists.lua b/pdfmml-showlists.lua index 8d0a9dc..340c9f9 100644 --- a/pdfmml-showlists.lua +++ b/pdfmml-showlists.lua @@ -130,8 +130,15 @@ function parse_list(lines, i, prefix, parsed) local mark = mark_whatsit:match(line, #prefix+1) if mark then local mark_table = assert(load('return {' .. assert(parsed.marks[mark], 'Undefined mark encountered') .. '}', nil, 't', mark_environment))() - current_mark, current_count = mark_table, mark_table.count or 1 - current_offset = mark_table.offset or current_count + if current_mark then + if (mark_table.count or 1) > current_count then + error'Invalid mark nesting' + end + -- Ignore new mark if existing mark is evaluated. This should be replaced with proper nesting + else + current_mark, current_count = mark_table, mark_table.count or 1 + current_offset = mark_table.offset or current_count + end i = i + 1 else print(line, prefix, i)