Closed StevenClontz closed 4 years ago
I presume we want these to be active? Editable and runnable? Might be a good experiment to add in the necessary headers and an example cell into current reveal.js output and see how it behaves. Before going 100% general and ending up problematic. In other words a proof-of-concept slideshow/slide would be helpful.
Pinging @sean-fitzpatrick as provocateur.
Editable and runnable would be the goal, yes! I have a bit of time this week, but not as much as I'd like. What do we need for this? Some sample content for fodder?
There are obvious perks to being able to go direct to Reveal.js. Wishlist for me is to also be able to do this via Jupyter conversion when there's code present. (But maybe that's just because my typo frequency leads me to appreciate being able to edit markdown text on the fly.)
On 11/13/19 8:44 AM, sean-fitzpatrick wrote:
I have a bit of time this week, but not as much as I'd like. What do we need for this? Some sample content for fodder?
Sorry, one email account was off all day by mistake.
A single page of PTX slideshow content, with Sage cell added in, and working, would be enough to get me to add it in.
Send original file and improved file, so I can look at their diff.
This sounds like something @StevenClontz might have better luck with. I've done one PTX slideshow attempt, with non-functioning Sage cells. Lack of time for tinkering means I jumped straight to using Jupyter conversion. (To be honest, most of the time I didn't even get my notes done in time to convert to Jupyter. I used PreTeXt HTML at 200% for definitions and Sage cells, and did the examples on the board.)
Can you point me to a sample Sage cell? I've actually never authored one before. Once I have that I'll tinker with embedding it in a valid PreTeXt slideshow.
Steven Clontz https://clontz.org - steven.clontz@gmail.com
On Thu, Nov 14, 2019 at 9:47 AM sean-fitzpatrick notifications@github.com wrote:
This sounds like something @StevenClontz https://github.com/StevenClontz might have better luck with. I've done one PTX slideshow attempt, with non-functioning Sage cells. Lack of time for tinkering means I jumped straight to using Jupyter conversion. (To be honest, most of the time I didn't even get my notes done in time to convert to Jupyter. I used PreTeXt HTML at 200% for definitions and Sage cells, and did the examples on the board.)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rbeezer/mathbook/issues/1188?email_source=notifications&email_token=AAL4YUEKSEHT7WDGZ6SL6V3QTVXHZA5CNFSM4I2FJXB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEECI67A#issuecomment-553947004, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL4YUBXF7GMGWLFJNB2XGTQTVXHZANCNFSM4I2FJXBQ .
Here's a link to my notes (in progress) for my linear algebra course this term: https://github.com/sean-fitzpatrick/math3410/blob/class/jupyter/3410notes.ptx
But that's overkill... I'll be back shortly with a few slides with sage cells in them.
Here's a relatively small file: http://www.cs.uleth.ca/~fitzpat/sage-slide.ptx
I extracted a couple of paragraphs and some sage cells, and stuck them into slides. (This was actually done as a jupyter notebook -- there was a bunch of Python code I wanted to run that I didn't include here.)
On 11/13/19 8:14 PM, Rob Beezer wrote:
A single page of PTX slideshow content, with Sage cell added in, and working, would be enough to get me to add it in.
Send original file and improved file, so I can look at their diff.
Perhaps not clear.
1) Start with some PTX, but with no Sage cells.
2) Convert to a Reveal.js/HTML slideshow.
3) By hand, add Sage cells and necessary headers.
4) Debug until the Sage cells "work" and the slideshow does not break.
Post HTML from (2) and (4). If I don't need to budget time for (4) I might be able to get this in quickly, otherwise it might not bubble-up.
Rob
Ok. So ptx slideshow with no Sage. Then edit the HTML directly. So maybe take a ptx article with a Sage cell, find the appropriate div, copy, paste, then tinker with scripts, etc until it works
Right! Copy out the headers, too.
On 11/14/19 4:30 PM, sean-fitzpatrick wrote:
Ok. So ptx slideshow with no Sage. Then edit the HTML directly. So maybe take a ptx article with a Sage cell, find the appropriate div, copy, paste, then tinker with scripts, etc until it works
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rbeezer/mathbook/issues/1188?email_source=notifications&email_token=AAOLM4VO6CBGXA3VN3FARILQTXUTNA5CNFSM4I2FJXB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEED27TI#issuecomment-554151885, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOLM4VOYGGKN7GHG5SLTDDQTXUTNANCNFSM4I2FJXBQ.
Dear Rob, It was as simple as copying some of the headers from a PreTeXt HTML document into the head of the reveal.js document. I didn't copy any of the PreTeXt CSS stuff. Just scripts for Sage and some MathJax stuff that was caught in between the Sage scripts.
That is, I added this:
<script src="https://sagecell.sagemath.org/embedded_sagecell.js"></script><script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [['\\(','\\)']]
},
asciimath2jax: {
ignoreClass: ".*",
processClass: "has_am"
},
jax: ["input/AsciiMath"],
extensions: ["asciimath2jax.js"],
TeX: {
extensions: ["extpfeil.js", "autobold.js", "https://pretextbook.org/js/lib/mathjaxknowl.js", ],
// scrolling to fragment identifiers is controlled by other Javascript
positionToHash: false,
equationNumbers: { autoNumber: "none", useLabelIds: true, },
TagSide: "right",
TagIndent: ".8em",
},
// HTML-CSS output Jax to be dropped for MathJax 3.0
"HTML-CSS": {
scale: 88,
mtextFontInherit: true,
},
CommonHTML: {
scale: 88,
mtextFontInherit: true,
},
});
</script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS_CHTML-full"></script><script>$(function () {
// Make *any* div with class 'sagecell-sage' an executable Sage cell
// Their results will be linked, only within language type
sagecell.makeSagecell({inputLocation: 'div.sagecell-sage',
linked: true,
languages: ['sage'],
evalButtonText: 'Evaluate (Sage)'});
});
</script>
Files are here: http://www.cs.uleth.ca/~fitzpat/sage-test/
Sage cells are a bit bigger than I'd like, but you can always zoom out. (Except then the output is too small.)
So the issue seems to simply be that pretext-revealjs.xsl was writing the lines for the reveal.js scripts, but not for any of the other stuff that usually comes with PreTeXt. Presumably stripping some of that out was intentional since you want a much more simplified format for the slides.
Excellent! Perhaps I'll get something together this weekend.
On November 14, 2019 8:27:26 PM PST, sean-fitzpatrick notifications@github.com wrote:
Files are here: http://www.cs.uleth.ca/~fitzpat/sage-test/
Sage cells are a bit bigger than I'd like, but you can always zoom out.
Nice Sean. It looks like that snippet does muck with MathJaX output a bit: notice that QR is sized incorrectly here:
It seems to match the output size here:
But the slide right before both of those has math output correctly sized.
Yes, although oddly enough, if you reload the page it gets the right size. Some experimentation with the right mix of scripts should get us there?
Good catch @StevenClontz - exactly the sort of thing we need to be careful about. IIRC, there is some sort of "math extension" in RevealJS? Should we disable that and let PTX load its own? Or maybe it is the Sage Cell? What happens if you remove "init_printing()"?
No change. Even if you remove the entire section with the Sage cell. ("init_printing()" just makes the output from Sage pretty-print with MathJax.) I can't figure out why that QR gets scaled down, but none of the other MathJax does.
First rough attempt. Recycled three templates from the HTML conversion. Only weirdness I see is a drop shadow on the content of the cells and the cell seems larger than it needs to be. But no adverse impact on the math, before or after. Using Reveal.js from the cloud, should also test with the local setup (though we are relying on MJ from the cloud). That's it for tonight.
The drop shadow also appears using code display (cd). Seems to be some sort of styling choice for a line of code. Inline code is hard to identify as such (there is a subtle font change but no background colour).
Both are probably CSS issues.
Both are probably CSS issues.
Yep. There is a place in the XSL where style
is being written right onto the page. Do you want to experiment? For cd
and c
note that I may wrap "exploded" PTX paragraphs (p
) in a div
so they can be "paused". Uncertain if I should do that uniformly or as-needed.
If you have trouble with the CSS, post a live example and I'll take a look.
This isn't something I'll be looking at any time soon: Apex is still my first PreTeXt priority and I'm going into the final three week push for the fall semester.
I've added preliminary support for Sage cells, along the lines of what has been discussed here. Definitely needs some CSS work to be presentable.
@davidfarmer - thanks for the offer to look at this. Let's sit on it for a bit, neither of us has time right now and I should set up automatic updates to the website first. Plus, larger issues to address, maybe a post momentarily.
Relevant commits end with 6c4b91db7f3a248d1702095277aa1b1da11d04a1 Please open a new issue for further (necessary improvements).
As noted in #1185, sage cells still need to be implemented in (at least) Reveal.js output.