summaryrefslogblamecommitdiffstats
path: root/2021/captions/emacsconf-2021-babel--babel-for-academics--asilata-bapat--main.vtt
blob: 5b4a23c583da547377992fd07dbba256d86a6d71 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
































































































































































































































































































































































































































































































































































































































































































































































































































                                            
WEBVTT

00:00.799 --> 00:02.560
Hi! My name is Asilata Bapat,

00:02.560 --> 00:04.960
and I'm talking about Babel for academics.

00:04.960 --> 00:06.879
So, I'm an academic at a university,

00:06.879 --> 00:09.040
and I use Emacs, Org mode, and Babel

00:09.040 --> 00:11.280
for a whole bunch of work related tasks.

00:11.280 --> 00:12.559
And there are many other tools

00:12.559 --> 00:14.240
that one could use to help with

00:14.240 --> 00:15.200
this workflow.

00:15.200 --> 00:16.597
I won't be going through all of these,

00:16.597 --> 00:18.160
and the ones that I've listed are just

00:18.160 --> 00:20.240
a few of the many that are available.

00:20.240 --> 00:22.000
Today, I'll really be talking about

00:22.000 --> 00:24.080
my teaching workflow.

00:24.080 --> 00:27.840
Let's just dive right in to a demo.

00:27.840 --> 00:29.243
So, the first file that I want to

00:29.243 --> 00:31.599
show you is the notes and admin file.

00:31.599 --> 00:33.040
From this file, I'll generate

00:33.040 --> 00:35.440
a nice-looking PDF document of notes,

00:35.440 --> 00:36.963
and I'll also keep track of some

00:36.963 --> 00:38.399
course admin.

00:38.399 --> 00:43.200
So, the file that I have here is this one,

00:43.200 --> 00:44.719
and all of the files that I'm going to

00:44.719 --> 00:46.320
show you today are taken from a course

00:46.320 --> 00:48.096
that I'm teaching at the moment

00:48.096 --> 00:49.680
this semester.

00:49.680 --> 00:53.147
What I want to do is export this

00:53.147 --> 00:55.520
entire document to LaTeX

00:55.520 --> 00:56.320
because this is where

00:56.320 --> 00:58.800
I'll be writing my course notes.

00:58.800 --> 01:00.480
But before I do that,

01:00.480 --> 01:03.199
I have some setup that I want to do,

01:03.199 --> 01:05.199
and you'll notice some of these headings

01:05.199 --> 01:06.509
are tagged as noexport,

01:06.509 --> 01:08.400
and they won't be exported.

01:08.400 --> 01:11.680
The startup setting I'll skip,

01:11.680 --> 01:13.499
and then the main thing here

01:13.499 --> 01:14.880
is the LaTeX setup.

01:14.880 --> 01:18.560
So, I'm using these #+ option lines,

01:18.560 --> 01:21.360
and I've told Org that

01:21.360 --> 01:23.280
I want to use an unusual LaTeX class,

01:23.280 --> 01:24.880
I'll have to tell Org about it later,

01:24.880 --> 01:26.240
I'll do that in a moment,

01:26.240 --> 01:27.001
and I have some

01:27.001 --> 01:29.600
LaTeX header lines, and so on.

01:29.600 --> 01:31.360
And then I have some export settings,

01:31.360 --> 01:32.941
the first export setting is

01:32.941 --> 01:35.119
to export into a different directory,

01:35.119 --> 01:36.799
not just at the same level

01:36.799 --> 01:38.560
because I want everything to go into

01:38.560 --> 01:39.716
the artifacts directory,

01:39.716 --> 01:41.360
and then I can ignore that artifacts

01:41.360 --> 01:44.399
directory using Git.

01:44.399 --> 01:45.600
This is the first

01:45.600 --> 01:47.280
source code block that we see,

01:47.280 --> 01:49.759
which is the Babel side of things,

01:49.759 --> 01:52.079
and I've called it export-setup.

01:52.079 --> 01:55.759
The way I write it is, #+begin_src,

01:55.759 --> 01:56.965
the language that I want to use,

01:56.965 --> 01:58.159
which is emacs-lisp,

01:58.159 --> 01:59.600
and maybe some options,

01:59.600 --> 02:01.119
and this is collapsed at the moment,

02:01.119 --> 02:03.600
if I expand it, you'll see

02:03.600 --> 02:05.155
inside here, this is really

02:05.155 --> 02:07.600
just Elisp, Emacs Lisp.

02:07.600 --> 02:09.592
So, the first thing I've done is,

02:09.592 --> 02:12.440
I've added this LaTeX class

02:12.440 --> 02:15.360
to the list of known LaTeX classes.

02:15.360 --> 02:17.433
And the second thing I've done is,

02:17.433 --> 02:19.599
I have locally set the value of

02:19.599 --> 02:21.112
org-latex-pdf-process,

02:21.112 --> 02:24.720
which is the compiler, to something…,

02:24.720 --> 02:27.200
this command is complicated I guess,

02:27.200 --> 02:29.440
but what the main thing it's doing

02:29.440 --> 02:32.160
is that it's moving the generated output…,

02:32.160 --> 02:34.160
sorry, the generated image files

02:34.160 --> 02:35.169
to the output directory,

02:35.169 --> 02:37.519
so that everything can remain

02:37.519 --> 02:39.680
inside of this artifacts directory,

02:39.680 --> 02:41.519
and maybe it's doing some other things.

02:41.519 --> 02:43.680
And then there are some other

02:43.680 --> 02:47.120
setup options that I'll skip.

02:47.120 --> 02:49.360
So, this is a source code block,

02:49.360 --> 02:50.640
inside of the source code block

02:50.640 --> 02:52.319
everything is basically Emacs Lisp.

02:52.319 --> 02:54.640
How do I evaluate this?

02:54.640 --> 02:56.319
I just press Control c Control c (C-c C-c),

02:56.319 --> 02:57.920
and it evaluates everything,

02:57.920 --> 03:00.319
but if I want to automate the evaluation,

03:00.319 --> 03:02.080
there's one other thing I can do.

03:02.080 --> 03:04.658
So, let me jump down to

03:04.658 --> 03:06.720
the local variables section.

03:06.720 --> 03:09.740
In this local variable section

03:09.740 --> 03:11.680
I have an eval block,

03:11.680 --> 03:14.681
so, I've added a certain hook to the

03:14.681 --> 03:16.879
org-export-before-processing-hook,

03:16.879 --> 03:18.319
and that just resolves

03:18.319 --> 03:19.519
this reference from this file.

03:19.519 --> 03:23.040
It looks for a code block titled

03:23.040 --> 03:24.859
export-setup, and it runs it

03:24.859 --> 03:26.000
right before exporting,

03:26.000 --> 03:29.200
and this is all local to this buffer.

03:29.200 --> 03:30.799
So, before I export,

03:30.799 --> 03:34.000
it'll then read the correct options.

03:34.000 --> 03:37.519
And after this setup,

03:37.519 --> 03:39.760
I have the course plan,

03:39.760 --> 03:41.599
which is just what goes into my agenda

03:41.599 --> 03:43.360
as to-dos, I'll skip that.

03:43.360 --> 03:45.519
And after that, I have the actual notes,

03:45.519 --> 03:48.640
and what they actually look like…,

03:48.640 --> 03:54.400
so, this is what they actually look like,

03:54.400 --> 03:57.040
nicely LaTeXed with diagrams and so on,

03:57.040 --> 03:57.920
everything generated

03:57.920 --> 04:00.720
from that single Org file.

04:00.720 --> 04:04.480
I'll say more about diagrams later.

04:04.480 --> 04:06.080
I also have to write assignments

04:06.080 --> 04:07.260
and assignment solutions,

04:07.260 --> 04:10.239
so let me jump to that.

04:10.239 --> 04:11.840
Again, this is a very similar file,

04:11.840 --> 04:14.080
but I want to now export

04:14.080 --> 04:15.760
different headings to different files.

04:15.760 --> 04:16.639
This is not going to be

04:16.639 --> 04:18.320
exported all at once.

04:18.320 --> 04:19.759
So, again I have some setup,

04:19.759 --> 04:22.400
some general setup that I'll skip,

04:22.400 --> 04:25.120
export setup just like before,

04:25.120 --> 04:29.280
code setup for Python, really,

04:29.280 --> 04:31.280
I have a various…, a bunch of different

04:31.280 --> 04:33.199
languages here, so Shell and Python,

04:33.199 --> 04:35.967
and some helper functions.

04:36.088 --> 04:38.160
So, let me jump to this one called

04:38.160 --> 04:39.756
togglesolutions, this is again

04:39.756 --> 04:41.919
an Emacs Lisp code block.

04:41.919 --> 04:43.600
What this does is,

04:43.600 --> 04:48.632
it tells LaTeX to either toggle the

04:48.632 --> 04:50.336
display of solutions on, or off

04:50.336 --> 04:53.096
based on what the tag is

04:53.096 --> 04:54.240
for that particular assignment.

04:54.240 --> 04:57.520
So, whether if the assignment

04:57.520 --> 04:58.800
is tagged as solved,

04:58.800 --> 05:00.240
then the solution should be displayed,

05:00.240 --> 05:03.280
otherwise they shouldn't be.

05:03.280 --> 05:05.447
And here most of the assignments

05:05.447 --> 05:07.120
are tagged as solved,

05:07.120 --> 05:08.880
so in this case if I export this,

05:08.880 --> 05:11.840
the solutions will be displayed.

05:11.840 --> 05:20.800
Let's look at that.

05:20.800 --> 05:23.919
So, I see the solutions blocks,

05:23.919 --> 05:27.036
and this is because it's calling

05:27.036 --> 05:29.919
the toggle solutions piece of code.

05:29.919 --> 05:32.240
And the properties,

05:32.240 --> 05:33.840
if I expand this properties drawer,

05:33.840 --> 05:39.280
you see this output file name

05:39.280 --> 05:41.440
has a homework one dash solved,

05:41.440 --> 05:43.360
so it has a solved suffix,

05:43.360 --> 05:45.912
and this is related to the fact that

05:45.912 --> 05:47.680
I have a solved tag up here.

05:47.680 --> 05:48.960
So, let's see what happens

05:48.960 --> 05:51.199
if I delete the solved tag,

05:51.199 --> 05:52.639
so nothing's happened yet,

05:52.639 --> 05:54.000
but if I save the file,

05:54.000 --> 05:55.919
then suddenly this homework one

05:55.919 --> 05:58.240
dash solved becomes homework one,

05:58.240 --> 06:00.080
and this is desired behavior,

06:00.080 --> 06:02.084
this is what I want because

06:02.084 --> 06:03.222
I want to keep the solved

06:03.222 --> 06:04.497
and unsolved files separate.

06:04.497 --> 06:07.120
So, once again, if I put in

06:07.120 --> 06:09.440
the solved tag, and if I save,

06:09.440 --> 06:11.440
I get back the different file name.

06:11.440 --> 06:12.720
And how did I achieve this?

06:12.720 --> 06:16.479
This is again back in the setup section,

06:16.479 --> 06:19.280
it's the process-export-filenames block.

06:19.280 --> 06:21.120
It's some big piece of Elisp

06:21.120 --> 06:22.349
that I won't go through,

06:22.349 --> 06:24.240
but basically it's mapping over

06:24.240 --> 06:26.720
Org entries, and it's either

06:26.720 --> 06:30.080
adding or removing this solved suffix

06:30.080 --> 06:34.560
based on what tag it sees.

06:34.560 --> 06:36.781
Okay, when does this

06:36.781 --> 06:37.919
code block get evaluated?

06:37.919 --> 06:39.840
Well, I want it to be evaluated

06:39.840 --> 06:41.039
right before I save

06:41.039 --> 06:43.199
because I change something,

06:43.199 --> 06:45.840
I save, and I want the properties

06:45.840 --> 06:49.199
to be get updated accordingly.

06:49.199 --> 06:51.364
If I go down to the

06:51.364 --> 06:52.639
local variables section again.

06:52.639 --> 06:55.840
Again, I have a local variables

06:55.840 --> 06:56.800
section here,

06:56.800 --> 06:58.479
and I'm evaluating this Elisp,

06:58.479 --> 07:01.199
which is setting the before-save-hook

07:01.199 --> 07:04.240
to resolve the process-export-filenames

07:04.240 --> 07:05.716
function, and so that's what

07:05.716 --> 07:09.199
gives me that functionality.

07:09.199 --> 07:12.720
And finally,

07:12.720 --> 07:16.240
I have some skeletons, which are….

07:16.240 --> 07:19.360
Emacs has this skeleton language,

07:19.360 --> 07:22.240
which is a rudimentary templating language.

07:22.240 --> 07:24.220
So, I've defined some templates

07:24.220 --> 07:26.319
for my assignment and worksheet

07:26.319 --> 07:29.440
in this little Emacs Lisp block,

07:29.440 --> 07:31.120
which I think I usually just evaluate

07:31.120 --> 07:33.280
manually, and then if I just call it,

07:33.280 --> 07:35.199
I get a nice-looking skeleton

07:35.199 --> 07:37.360
that gives me this assignment.

07:37.360 --> 07:40.080
One thing I want to show you

07:40.080 --> 07:43.199
in these assignments, or I mean,

07:43.199 --> 07:44.720
in this file in particular,

07:44.720 --> 07:46.560
are these dot source code blocks.

07:46.560 --> 07:49.840
So, I've had to type in or draw in

07:49.840 --> 07:52.000
some graphs in this assignment,

07:52.000 --> 07:54.720
and I can do that right from Org.

07:54.720 --> 07:56.400
So, this is some piece of code

07:56.400 --> 07:59.199
that's creating a file,

07:59.199 --> 08:00.879
which has this name,

08:00.879 --> 08:05.840
and if I evaluate this block,

08:05.840 --> 08:10.720
I see a results drawer with this file.

08:10.720 --> 08:12.711
And this is a PNG file,

08:12.711 --> 08:13.759
which now gets embedded

08:13.759 --> 08:15.680
into my LaTeX document.

08:15.680 --> 08:16.639
So, this is nice,

08:16.639 --> 08:18.720
I can actually delete this from here,

08:18.720 --> 08:20.479
and when I export,

08:20.479 --> 08:23.919
the file will get attached automatically.

08:23.919 --> 08:26.639
And similarly,

08:26.639 --> 08:28.800
in some other assignments here,

08:28.800 --> 08:30.639
I have some Python source,

08:30.639 --> 08:33.284
so I've had to type in

08:33.284 --> 08:34.527
some complicated matrices,

08:34.527 --> 08:36.128
and some complicated matrix products,

08:36.128 --> 08:36.640
and so on,

08:36.640 --> 08:38.000
which I didn't want to do by hand,

08:38.000 --> 08:39.760
so that I didn't introduce errors,

08:39.760 --> 08:41.599
so I've written some Python code.

08:41.599 --> 08:44.240
If I Control c Control c (C-c C-c)

08:44.240 --> 08:45.920
on this block, you'll notice,

08:45.920 --> 08:47.120
it's in the session matrix,

08:47.120 --> 08:49.200
so it's using the previous,

08:49.200 --> 08:52.399
the same kind of session.

08:52.399 --> 08:55.440
And you'll see that the results,

08:55.440 --> 08:57.760
because of the way I chose to format them,

08:57.760 --> 08:59.920
look like a nice drawer with

08:59.920 --> 09:01.600
nicely formatted LaTeX.

09:01.600 --> 09:03.920
Once again these results

09:03.920 --> 09:05.519
I can cut from the file,

09:05.519 --> 09:07.600
and the file will get exported…,

09:07.600 --> 09:09.200
when the file gets exported,

09:09.200 --> 09:10.480
these source code blocks will get

09:10.480 --> 09:12.000
evaluated, and the answer

09:12.000 --> 09:19.200
will show up in the file.

09:19.200 --> 09:20.097
And finally,

09:20.097 --> 09:21.363
the last thing I want to show you

09:21.363 --> 09:23.531
very briefly is the web page

09:23.531 --> 09:26.720
for this course.

09:26.720 --> 09:28.399
The only thing I want to show you here

09:28.399 --> 09:30.399
is that I have a Python source code block,

09:30.399 --> 09:33.279
which pulls in my handwritten course notes,

09:33.279 --> 09:36.399
and makes them into a nice-looking list

09:36.399 --> 09:38.880
with a nice-looking order,

09:38.880 --> 09:41.680
and then just exports as HTML.

09:41.680 --> 09:44.600
So, this is what

09:44.600 --> 09:46.080
the web page looks like,

09:46.080 --> 09:48.880
and you can see it at this URL.

09:48.880 --> 09:49.892
If you go click on

09:49.892 --> 09:52.800
the 2021 link at this URL.

09:52.800 --> 09:54.880
So, that's all that I wanted to say.

09:54.880 --> 09:58.360
Thank you very much!