00:00.000 Introduction
00:41.400 Motivation
02:53.360 Evolution
06:02.480 What do you get from the feature branch?
08:47.280 Behind the scenes: .dir-locals.el
11:59.080 When fontspec is not enough
15:21.080 Rationale behind my take at LaTeX font management
18:34.480 Demonstrations
22:57.475 Demo: Emoji
23:33.180 Demo: Letter
25:44.400 Demo: Side by side
28:12.600 Thanks
29:47.120 Q: What about video (mp4) support for ox-latex?
During the last year, the LaTeX backend in Org mode has received an overhaul.
The objectives, while keeping backward compatibility, were:
Better integration of the font-management features and packages with
lualatex/xelatex
Reducing the amount of #+LATEX_HEADER: lines and avoiding to have to
include a pure LaTeX file to profit from them
Flexibility, while using native Emacs Lisp features, like file/directory
local variables
In this talk, I will present the new font management features in the LaTeX
backend and show a couple of examples of what can be achieved.
About the speaker:
After 30 years using Emacs, professionally and for my PhD, I'm currently
quite involved in org-mode, where I'm revamping the LaTeX backend.
Discussion / notes
Not a question but I will start using LaTeX fonts in org now
Q: How's about video (mp4) support for ox-latex? I start to give
presentations with many videos. This is something that really push
me back using ox-latex.
A: Experiment with a LaTeX file and then try to include the
relevant snippets in #+BEGIN_EXPORT latex
Okay. Good afternoon, morning or evening,whatever it is in your time zone.I'm Pedro Aranda and I'm going to be talking aboutwhat I've been doingwith the latest backend in Org Modeand the different... Sorry... and the way it treats fonts.Just a couple of words beforeI am going to go through motivation,the evolution and get you an idea of what you can getfrom the feature branch that I have startedand give a couple of demos.
Actually, my motivation is I was using ox-latex currentlyand ox-beamer for as a foundation for my activities,mainly for lecture notes and lecture slidesso I came from pure LaTeX and beamersand for me the real cool use case,or I would say this wasthe killer use case for me wasI have a programming lecture,which is sort of a Python 101,and when I'm live in the lecture,I can go, and if the pupils ask me, I can modify code,show modified code and results on the fly,and that's something that really impresses the kidsand makes them understand what we are talking about.From my pro... subjective point of view, in some,mainly in ox-beamer, some of the things that I was missingis that emojis would really break the monotonyand I missed the support for emojis and stock Beamer themes.And some fonts I also found were suboptimalor difficult to adapt in case they need an adaptation.So, for example, people who need special fontsbecause of their special capabilities,it's difficult to get those fonts from the stock themesand from the stock font implementations you have there.So, requirements from the Emacs side to do this is none,because basically, okay, the only thing I wantis to work on a vanilla Emacs,which is more or less recent,because yes, I'm a bit of a freakand I compile it every two, three...I get it from master and compile it every two, three days.And yahoo, I had to change to a new Mac,and I'm able now to get my vanilla Emacs within four.So that was a big accomplishment in these last days.
What is the evolution?I mean my personal evolution and my take of ox-latexwas I put everything in a in a LaTeX fileand I input it through the LaTeX header, and that's it.But that was not very beginner-friendly,and once I had some people interested in this,"oh wow, I can modify the code on the flyand see the results on the fly,"it was more difficult for them to give it a go.So I just... Because they,there are people who have not that big,that much experience with LaTeXand it can even be a bridge to introduce people into LaTeX.So, in any case, it was not very beginner-friendlyand I had complaints on that.So, what I think was, we can do better.My first attempt was something that was completely neutralto Babel or Polyglossia.and it was made basically for font LaTeXalthough some of the things can... for lualatexand some of the things can also be used with xelatex.So overriding template fontsand taking into account fallback fontswas something that I learnedwhen we started this conversation,and the only problem with thisis that fallback fonts only work for lualatexbecause xelatex doesn't support them.Actually, fallback fonts is a lua feature.There was already something in the listregarding script detection which helped me a lot.So big recognition to Juan M. Macias for that,and for his publishing the algorithm or the scriptin the org mode mailing list.And then came my sort of little nightmare,which was when we started talkingabout internationalization or localization.Looking back, I have a very strange feelingabout a blurring target there.Because the reality, being very, very frank, did I need it?Really no, because I just neededto add Spanish with Babel and that was it.Well actually for me it still isand you can put the British, German or Italianit continues to be true for me,so I had personally, I had little interest in doing that,but I took it as a challengewhich has shown to be really tough.
What do you get from the feature branch?The feature branch adds font management for fontspec,which is not strictly neededwhen you are on Latin, Cyrillic, and Greek scriptsas long as the fonts in your template support them.But again, it's a nice way to get better support here.You don't need it if you're happy with the fonts you getfrom the templates that you use both for Beamerand the document classes in LaTeX.If you don't want to use alternative fonts,you don't need it, but you would need it.Of course, if you don't want things like,for example, emojis or need emojis,you really don't need fallback fonts.So my idea is that the next thing that you can addis Babel and Polyglossia herefor enhanced localization and multilingual documents there.And at the end, my vision was that the keywords involvedwould be language, the main language.And then a nice idea from Ihorwas to put all the secondary languages there too.Then specify the LaTeX compiler.Then what I've added is a keywordwhich is #+LATEX_MULTI_LANG:which can be fontspec or babel or polyglossiafor localized documents.By default, this thing is nil and when it is nil,you get the behavior from Org Modethat you already are used to if you don't want to switch.Jing Huang was there and I was really,was chirped into the conversationand really helpful and a big thanks to himbecause he also had an easy ideato support Chinese and Japanese documents,so that the only thing that you need is to add the languagethat you're going to write your document in.Very, very big thank you for that,because that was really a challengenot being able to decipherwhat I was what I was coding therein terms of: I have a document,I copy and paste it from some place,and from there, I get my answer, I get my PDF,and I compare whether it is correct or not.
So what is behind the scenes?I've always suggested that in orderto use the feature branch efficiently,you create a file with the default valuesyou need for your variables,and that's this famous .dir-locals.el files.What I do is, I have a generic onein my home documents directory,and this is used for all the org documentsthat are in subdirectories from there.Why? Because normally you will not bechanging your fonts that often,and if you need, you can always goand have your configuration locally.So it's this point where I'm collectingmy font configuration andfor me, this gives me a very, very nice quick startfor new documents and presentations.And there you can even configure a lot of compilerand font language management too,so you have everything in a file.And the other nice thing for thatis that you can also include that in a subdirectory.And if this subdirectory is something that you're sharingin a project with other people,you are already configuring the, say,quote, unquote, corporate look and feel for your documentsin that project for everyoneand no one else has to care abouthow this document has to be configured.One of the things that I really like in this approachis that it is a grow-as-you-go.So, for example, you can start with something like that,which is I have my fonts, my basic fonts for main,which is the serif font, for sans,which is the sans serif font, for maths,and for the mono, with some features like to make them scale.This is something that is provided by youthrough the fontspec package,and you're happy with it, and you work with it,and in a given moment,you go and you have your own problemsor your own challenge,and you need to have, for example, emojis for one of the fonts,and what you do is, in this case, you just add the emojisas a fallback font in the font that where you want to replace this.This is what I'm doing right now for this presentation, and you will see...You can always, as I've said,you can always have your dir-locals,and you can copy that into a working directorywhich needs special adaptations or has special needs,and from there, you have that directorywith your modified or customized dir-locals.el file.
So, fontspec is normally enough,but sometimes, you can't control all the fontswith fontspec only, and there you have a polyglot hereand babel coming to your help.This may also be the casethat you are working in an intended language,I don't know which, but an intended language, and you found,and you wanted to see how that was configured,and you found the latest examplethat used Babel or Polyglossia.The exporter provides you variablesto configure both fontspec, Polyglossia and Babel.So just as an example of how I picture this is,uh, you find it in the Internet,something like that, uh, something like this,because you have your document and you need Thai.So, and I found an example in the internetthat tells me that I'm going to be using Babel.Main is going to be English.And I'm also going to have Thai.And then they tell me that, for English,I'm going to be using Noto Serif for the main,for the main of the serif font,Noto Sans for the sans font,and then when I'm writing things in Thai,I'm going to be using Noto Serif Thai and Noto Sans Thai.That's what I see in the Internet.So what you can always do, what you would do in this case,is I'm going to get and map the font configurationsfrom the latest into this variable.Things that you have to take into account hereis, for example, the language.The language here is Thai. You have the languagethat you're intending this font for is Thai.So this appears here. In case you don't have any language,like in the first two lines,you just say that the language is nil,which is the language for the default language.The other thing is in my example,in this example that I found in the Internet,I have my properties for the fonts in this part in LaTeX,and I put them as properties here.That's the whole idea behind the feature branch.The babelprovide part is generated or is also integratedfrom the Org header, mainly from the language line.We have a variable in case you need to tweak it,but normally the defaults provided by Org are good enough.
[00:15:21.080]Rationale behind my take at LaTeX font management
So what is the rationale behind my take at LaTeX font management?That's something that might be something very personal.When am I using fontspec?I'm using fontspec when I'm with Lua- or xelatex,and I want fonts that are differentfrom those specified in the LaTeX class.That's point number one. I will also go for fontspecwhen I need to support scripts,but I'm missing in the fonts I use,and I can use fallback fonts for that. I have two.The only limitation I have here is the following:all languages must be left to right.And if you don't say anything at all,the LaTeX backend assumes that you want the dates,standard names for the abstract and so onin American English, if you're using them.In many cases, you're not using any sort ofabstract, table of contents, and so on,and you don't need that.The important thing is maybe date management.If you need dates, headingsor anything in any other language or locale,then yes, then you need to use Babel or Polyglossia.Choice, Depends. Can use polyglossia here,or you can use Babel, whatever you want.Also, in some cases, it will dependif you've been researching a bitof how this is done with pure LaTeX,it will be also depending on, uh,on the examples that you get.So, what can you, when you are usingBabel or Polyglossia here, what do you have?You have your dates, your headings, and so on.You might need to control the textin the sense that what passageis written in what language.For example, for things like hyphenationand some ways of writing the hyphens in aand direct speech and things like that.And the other place where you needother Babel or Polyglossia here,and you will see that, because all examplesthat you can get for later, in this case,is when you have a languagethat uses right to left alignmentlike Arabic, Hebrew and others.So one note of, I would say, care is you always use the,if you use Unicode fontsthat includes the scripts as you need,you will have done, that will be a great leap for youbecause that simplifies the configuration a lot.
Now, a couple of demos.I don't know if you've noticedfirst demo is that I'm usingfonts that are not the official fontsin this Beamer template,which is by the way Boadilla.This would be the first thing.So I've been using other fonts,and they are, at least from what I get in class,they are more readable than the official...than the default fonts in Polyglossia,that you get in Babel for the Boadilla theme.Another thing is what I've told you,I have my own things like emojis.Now, if you allow me for a second,I'm going to switch to the Emacswhich is running behind the scenes to show you what.Okay, fine. So, this is the presentation.that I have here, and as you see,I'm using Lua LaTeX and just fontspec,given I don't know why I would need this,this is an English presentation,but just to show you what you can do,if I go back here, and I go to the beginning of the presentation,and now what...Okay, this is the presentation, right?So what I'm going to do is, I'm going to go backand I'm going to show the full screen.And in this full screen,you see the presentation on one sideand you see Emacs on the other side. Oh, still nothing.Yeah, we're not seeing your screen at the moment, sorry.Oh, thank you. Thank you for that.Now it's starting to come. Okay. Yay! Fine.So this presentation, I've done it with Lua LaTeX,and what I add here is fontspec and English language.Just to show you, but with the same configuration,with the same fontspec configuration,but adding Polyglossia.I just have enough with adding Polyglossiawith the Spanish language to get my dates correctly,and this is something... I'm going to see the date in English,and if I now go and recompile it, in a couple of seconds,you will see that the date is in Spanish.We are using the same... Which I can show, by the way.I see just by adding polyglossia here,I can get my dates in Spanish.What... I have included the dir-localsin these lines, but just to discuss it a bit more.I have it for all the presentations.I think it was here. No. For the demo,for the presentations I use for Emacs conferences,I have it, and it's something like this.Actually, you don't need a fallbackfor the main font herebecause the presentations are done with the sans font,so the only thing that I would really needwould be something like this.This can be commented, and the same happens herewith the mono. This can be also commented.
The only thing where I would really needa fallback font is here,and what this is telling me is thatyou have a fallback for the emoji,for the emoji script,and you need to use the Apple Color Emoji fontwith a modifier,which in this case is that you needto have the Harfbuzz renderer.That's the only thing that you really need.Where do I get all these things from?All these things I get from the different partsand from different scripts in the Internet.
I also have a couple of other things to show.For example, first of all, I do not need this.This is a letter that I've been writing this morningand I'm not using the feature branches at all,because I just needed a sans font,and it's going to be a letter that I'm writing inwith the sans font, and the only thing I needwas Spanish polyglossia for the date.Anyhow, how did... What was my first thing that I didwith the back end? Back in I think it was April,we had a... this comes from the mailing list,we had someone who had this problem right,and he wanted to add emojis,and he had problems with the verbatim font,and that's how everything got started.If you now go and I get my LaTeX for that running.Well, I actually, all my LaTeX is supported for that.And this was what I showed in one of the Emacs, Org Mode meetups.And there you see that we have the emojis.We had the fonts for the different things. We had maps.And you could even go and add scriptsand little passages and different scripts.And this was done with the same principles that I want.I have my main font. I have the emojis.and I want, I have my son's phone and I have the emojis,the Han for Japanese and the Kana for Japanese,so that these characters here,both in the sons and in the serif passagesare included correctly in the PDF.
And a third thing of what you can do...I've also shown this, so this is morefor people who have not seen it.This is a side-by-side passage of...well, actually, the beginning of the analysis by Xenophonboth in in Greek and in German, with some comments.And if I go... This is done with Polyglossia.If I go once again and producethe PDF for this... Just a second...Come on. There you are. You get this.And there you see different fonts.Which fonts am I using for this?I'm using for the main font for me is FreeSerif.This listing is produced with DejaVu Sans Mono.And using Polyglossia here, I'm able to go and definethe Greek polyton for the variant,for the serif variant with the Noto Serif font,just to differentiate it from the German text.And nice thing is that both in the German textyou see for example here, and with the Greek text,everything is scaled to matchthe lower case of the main font, which is FreeSerif.So that everything looksextremely uniform and nice to read.So that's what you want to do.That's what you can do with this.Just a couple of final words on this.
I want to thank once again Juan Manuel Macias and Jing Huangfor what they have shared.And I also want to thank everybodyfor productive contributions to the discussion.I'm saying this because I think I need a longer restand I'm going to be leavingthe feature font untouched for a couple of monthsso that people can take... the feature branchuntouched for a couple of monthsto see if people want to use it, and how they want to use it,and then maybe in the future, we can discussif we want to integrate it or not,or if people need it and all that. Now questions, comments?
[00:29:47.120]Q: What about video (mp4) support for ox-latex?
Someone is asking what about how is about videomainly MP4 support on ox-latex."I started the presentations with many videos.This is something that really pushed me back using ox-latex."What I would say to this is, I mean this goes beyondwhat we're discussing here with fonts.I would advise you to go and get the sameor have the same thing that I did,which was, first of all, try to write it in LaTeX,and then, once you have the minimal working examples,you can get the LaTeX partsintegrated into your own presentation.That's what I've been doing.By the way, I still do it, for example, not in this,but for my lectures,I have a lot of... I'm using a lot of ticksto do graphs and animated graphs.And that's #+begin_export latex#+end_export LaTeX.That's what I'm doing.Not every viewer will play them.so I think there is something called pdfpc that can,this provides a LaTeX packagewhere you can include videos,and then they can be played through that specific program.And JavaScript embedding,that can only be done through Acrobat Reader,which is like also finicky. Sure, yes.But I mean it's always a thing of taking itand trying to see what you can doand what the specifics are.Maybe this can be done with Acrobatand with a couple of extra packages and who knows.And you can always keep it as as LaTeXas fragments inside Org, I think. Any other questions?