fchauvel / flap

Flattening LaTeX projects
https://fchauvel.github.io/flap
GNU General Public License v3.0
17 stars 2 forks source link

Maximum recursion depth exceeded #32

Open Shaunakde opened 6 years ago

Shaunakde commented 6 years ago

I am using flap to flatten a fairly standard journal file. When I run the command flap source.tex out.tex I get the following error:

 File "/home/shaunak/anaconda/envs/Python3x/lib/python3.6/site-packages/flap/latex/parser.py", line 153, in _evaluate_until
    tokens += self._evaluate_one()
  File "/home/shaunak/anaconda/envs/Python3x/lib/python3.6/site-packages/flap/latex/parser.py", line 138, in _evaluate_one
    return self.evaluate_command(str(self._next_token))
  File "/home/shaunak/anaconda/envs/Python3x/lib/python3.6/site-packages/flap/latex/parser.py", line 164, in evaluate_command
    return macro.invoke(self)
  File "/home/shaunak/anaconda/envs/Python3x/lib/python3.6/site-packages/flap/latex/macros.py", line 124, in invoke
    return self._execute(parser, invocation)
  File "/home/shaunak/anaconda/envs/Python3x/lib/python3.6/site-packages/flap/latex/macros.py", line 150, in _execute
    return parser._spawn(self._body, invocation.arguments)._evaluate_group()
  File "/home/shaunak/anaconda/envs/Python3x/lib/python3.6/site-packages/flap/latex/parser.py", line 146, in _evaluate_group
    tokens = self._evaluate_until(lambda token: token.ends_a_group)
  File "/home/shaunak/anaconda/envs/Python3x/lib/python3.6/site-packages/flap/latex/parser.py", line 153, in _evaluate_until
    tokens += self._evaluate_one()
  File "/home/shaunak/anaconda/envs/Python3x/lib/python3.6/site-packages/flap/latex/parser.py", line 138, in _evaluate_one
    return self.evaluate_command(str(self._next_token))
  File "/home/shaunak/anaconda/envs/Python3x/lib/python3.6/site-packages/flap/latex/parser.py", line 161, in evaluate_command
    if command not in self._definitions:
  File "/home/shaunak/anaconda/envs/Python3x/lib/python3.6/site-packages/flap/latex/parser.py", line 43, in __contains__
    return key in self._definitions or (self._parent and key in self._parent)
  File "/home/shaunak/anaconda/envs/Python3x/lib/python3.6/site-packages/flap/latex/parser.py", line 43, in __contains__
    return key in self._definitions or (self._parent and key in self._parent)
  File "/home/shaunak/anaconda/envs/Python3x/lib/python3.6/site-packages/flap/latex/parser.py", line 43, in __contains__
    return key in self._definitions or (self._parent and key in self._parent)
  [Previous line repeated 77 more times]
RecursionError: maximum recursion depth exceeded

My python version is:

Python 3.6.2 |Continuum Analytics, Inc.| (default, Jul 20 2017, 13:51:32) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux

I have attached the directory structure of the project to this issue. The main file is called 0_Trento_2016.tex. There are image files in the Figures folder.

TREE.txt

Shaunakde commented 6 years ago

I ran the PERL script mkjobtexmf --jobname 0_Trento_2016 --cmd-tex pdflatex to make a list of dependent files. The output log file is attached. Hopefully, that will help investigate the issue.

SD_2017.txt

fchauvel commented 6 years ago

At first glance, I think there is an issue with the definition of some of macros.

Would you be willing to disclose the macros you defined and the list of LaTeX packages you use. These will help me spot the TeX construct which Flaps fail to parse properly.

On Tue, Sep 12, 2017 at 9:14 AM, Shaunak De notifications@github.com wrote:

I tan the PERL script `mkjobtexmf --jobname 0_Trento_2016 --cmd-tex pdflatex' to make a list of dependent files. The output log file is attached. Hopefully, that will help solve the issue.

SD_2017.txt https://github.com/fchauvel/flap/files/1295023/SD_2017.txt

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fchauvel/flap/issues/32#issuecomment-328761607, or mute the thread https://github.com/notifications/unsubscribe-auth/AA74eDv6ry_A7KHbj1KBU14h1kBp37bKks5shi9jgaJpZM4PUMjP .

Shaunakde commented 6 years ago

Of course, I would be happy to send you the source files by WeTransfer. (May I have your email id? Mine is shaunakde at gmail)

On Tue, Sep 12, 2017 at 1:17 PM, Franck Chauvel notifications@github.com wrote:

At first glance, I think there is an issue with the definition of some of macros.

Would you be willing to disclose the macros you defined and the list of LaTeX packages you use. These will help me spot the TeX construct which Flaps fail to parse properly.

On Tue, Sep 12, 2017 at 9:14 AM, Shaunak De notifications@github.com wrote:

I tan the PERL script `mkjobtexmf --jobname 0_Trento_2016 --cmd-tex pdflatex' to make a list of dependent files. The output log file is attached. Hopefully, that will help solve the issue.

SD_2017.txt https://github.com/fchauvel/flap/files/1295023/SD_2017.txt

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fchauvel/flap/issues/32#issuecomment-328761607, or mute the thread https://github.com/notifications/unsubscribe-auth/AA74eDv6ry_ A7KHbj1KBU14h1kBp37bKks5shi9jgaJpZM4PUMjP .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fchauvel/flap/issues/32#issuecomment-328770010, or mute the thread https://github.com/notifications/unsubscribe-auth/ACbV6QWFDjffITOtTwzwODWlU18b1aaNks5shjcngaJpZM4PUMjP .

-- Shaunak De http://shaunak.de/

fchauvel commented 6 years ago

Thanks a lot. My email is franck [dot] chauvel [at] gmail [dot] com.

Thanks aslo for the feedback, it highly appreciated :-)

On Tue, Sep 12, 2017 at 10:07 AM, Shaunak De notifications@github.com wrote:

Of course, I would be happy to send you the source files by WeTransfer. (May I have your email id? Mine is shaunakde at gmail)

On Tue, Sep 12, 2017 at 1:17 PM, Franck Chauvel notifications@github.com wrote:

At first glance, I think there is an issue with the definition of some of macros.

Would you be willing to disclose the macros you defined and the list of LaTeX packages you use. These will help me spot the TeX construct which Flaps fail to parse properly.

On Tue, Sep 12, 2017 at 9:14 AM, Shaunak De notifications@github.com wrote:

I tan the PERL script `mkjobtexmf --jobname 0_Trento_2016 --cmd-tex pdflatex' to make a list of dependent files. The output log file is attached. Hopefully, that will help solve the issue.

SD_2017.txt https://github.com/fchauvel/ flap/files/1295023/SD_2017.txt

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fchauvel/flap/issues/32#issuecomment-328761607, or mute the thread https://github.com/notifications/unsubscribe-auth/AA74eDv6ry_ A7KHbj1KBU14h1kBp37bKks5shi9jgaJpZM4PUMjP .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fchauvel/flap/issues/32#issuecomment-328770010, or mute the thread https://github.com/notifications/unsubscribe-auth/ ACbV6QWFDjffITOtTwzwODWlU18b1aaNks5shjcngaJpZM4PUMjP .

-- Shaunak De http://shaunak.de/

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fchauvel/flap/issues/32#issuecomment-328775254, or mute the thread https://github.com/notifications/unsubscribe-auth/AA74eLM25TWCC104iv9LJAwym9t3ENFWks5shjvEgaJpZM4PUMjP .

Shaunakde commented 6 years ago

I have sent you the files after stripping the figures etc. that were not relevant to the document. I will also try to debug and diagnose the issue and keep you updated :)

On Tue, Sep 12, 2017 at 2:18 PM, Franck Chauvel notifications@github.com wrote:

Thanks a lot. My email is franck [dot] chauvel [at] gmail [dot] com.

Thanks aslo for the feedback, it highly appreciated :-)

On Tue, Sep 12, 2017 at 10:07 AM, Shaunak De notifications@github.com

wrote:

Of course, I would be happy to send you the source files by WeTransfer. (May I have your email id? Mine is shaunakde at gmail)

On Tue, Sep 12, 2017 at 1:17 PM, Franck Chauvel < notifications@github.com> wrote:

At first glance, I think there is an issue with the definition of some of macros.

Would you be willing to disclose the macros you defined and the list of LaTeX packages you use. These will help me spot the TeX construct which Flaps fail to parse properly.

On Tue, Sep 12, 2017 at 9:14 AM, Shaunak De notifications@github.com wrote:

I tan the PERL script `mkjobtexmf --jobname 0_Trento_2016 --cmd-tex pdflatex' to make a list of dependent files. The output log file is attached. Hopefully, that will help solve the issue.

SD_2017.txt https://github.com/fchauvel/ flap/files/1295023/SD_2017.txt

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fchauvel/flap/issues/32#issuecomment-328761607, or mute the thread https://github.com/notifications/unsubscribe-auth/AA74eDv6ry_ A7KHbj1KBU14h1kBp37bKks5shi9jgaJpZM4PUMjP .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fchauvel/flap/issues/32#issuecomment-328770010, or mute the thread https://github.com/notifications/unsubscribe-auth/ ACbV6QWFDjffITOtTwzwODWlU18b1aaNks5shjcngaJpZM4PUMjP .

-- Shaunak De http://shaunak.de/

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fchauvel/flap/issues/32#issuecomment-328775254, or mute the thread https://github.com/notifications/unsubscribe-auth/ AA74eLM25TWCC104iv9LJAwym9t3ENFWks5shjvEgaJpZM4PUMjP

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fchauvel/flap/issues/32#issuecomment-328786507, or mute the thread https://github.com/notifications/unsubscribe-auth/ACbV6VtbEqQygyzxOlXzyB83qambdlkDks5shkVrgaJpZM4PUMjP .

-- Shaunak De http://shaunak.de/

fchauvel commented 6 years ago

I am able to reproduce the error you get: FLaP fails because it tries to parse the IEEETrans.cls. There are probably bugs in the way FLaP handles commands/macros that themselves contain \input and other inclusions directives. Class definitions contain many ;-).

I suggest to add a flag on the command line to deactivate such the rewriting of macros. Let see if solve your issue.

I will keep you updated of any progress.

MartinHjelm commented 5 years ago

I circumvented this by switching to another cls and then switching back once the merge was done.