Support » Fixing WordPress » Sage Cell Embedding

  • Hi,
    I’m having trouble getting an embedded cell on my web page.

    I’m using the
    “CSS & Javascript Toolbox”
    and this is the code.

        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width">
        <script src=""></script>
        <script src=""></script>
        <script>$(function () {
        // Make the div with id 'mycell' a Sage cell
        sagecell.makeSagecell({inputLocation:  '#mycell',
                               template:       sagecell.templates.minimal,
                               evalButtonText: 'Activate'});
        // Make *any* div with class 'compute' a Sage cell
        sagecell.makeSagecell({inputLocation: 'div.compute',
                               evalButtonText: 'Evaluate'});
          <link rel="stylesheet" type="text/css" href="">
      Click the “Activate” button below to calculate factorials.
        <div id="mycell">
            <script type="text/x-sage">
    def _(a=(1, 10)):
        print factorial(a)

    This runs in an html viewer, but I don’t understand why it doesn’t in the code snippet.
    The following are some resources I’ve been using:

Viewing 1 replies (of 1 total)
  • Hi,

    I have just been working on the same thing! I’m not sure if you have made any progress by now but in case you haven’t, here is what I have found to work.

    Using the snippet tool, include only the lines

    <script src=""></script>
    <script src=""></script>
    <script>sagecell.makeSagecell({"inputLocation": ".sage"});</script>
    <link rel="stylesheet" type="text/css" href="">

    Make sure that the snippet tool is set to include this in the Header of the page.

    Now make sure the snippet tool is active on the page your working on, say Sage Test. Edit the page Sage Test and in the Text part of the editor (not the Visual) try and type

    <div class="sage">
      <script type="text/x-sage">1+2</script>

    You should get a sage cell on the page Sage Test which computes 1 + 2 and gives the answer 3. I tried to combine this with a VibeTheme and it did not work, then I tried it with a simpler theme (Sumo) and it worked a charm!

    I hope this helps.

Viewing 1 replies (of 1 total)
  • The topic ‘Sage Cell Embedding’ is closed to new replies.