TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to make my own package building on sagetex. It starts with


and I want it to execute some 'sagesilent' code as for instance

def listofpoints(xlist,ylist):
    return A.transpose()

The above code doesn't work since it is NOT possible to place the 'sagesilent' environment inside a \newcommand as far as I know from what I have read in different places.

I am looking for some nice way to execute 'sagesilent' code from a package I make myself. The point here is that I want to use my self-defined sage-commands in many different LaTeX-documents so it would be much nicer and cleaner to have a package than to spread around a file called mysagefunctions.tex and use


Any nice suggestions?

share|improve this question
Welcome to TeX.sx! see there is sagetex package made available at ctan.org – texenthusiast Mar 18 '13 at 0:22
Please complete your code snippets into a minimal working example (MWE) – hpesoj626 Mar 18 '13 at 1:30
Do you really need to load code on a function-by-function basis? If not, you could just have the sagesilent in your input file. Or maybe break up your code into a few different input files, based on the functionality provided. In terms of toggling sagesilent, this might be useful. – G. Poore Mar 22 '13 at 1:58
@LaRiFaRi That is hardly a reason to close a question. – percusse May 4 '15 at 13:50
@LaRiFaRi That's not our call. Somebody might need this later. It is a perfectly viable question. With proper explanation. The questions in the comments are secondary nature. But probably it will be closed because of your vote. – percusse May 4 '15 at 13:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.