Handle missing verbatim arguments and empty LaTeX matrices
This commit is contained in:
parent
bc25eeb06a
commit
3dfaed5041
2 changed files with 20 additions and 6 deletions
|
|
@ -386,7 +386,7 @@ def fmt_matrix_environment_node(node, l2tobj):
|
|||
state.new_row() # finish the last row
|
||||
|
||||
# now format the contents as array --
|
||||
max_char_width = max((len(x) for row in state.matrix_rows for x in row))
|
||||
max_char_width = max((len(x) for row in state.matrix_rows for x in row), default=0)
|
||||
matrix_contents = "; ".join(
|
||||
(
|
||||
" ".join((x.rjust(max_char_width, " ") for x in row))
|
||||
|
|
|
|||
|
|
@ -460,12 +460,12 @@ class VerbatimArgsParser(MacroStandardArgsParser):
|
|||
if self.verbatim_arg_type == "verb-macro":
|
||||
# read the next nonwhitespace char. This is the delimiter of the
|
||||
# argument
|
||||
while w.s[pos].isspace():
|
||||
while pos < len(w.s) and w.s[pos].isspace():
|
||||
pos += 1
|
||||
if pos >= len(w.s):
|
||||
raise latexwalker.LatexWalkerParseError(
|
||||
s=w.s, pos=pos, msg=r"Missing argument to \verb command"
|
||||
)
|
||||
if pos >= len(w.s):
|
||||
raise latexwalker.LatexWalkerParseError(
|
||||
s=w.s, pos=pos, msg=r"Missing argument to \verb command"
|
||||
)
|
||||
verbdelimchar = w.s[pos]
|
||||
beginpos = pos + 1
|
||||
endpos = w.s.find(verbdelimchar, beginpos)
|
||||
|
|
|
|||
Loading…
Reference in a new issue