Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

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

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.