Closed done-with-fish closed 5 years ago
Seems to make sense... Do you have an example showing what difference it does make?
You're right (I just never touched this part of sagetex, and there are no tests), thanks for pointing this out.
Seems to make sense... Do you have an example showing what difference it does make?
I had a big project where every individual tex compilation failed with
ignore = r"^( _st_.goboom|print('SageT| ?_st_.current_tex_line)"
My proposed change resulted in all but four of the files compiling correctly.
The older syntax
ignore = r"^( _st_.goboom|print 'SageT| ?_st_.current_tex_line)"
results in all of my files compiling correctly.
I'm sure there's a subtlety in the syntax but I'm not exactly sure what it is.
On Wed, 9 Jan 2019 02:37 Brian Fitzpatrick <notifications@github.com wrote:
I had a big project where every individual tex compilation failed with
ignore = r"^( st.goboom|print('SageT| ?st.current_tex_line)"
My proposed change resulted in all but four of the files compiling correctly.
The older syntax
ignore = r"^( st.goboom|print 'SageT| ?st.current_tex_line)"
results in all of my files compiling correctly.
I'm sure there's a subtlety in the syntax but I'm not exactly sure what it is.
That error was a bit of collateral damage from efforts to make Sagemath to work with Python 3, which does away with print statements.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/sagemath/sagetex/issues/19#issuecomment-452550688, or mute the thread https://github.com/notifications/unsubscribe-auth/ABN8HJkVidju-rNnrHbzXKArUMypS_D_ks5vBVYEgaJpZM4Z0RZg .
Would you mind testing https://trac.sagemath.org/ticket/27024 ?
Also, what is your sagetex setup? Specifically, how do you modify and use run-sagetex-if-necessary.py ? The latter would help us to test it better... Thanks in advance.
Would you mind testing https://trac.sagemath.org/ticket/27024 ?
Also, what is your sagetex setup? Specifically, how do you modify and use run-sagetex-if-necessary.py ? The latter would help us to test it better... Thanks in advance.
I use run-sagetex-if-necessary.py
in conjunction with latexmk
. My latexmkrc
is:
add_cus_dep( 'sage', 'sout', 0, 'makesout' );
$hash_calc_ignore_pattern{'sage'} = '^( _st_.goboom|print .SageT)';
sub makesout {
system( "sage \"$_[0].sage\"" );
}
$clean_ext = "bbl nav out snm sagetex.sage sagetex.sage.py scmd sagetex.sout sagetex.scmd";
$pdf_mode = 1;
$latex = "$latex ; python2 /usr/share/texmf/tex/latex/sagetex/run-sagetex-if-necessary.py %B";
$pdflatex = "$pdflatex ; python2 /usr/share/texmf/tex/latex/sagetex/run-sagetex-if-necessary.py %B";
I tried adjusting python2
to python3
, figuring that the new code was intended for an eventual switch to python3
, but the compilation still failed.
I haven't modified run-sagetex-if-necessary.py
.
You're right (I just never touched this part of sagetex, and there are no tests), thanks for pointing this out.
It looks like the commit correcting the parenthesis typo includes an indent that causes problems.
I asked a question about this on unix.stackexchange, and someone recommended trying
ignore = r"^( _st_.goboom|print ('SageT| ?_st_.current_tex_line))"
This ends up working for me. I'm not completely sure why adding a space after print
works, but it does.
The script still fails using python3
, but works with python2
.
On Thu, Jan 10, 2019 at 4:16 AM Brian Fitzpatrick notifications@github.com wrote:
I asked a question about this https://unix.stackexchange.com/questions/493579/why-might-re-search-process-these-patterns-differently on unix.stackexchange, and someone recommended trying
ignore = r"^( st.goboom|print ('SageT| ?st.current_tex_line))"
This ends up working for me. I'm not completely sure why adding a space after print works, but it does.
The script still fails using python3, but works with python2.
It probably fails with python3 due to incompatible Python code in your latexmkrc It should be something like this: (with extra pair of ())
$hash_calc_ignore_pattern{'sage'} = '^( _st_.goboom|print (.SageT))';
—
You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/sagemath/sagetex/issues/19#issuecomment-452965482, or mute the thread https://github.com/notifications/unsubscribe-auth/ABN8HG98CxRzAoeAr2d_vRi7_GqrAKa4ks5vBr62gaJpZM4Z0RZg .
In retrospect, @done-with-fish you were right about the indentation and we missed that comment, and the reason that it compiled correctly with the space was because the previous thing was looking for these print lines i.e. literal print 'SageT
for print statements, while inside the regex print('SageT<stuff>)
now looked differently for what was inside. See #33 for a correct diagnosis, probably better solution because it both works on py3 and fixes the underlying problem. Now that more people are using py3 we would have been seeing this failing, so thank you and again our apologies for not figuring out what was going on!
Happy this was cleared up! This script is part of my daily workflow and I'm glad it will survive the python3 switch.
Do try the new version please.
I've updated sagetex and am now having problems again.
without seeing the exact error messages it's hard to see what goes on.
Are you running Sage with Python3, or with Python2?
Also, did you update sagetex from within Sage (I don't think it has made the upgrade yet) or from here?
Line 75 of scripts.dtx is
ignore = r"^( _st_.goboom|print('SageT| ?_st_.current_tex_line)"
I think this line is missing a parenthesis and should be
ignore = r"^( _st_.goboom|print('SageT| ?_st_.current_tex_line))"