Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: list index out of range #99

Open
turian opened this issue Jul 27, 2023 · 2 comments
Open

IndexError: list index out of range #99

turian opened this issue Jul 27, 2023 · 2 comments

Comments

@turian
Copy link

turian commented Jul 27, 2023

I found some hideous latex unfortunately.

 % latex2text index.html.pd.tex
Traceback (most recent call last):
  File "/opt/homebrew/anaconda3/bin/latex2text", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/anaconda3/lib/python3.11/site-packages/pylatexenc/latex2text/__main__.py", line 214, in main
    print(ln2t.nodelist_to_text(nodelist), **print_kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/lib/python3.11/site-packages/pylatexenc/latex2text/__init__.py", line 1056, in nodelist_to_text
    s += self.node_to_text(node, textcol=textcol)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/lib/python3.11/site-packages/pylatexenc/latex2text/__init__.py", line 1089, in node_to_text
    return self.environment_node_to_text(node)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/lib/python3.11/site-packages/pylatexenc/latex2text/__init__.py", line 1207, in environment_node_to_text
    return self.nodelist_to_text(node.nodelist)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/lib/python3.11/site-packages/pylatexenc/latex2text/__init__.py", line 1056, in nodelist_to_text
    s += self.node_to_text(node, textcol=textcol)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/lib/python3.11/site-packages/pylatexenc/latex2text/__init__.py", line 1086, in node_to_text
    return self.macro_node_to_text(node)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/lib/python3.11/site-packages/pylatexenc/latex2text/__init__.py", line 1185, in macro_node_to_text
    macrostr = get_macro_str_repl(node, macroname, mac)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/lib/python3.11/site-packages/pylatexenc/latex2text/__init__.py", line 1176, in get_macro_str_repl
    return self.apply_simplify_repl(node, mac.simplify_repl,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/lib/python3.11/site-packages/pylatexenc/latex2text/__init__.py", line 1346, in apply_simplify_repl
    r = simplify_repl(node, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/lib/python3.11/site-packages/pylatexenc/latex2text/_defaultspecs.py", line 194, in <lambda>
    '{} <{}>'.format(l2tobj.nodelist_to_text([n.nodeargd.argnlist[1]]),
                                              ~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
(base)
(base) joseph@JosephsacStudio arxiv-vanity % latex2text --version
pylatexenc 3.0alpha000018
@turian
Copy link
Author

turian commented Jul 27, 2023

You can try yourself with this gnarly latex:

wget https://gist.githubusercontent.com/turian/17f006e25e0b5d6ea2adce7ac90c889f/raw/24704ef27fdf8b4361647d08f50d86d0d2fae0f2/gistfile1.txt
latex2text gistfile1.txt

@user202729
Copy link

Duplicate of #58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants