Hi! My name is Asilata Bapat,
and I'm talking about Babel for academics.
So, I'm an academic at a university,
and I use Emacs, Org mode, and Babel
for a whole bunch of work related tasks.
And there are many other tools
that one could use to help with
this workflow.
I won't be going through all of these,
and the ones that I've listed are just
a few of the many that are available.
Today, I'll really be talking about
my teaching workflow.
Let's just dive right in to a demo.
So, the first file that I want to
show you is the notes and admin file.
From this file, I'll generate
a nice-looking PDF document of notes,
and I'll also keep track of some
course admin.
So, the file that I have here is this one,
and all of the files that I'm going to
show you today are taken from a course
that I'm teaching at the moment
this semester.
What I want to do is export this
entire document to LaTeX
because this is where
I'll be writing my course notes.
But before I do that,
I have some setup that I want to do,
and you'll notice some of these headings
are tagged as noexport,
and they won't be exported.
The startup setting I'll skip,
and then the main thing here
is the LaTeX setup.
So, I'm using these #+ option lines,
and I've told Org that
I want to use an unusual LaTeX class,
I'll have to tell Org about it later,
I'll do that in a moment,
and I have some
LaTeX header lines, and so on.
And then I have some export settings,
the first export setting is
to export into a different directory,
not just at the same level
because I want everything to go into
the artifacts directory,
and then I can ignore that artifacts
directory using Git.
This is the first
source code block that we see,
which is the Babel side of things,
and I've called it export-setup.
The way I write it is, #+begin_src,
the language that I want to use,
which is emacs-lisp,
and maybe some options,
and this is collapsed at the moment,
if I expand it, you'll see
inside here, this is really
just Elisp, Emacs Lisp.
So, the first thing I've done is,
I've added this LaTeX class
to the list of known LaTeX classes.
And the second thing I've done is,
I have locally set the value of
org-latex-pdf-process,
which is the compiler, to something…,
this command is complicated I guess,
but what the main thing it's doing
is that it's moving the generated output…,
sorry, the generated image files
to the output directory,
so that everything can remain
inside of this artifacts directory,
and maybe it's doing some other things.
And then there are some other
setup options that I'll skip.
So, this is a source code block,
inside of the source code block
everything is basically Emacs Lisp.
How do I evaluate this?
I just press Control c Control c (C-c C-c),
and it evaluates everything,
but if I want to automate the evaluation,
there's one other thing I can do.
So, let me jump down to
the local variables section.
In this local variable section
I have an eval block,
so, I've added a certain hook to the
org-export-before-processing-hook,
and that just resolves
this reference from this file.
It looks for a code block titled
export-setup, and it runs it
right before exporting,
and this is all local to this buffer.
So, before I export,
it'll then read the correct options.
And after this setup,
I have the course plan,
which is just what goes into my agenda
as to-dos, I'll skip that.
And after that, I have the actual notes,
and what they actually look like…,
so, this is what they actually look like,
nicely LaTeXed with diagrams and so on,
everything generated
from that single Org file.
I'll say more about diagrams later.
I also have to write assignments
and assignment solutions,
so let me jump to that.
Again, this is a very similar file,
but I want to now export
different headings to different files.
This is not going to be
exported all at once.
So, again I have some setup,
some general setup that I'll skip,
export setup just like before,
code setup for Python, really,
I have a various…, a bunch of different
languages here, so Shell and Python,
and some helper functions.
So, let me jump to this one called
togglesolutions, this is again
an Emacs Lisp code block.
What this does is,
it tells LaTeX to either toggle the
display of solutions on, or off
based on what the tag is
for that particular assignment.
So, whether if the assignment
is tagged as solved,
then the solution should be displayed,
otherwise they shouldn't be.
And here most of the assignments
are tagged as solved,
so in this case if I export this,
the solutions will be displayed.
Let's look at that.
So, I see the solutions blocks,
and this is because it's calling
the toggle solutions piece of code.
And the properties,
if I expand this properties drawer,
you see this output file name
has a homework one dash solved,
so it has a solved suffix,
and this is related to the fact that
I have a solved tag up here.
So, let's see what happens
if I delete the solved tag,
so nothing's happened yet,
but if I save the file,
then suddenly this homework one
dash solved becomes homework one,
and this is desired behavior,
this is what I want because
I want to keep the solved
and unsolved files separate.
So, once again, if I put in
the solved tag, and if I save,
I get back the different file name.
And how did I achieve this?
This is again back in the setup section,
it's the process-export-filenames block.
It's some big piece of Elisp
that I won't go through,
but basically it's mapping over
Org entries, and it's either
adding or removing this solved suffix
based on what tag it sees.
Okay, when does this
code block get evaluated?
Well, I want it to be evaluated
right before I save
because I change something,
I save, and I want the properties
to be get updated accordingly.
If I go down to the
local variables section again.
Again, I have a local variables
section here,
and I'm evaluating this Elisp,
which is setting the before-save-hook
to resolve the process-export-filenames
function, and so that's what
gives me that functionality.
And finally,
I have some skeletons, which are….
Emacs has this skeleton language,
which is a rudimentary templating language.
So, I've defined some templates
for my assignment and worksheet
in this little Emacs Lisp block,
which I think I usually just evaluate
manually, and then if I just call it,
I get a nice-looking skeleton
that gives me this assignment.
One thing I want to show you
in these assignments, or I mean,
in this file in particular,
are these dot source code blocks.
So, I've had to type in or draw in
some graphs in this assignment,
and I can do that right from Org.
So, this is some piece of code
that's creating a file,
which has this name,
and if I evaluate this block,
I see a results drawer with this file.
And this is a PNG file,
which now gets embedded
into my LaTeX document.
So, this is nice,
I can actually delete this from here,
and when I export,
the file will get attached automatically.
And similarly,
in some other assignments here,
I have some Python source,
so I've had to type in
some complicated matrices,
and some complicated matrix products,
and so on,
which I didn't want to do by hand,
so that I didn't introduce errors,
so I've written some Python code.
If I Control c Control c (C-c C-c)
on this block, you'll notice,
it's in the session matrix,
so it's using the previous,
the same kind of session.
And you'll see that the results,
because of the way I chose to format them,
look like a nice drawer with
nicely formatted LaTeX.
Once again these results
I can cut from the file,
and the file will get exported…,
when the file gets exported,
these source code blocks will get
evaluated, and the answer
will show up in the file.
And finally,
the last thing I want to show you
very briefly is the web page
for this course.
The only thing I want to show you here
is that I have a Python source code block,
which pulls in my handwritten course notes,
and makes them into a nice-looking list
with a nice-looking order,
and then just exports as HTML.
So, this is what
the web page looks like,
and you can see it at this URL.
If you go click on
the 2021 link at this URL.
So, that's all that I wanted to say.
Thank you very much!