You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Working on the function that you proposed on #48, I came across a strange behavior: sometimes the len returned by the get_latex_nodes function is not the same as the len of the parsed node.
In the MWE below, the first node is a MacroNode and the pos and len reported by the function are the same as the attributes of the node itself, but for the second node (a CharsNode, the newline char), the function reports a len different from that of the node.
importpylatexenc.latexwalkerdoc_content=r"""\emph{A}\emph{B}"""print(f"DOC: {doc_content}")
lw=pylatexenc.latexwalker.LatexWalker(
doc_content,
tolerant_parsing=False,
)
pos=0
(tmp_list, npos, nlen) =lw.get_latex_nodes(pos, read_max_nodes=1)
node=tmp_list[0]
print(f"Node at pos {pos}: node len {node.len} == returned len {nlen}; OK")
pos=8
(tmp_list, npos, nlen) =lw.get_latex_nodes(pos, read_max_nodes=1)
node=tmp_list[0]
print(f"Node at pos {pos}: node len {node.len} != returned len {nlen}; BAD")
By the way, with some minor tweaks, the function you proposed in #48 works well, thanks again 👍
The text was updated successfully, but these errors were encountered:
Working on the function that you proposed on #48, I came across a strange behavior: sometimes the
len
returned by theget_latex_nodes
function is not the same as thelen
of the parsed node.In the MWE below, the first node is a MacroNode and the
pos
andlen
reported by the function are the same as the attributes of the node itself, but for the second node (a CharsNode, the newline char), the function reports alen
different from that of the node.By the way, with some minor tweaks, the function you proposed in #48 works well, thanks again 👍
The text was updated successfully, but these errors were encountered: