Skip to content

newcommand gamma weirdness #130

@ricopicone

Description

@ricopicone

Using the newcommands_keep.tex feature to define the command

\newcommand{\gammar}{\gamma{}}

gives a strange error when using the following.

doconce format ipynb index  --no_abort

It returns the following.

running preprocess -DFORMAT=ipynb -DDEVICE=screen  index.do.txt > tmp_preprocess__index.do.txt
translating doconce text in tmp_preprocess__index.do.txt to ipynb
Traceback (most recent call last):
  File "/usr/local/bin/doconce", line 1721, in <module>
    bg_session = main()
  File "/usr/local/bin/doconce", line 1710, in main
    retval = eval(command + '()')
  File "<string>", line 1, in <module>
  File "/usr/local/bin/doconce", line 103, in format
    bg_session = doconce.doconce.format_driver()
  File "/usr/local/lib/python2.7/site-packages/doconce/doconce.py", line 5470, in format_driver
    out_filename, bg_session = file2file(filename_preprocessed, format, basename)
  File "/usr/local/lib/python2.7/site-packages/doconce/doconce.py", line 4285, in file2file
    filestr, bg_session = doconce2format(filestr, format)
  File "/usr/local/lib/python2.7/site-packages/doconce/doconce.py", line 4589, in doconce2format
    filestr = expand_newcommands(newcommand_files, filestr) # inline math
  File "/usr/local/lib/python2.7/site-packages/doconce/expand_newcommands.py", line 126, in expand_newcommands
    return substitute(source, newcommands)
  File "/usr/local/lib/python2.7/site-packages/doconce/expand_newcommands.py", line 96, in substitute
    text, n = re.subn(pattern, replacement, text)
  File "/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 166, in subn
    return _compile(pattern, flags).subn(repl, string, count)
  File "/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 286, in _subx
    template = _compile_repl(template, pattern)
  File "/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 273, in _compile_repl
    raise error, v # invalid expression
sre_constants.error: missing group name

It only seems to have this problem when using \gamma in a \newcommand. I've tried placing it in extra braces {}, but it doesn't help. Again, all other Greek symbols seem to be fine.

I think it's a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions