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

silent sage command that works in math environments for assignment #10

Open
sharpTrick opened this issue Mar 13, 2017 · 2 comments
Open

Comments

@sharpTrick
Copy link

I propose a silent sage command of the form \sageslnt{y(x)=x^2}. This would allow assignments to be done within an equation or align environment enabling assignments and pretty printing on the fly.

This allows one to make changes to a function such as .factor() or f(x)=f(x, 5) without having to recompute or retype each chained modification every time it needs to be referenced.

Otherwise one has to either have duplicate lines of code or several modified function assignments in a previous sage block. ie f_1 = f(x,2), f_2=f_1(3)

\newcommand{\sageslnt}[1]{%
%\ST@beginsfbl%
@bsphack\ST@wsf{%
st.current_tex_line = \the\inputlineno^^J%
st.blockbegin()^^Jtry:}
\ST@wsf{ #1}%
\ST@endsfbl@esphack%
}

I added this code to my .sty file after the sagesilent environment initialization, which did the trick for me. I would have made some sort of pull request but I'm not sure which additional files I would need to modify to make complete change.

@dimpase
Copy link
Member

dimpase commented Jan 10, 2019

Without an example for using this macro it's hard to guess what is does. Please provide one before we can go forward with this.

@kcrisman
Copy link
Member

Am I correct in that @sharpTrick wants a silent Sage command rather than just a silent Sage environment? Yes, a more explicit description of how .factor() or f(x)=f(x, 5) would differ under these circumstances would help a lot, thanks!

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

3 participants