# How to make a package using sagetex and sage-commands

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

\RequirePackage{sagetex}


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

\newcommand{\loadsagefunction}{
\begin{sagesilent}
def listofpoints(xlist,ylist):
A=matrix([xlist,ylist])
return A.transpose()
\end{sagesilent}
}


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

\input{mysagefunctions}


Any nice suggestions?

-
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