I was thinking that it would be helpful to be able to play around with Nx in Livebook. What I want is to be able to have the operators available, in the manner that they are available to defn functions, so that I can write in Livebook in a straightforward mathematical style (like Matlab). This is possible by having the module definition in a cell, with import Nx.Defn at the top:
Then within this context, I’m working in “Matlab mode”. I’m wondering if this is currently possible by some means in Livebook? Or if not, maybe there’s some metaprogramming means of achieving this? I’m still reading up on Elixir basics, so it’s certainly possible I’m missing some fundamental understanding about how things work…
Hey @ds604, you can do use Nx.Defn.Kernel at the top of your notebook, this is going to replace default imports, such as +, as it would within defn. We don’t recommend this in the docs or elsewhere, but it can be neat for experimentation, like in your case : )
Is there a way to change Livebook CSS? (like an easy external way, like I have a CSS file sitting somewhere that overrides some of the default settings) Mainly I want the text and cells to be a bit denser, so I can fit more on the screen at once. But if there’s a way to go in and make other changes, I’d sort of like to modify a few things to match other environments I’m familiar with.
Code zen only shows dense code cells. You can also use “Custom” and show both Markdown and Code cells, it is going to hide the insert buttons, so things will be more dense. In those modes, you can still insert cells using the keyboard shortcuts : )
Thanks! For more customized changes, it would take going into the application itself? I was trying to figure out what’s going on through the browser devtools, but it’s a little difficult to understand… I can see the different CSS files in the Assets folder of the application, and I just started learning about how Phoenix applications are set up, maybe there’s other stuff going on in the Components.
Another question I had: If I want to save a notebook out to some static format, for static HTML, I can copy the HTML and CSS to a file like this: Matlab mode - Livebook. But suppose I wanted to print this out: either from the original Livebook or from this static file, I only seem to get the first page. I tried printing selection, but that didn’t seem to work either.
I know there’s the export option for markdown, but is there an option for printing or exporting rendered output that I might be overlooking?
Are you referring to the various smart cells you can add to the livebook?
Those are kino components and because of the modular nature of the design they are each a self-contained library comparable to micro-frontends, so each manages its own style, e.g. kino_bumblebee css, kino_explorer css, kino_db css
=================
I took some notes on this, maybe someone else comes across this trying to figure out how to make a printout just for now. For a quick-fix printing solution (that works well enough for a page where maybe you don’t need the iframes), in my static HTML file, if I:
am in Chrome (doesn’t seem to work in Firefox)
drag-select everything (cmd-A select didn’t work, but drag-select did)
right-click Print (cmd-P seems to revert to single page)
Maybe the other option would have been to paste markdown with outputs to a markdown renderer, and print that. But the HTML rendered output includes the (b64) images. I guess you could pull them out and put them in the markdown…
The only thing that didn’t get included is the plot, which I can recover from the markdown and maybe put Vegalite in the HTML file to get it to render.