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

TypeError: 'NoneType' object is not subscriptable #5

Open
alanzchen opened this issue Mar 26, 2021 · 2 comments
Open

TypeError: 'NoneType' object is not subscriptable #5

alanzchen opened this issue Mar 26, 2021 · 2 comments

Comments

@alanzchen
Copy link

alanzchen commented Mar 26, 2021

Got the following error when running:

pandoc -f markdown+smart+fenced_divs --lua-filter=texclass.lua --standalone -F pandoc-theoremnos -F pandoc-crossref --citeproc --number-sections --output=output/test.pdf test.md
Traceback (most recent call last):
  File "/usr/local/bin/pandoc-theoremnos", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/pandoc_theoremnos.py", line 488, in main
    altered = functools.reduce(lambda x, action: walk(x, action, fmt, meta),
  File "/usr/local/lib/python3.8/dist-packages/pandoc_theoremnos.py", line 488, in <lambda>
    altered = functools.reduce(lambda x, action: walk(x, action, fmt, meta),
  File "/usr/local/lib/python3.8/dist-packages/pandocfilters.py", line 110, in walk
    res = action(item['t'],
  File "/usr/local/lib/python3.8/dist-packages/pandocxnos/core.py", line 856, in process_refs
    _process_refs(value[-5], pattern, labels)
  File "/usr/local/lib/python3.8/dist-packages/pandocxnos/core.py", line 92, in wrapper
    ret = func(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/pandocxnos/core.py", line 758, in _process_refs
    if v['t'] == 'Cite' and len(v['c']) == 2:
TypeError: 'NoneType' object is not subscriptable

re.compile('(asum|prop|lemma):[\\w/-]*')
Error running filter pandoc-theoremnos:
Filter returned error status 1

My example markdown is as follows:

---
title: "ABC"
author: "XYZ"
date: \today
geometry: margin=1in
fontsize: 12pt
fontfamily: times
link-citations: true
abstract: "Example."

header-includes:
    - \usepackage{setspace}
    - \doublespacing
    - \usepackage{floatpag}
	- \usepackage{cleveref}
    - \usepackage[utf8]{inputenc}
    - \floatpagestyle{empty}
    - \usepackage[small,compact]{titlesec}
theoremnos-cleveref: True
theoremnos-names:
    - id: asum
      name: Assumption
    - id: prop
      name: Proposition
    - id: lemma
      name: Lemma
---

a   b   c
--- --- ---
1   2   3
4   5   6

: Caption {#tbl:label}

[My Theorem]{#lemma:id}
: This is my theorem.

[123]{#lemma:n-derivative}
: In equilibrium, $n^*$ can be expressed as:

$$
n^*=\frac{b-\frac{4 (\beta  D_H+(1-\beta)D_L)^2}{(\beta D_H^2+(1-\beta)D_L^2)+4/q}}{2 t}
$$


@lemma:n-derivative

@tbl:label

@lemma:id

The problem is with the table reference. That seems to be the one that is conflicting with this filter. Removing the table will resolve the issue, but it is currently the only way to reference a table AFAIK: http://lierdakil.github.io/pandoc-crossref/#table-labels

@alanzchen
Copy link
Author

Another test markdown that fails:

---
theoremnos-cleveref: True
theoremnos-names:
    - id: asum
      name: Assumption
    - id: prop
      name: Proposition
    - id: lemma
      name: Lemma
---


@tbl:terms

| A                 | B        | C                                                  |
| ---------------------- | ------------- | ------------------------------------------------------------ |
| D                    | $(0,\infty)$  | F                       |


Table: Terminology Table {#tbl:terms}

@tbl:terms
pandoc -f markdown+smart+fenced_divs --standalone -F pandoc-theoremnos -F pandoc-crossref --citeproc --number-sections --output=test.pdf test.md

@alanzchen
Copy link
Author

Ahhh, never mind, just read the fine print that the latest pandoc is not supported.

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

1 participant