Preparing the LaTeX environment for my undergrad thesis[3]


I am a big fan of LaTeX since high school (thanks, OBMEP, for the gentle introduction and serendipity of this great tool[1]!). Since about ~9 years ago, I am constantly learning something new about it every day, saw its evolution over the years (thanks, TeX.SE, LuaTeX, and friends!), tried it in all major platforms (MikTeX on Windows, TeXLive on Linux and MacOS) and typeset it with almost all available text editors (Kile, TeXMaker, TeXStudio, TeXShop, Notepad++, Vim + latexsuite, Emacs + AUCTeX…)…

That was just to exemplify how much enthusiast I am about it and, as a side effect, how much opinionated I am.

I am about to write the biggest LaTeX project I’ve ever come across: my undergrad thesis[3]. This is big enough in my “LaTeX career” that made me completely rethink about how I usually interact with it:


Before going on…

  • This is not a tutorial. It is just the documentation of the ideas / conceptions and a proof-of-concept arrangement of the steps I did to set up a comfortable writing environment for myself. It may or may not work for you. You have been warned.
  • Microsoft Word is completely out of question.
  • Google Docs might be interesting as a temporary document for the purpose of “code reviews” (how do you call that in the writing world? “Document review”?).

Goals / Design Doc

  • A decent, off-line, LaTeX environment (sharelatex and overleaf are out of question).
  • Spell-checking.
  • Version control.
  • A cross-platform environment (it should work at least on Windows, Linux and MacOS). Honestly I don’t really care about Windows support, but it would be nice to be compatible with it too, at least a little bit.
    • Corollary: it should contain a Makefile (or support a similar build tool).
  • It should use a template specifically intended for an undergrad thesis.
  • Integration with an on-line CI server that automatically builds every commit, yielding the thesis PDF as its output.
  • Builds should be fast, preferably under 5 seconds.
  • LuaTeX support would be welcome.
  • It should use only macros and packages in an standard and typical LaTeX installation. Third-party packages should not be welcome, unless strictly necessary.
  • Bibliography management tool.
    • Bonus: graphical
  • No “typesetting hell” ==> I don’t want to run pdflatex 3 times manually.
  • Synctex support.
  • TODO support from within LaTeX.


  • Git for version control.
  • Bitbucket for private git hosting
  • TeXShop or VSCode as text editor. No vim in this context.
  • latexmk + make as build tool
  • BibTeX as bibliography management tool.
    • Plus JabRef as its GUI editor
  • Bitbucket Pipelines as CI tool.
  • LuaTeX (lualatex) as LaTeX typesetting engine (see this)
  • ChkTeX as linter / semantic checker
  • Docker for container isolation (whoa, a full ‘texlive-full’ installation (Ubuntu) takes a long time to complete!)
  • VSCode with the LaTeX Workshop extension does have synctex support
  • For TODO support, todonotes seems to be really nice.
  • Coppetex as the base template for my document.


As you see, I decided to completely renew my environment and to use everything I learned over these years to make it “on steroids”.

This is by no means required in my college; its expectation bar is kinda low for this task, with lots of people just using Microsoft Word [citation needed]. Here is my opinionated vision: big mistake. We are in 2017, LaTeX is not as hard to use as in the <2000s.

However, I also realize that the {Sys,Dev}Ops approach I am taking to write my LaTeX thesis is way too unnecessary and it contains lots of “bells and whistles” and idiosyncrasies related to the thinks I currently like to do. That said, I strived to keep it KISS and I’m really proud of its result.

I will probably release my [environment] / [template repo] publicly on GitHub once I am done. Now I should focus on writing, actually writing.

I might also create a tutorial (as a complement to this post) once I am done, conditionally to the number of people interested on this. Let me know if you’re interested. Something such as “What do you need to know to write your undergrad thesis in LaTeX – KISS version”.



  • [1]: LaTeX is not just a tool. It is a thought and writing philosophy. It is almost a religion, just like Unix / Linux, and…systemd[2], of course.
  • [2]: I should probably start a new article in Wikipedia. Just like Godwin’s Law, there should also be a “Perrotta’s Law”:

“As an online discussion or article grows longer, the probability of a paragraph mentioning systemd approaches.”

  • [3]: I really don’t care how people call each of the documents, depending on its level. Whether it is “monografia” (monograph?), dissertation or thesis, whatever. I call everything “thesis”. Therefore, despite not being a doctor, I will write a thesis, period.
Preparing the LaTeX environment for my undergrad thesis[3]

Russian / Ukrainian music

Recently I’ve fallen in love with a set of Russian and Ukrainian music, mostly pop, dance, R&B and hip-hop. This post aims to contain a small (but updated on-the-fly) index of artists, duos and bands with the purpose of representativeness and to provide the reader a good starting point to know what I’m talking about.

Note:, YouTube and Spotify are good resources to find out more information about them. VK also seems to be a pretty popular Russian social network, and discogs contains a good catalogue / index (Discogs is to artists and tracks what Goodreads is to authors and books).

Note: the order of the following list does not necessarily imply preference, although Nyusha is definitely my preferred one.


  1. Нюша / Nyusha:
  2. Тамерлан И Алена / Tamerlan & Alena :
  3. Полина Гагарина / Polina Gagarina:
  4. Artik & Asti:
  5. Elvira T:
  6. Потап И Настя Каменских / Potap and Nastya Kamenskih
  7. Алсу / Alsou:


  • Akinator managed to find out, after ~60 questions, that I was thinking on Nyusha.

Screen Shot 2017-05-07 at 01.01.22.png

  • Nyusha participates in the Russian version of The Voice Kids.
  • Polina Gagarina participates in the Russian version of The Voice.
Russian / Ukrainian music

Journalog #3: eudyptula – challenge #1

This is not really a challenge; I’ve done it before. Anyways, now I have the insight about what’s happening behind-the-scenes, and also it’s very easy to recreate the environment and obtain the tools I need to do it.

The first challenge is very simple, as rephrased in my own words:

Write a hello world linux kernel module for your current kernel (supposedly 2.6+), which writes “Hello World!” to your kernel debug log level, upon its initialization.

Tools and programs you’ll need: vim, make, insmod, lsmod, rmmod. And, later on, mutt or sendmail or similar to send your work to little.


It’s better to start with the Makefile. Add at least two targets to it: all and clean. Refactoring variables (for example, paths) is also nice, if you see yourself repeating the same strings in both targets.

Later, you will create a hello.c file which should be very simple in nature. It should have two functions, one for initialization and one for cleanup for the time the module is unloaded. It will probably also have a couple of standard macros for modules.

Testing your work should also be very straightforward: (i) make, (ii) insmod hello.ko, (iii) rmmod hello. And see your log messages with dmesg | tail.

After everything is done, you can use mutt to send your sources to little, either interactively (hint: use ‘a’ to add attachments) or with a single command:

mutt -s "<id> challenge 1" -a hello.c -a Makefile < <message>

where <message> is a file corresponding to the body or your email.


Journalog #3: eudyptula – challenge #1

Journalog #2: cryptopal

Little is dead. Probably. Whatever. My shitty mutt setup won’t have enough patience to wait for its reply, so I am moving on to another challenge.

But before, here is a quick pause to talk about setting up email clients: who cares??? Once upon a time, a few mistakes and years ago, I would find pretty awesome to have a decent mutt/alpine setup. Nowadays, this is pretty much useless, unless you also talk to other people with the same setup. For example, it is probably a paradise to use mutt to send emails to LKLM or to cool wizards like Eric Raymond or Richard Stallman, or even to the next g{uy,irl} replying to your comment on Hacker News. For now, I think Inbox is becoming more and more awesome. Disclaimer: this is not an ad, it’s just a personal recommendation from a guy that never lets its inbox have more than fifty unread emails (it all comes down to the whole debate between the oldieeee spam-fuck-off-from-my-mailbox and oh-your-email-is-super-relevant-cmon-lets-talk).

–> Cryptopals <–. Don’t expect me to duplicate information here, click in the link and see it by yourself. It’s basically a set of challenges about cryptography, in the same style of the eudyptula challenge. Theoretically, you don’t need any (prior) crypto experience to start with.

I would really like to learn Rust and to use that knowledge to solve these challenges, or alternatively Clojure and next-gen-Python. However, I don’t have much commitment to do this at the moment; I’d rather give it a shot with my wannabe C/C++ code.

If all goes well, then possibly a series of posts will follow with comments on each of the challenges. If not, then…what? Nobody will notice it anyway; everybody is busy out there trying to catch pokemon and/or watching Friends. Kinda reasonable, depending on your point of view.

So…here comes the nerdy stuff.


I should stop using the word journal. But here’s how I approached the challenge (you can do it in 5 minutes with your tricky Ruby/Python/Perl; you don’t need to read my poor adventures in C/C++. But it’s all about the experience; I’d rather spend one week in a single problem but get mostly everything out of it and document my thought process, rather than…(?)…blah):

Challenge 1, set 1: convert hex to base64. OK. Hex, not integer/ascii/char/byte. I struggled to get that. It’s actually kinda simple, but most converters you will find out there (including the base64 program available on OS X and on several linux distros) will assume your input is in ASCII.

So, no no no. Don’t you even dare to do a shitty system(“base64 <blablabla>”) call.

The first thing I did was to actually read how to convert from <blah> to base64. The process is really simple to understand (hint: Wikipedia), especially after you try it yourself with two or three examples. It does not really matter whether your input is in decimal/ASCII or hex; but hex is easier to manipulate.

Things that help:

  • bitwise operat{ors,ions} (especially <<, >> and &).
  • several helper functions (bonus: to do it in a functional language, it should be probably very elegant if it is well coded and idiomatic)

I decided to code and run everything within CRUX with vim and without any plugins, even my .vimrc file. Plain/vanilla stuff.

Here is the first working version of my code. Warning: coded after 1am. I am going to improve it until the weekend; more on that later.

….ooooops. Damn, I have a CRUX under VMWare. How do you expect me to copy the code to this blog? I don’t have a X server, I don’t want to install VMWare extensions, I don’t want to take a screenshot of the code (eeergh).


This code is really bad :/

I will fix it before going to the second set. And that’s it for {the ,to}day.

Journalog #2: cryptopal

Journalog #1: eudyptula

I have no idea if it’s still alive, but I want to participate in the eudyptula challenge again. Last time I did it was probably a little less than 2 years ago, and I was still playing with with Arch at the time.

I am using OS X this month, which screws the whole thing from the beginning. I have to use a virtual machine then. VMWare Fusion is already installed in my system, so whatever. I have to grab a Linux box now. Heck…something very lightweight, no-frills. First thing that comes to mind: CRUX. Yeah, it’s you baby.

ISO file is ~400MB in size. I said lightweight, not small. Installation process is cool.

Screen Shot 2016-07-12 at 9.08.22 PM5 min or so and everything is properly set up. Bootloader, fstab…nothing fancy. CRUX uses LILO (I forgot about that!), but this is a simulated BIOS system anyway (in VMWare), so TO /dev/null, mister GRUB2! And you then reach a few seconds of enlightenment, away from the 21st century. systemd? Xorg? What’s that? OK, there are some btrfs packages laying around. Still!! What? The folks at (no hyperlink. Go figure.) have a point.

Serendipity: it turns out some people really take this seriously.

All set, rebooting. Let’s work!! I am going to do everything as root, I don’t care. Screw. It’s 2016, virtual machines do have snapshots, bae.

I need to send one plain text (non-HTML) email to start the challenge. That’s all. So I need to grab mutt. I don’t care about sendmail, mail, fetchmail, whatever; so I will need a TUI to do basic stuff. Yah, I know, mutt will use sendmail behind-the-scenes, whatever.

This leads me to…package management. How to install mutt? Heck, no apt-get, yum, pacman. I chose CRUX, now I pay for that, right?? Not really. CRUX has a very basic ports/package management system, I’d compare it to OpenBSD. Hopefully, mutt is going to be present there. It is. So…1 or 2 min reading its handbook and it turns out all I need is

ports -u && prt-get install mutt

Cool. Now here comes the PITA stuff. I have to get a very basic ~/.muttrc. Well, it would be a PITA if we were in the 2000s, but no one cares about man pages anymore(1). Stack Overflow and hippie blogs are the way to go. So a quick Googling here and there leads me to a basic IMAP + SMTP mutt setup with my email provider.

…er, no. Grrrrrr. Mutt does not recognize smtp. Whaaat?! It turns out the default mutt from CRUX is not compiled with smtp enabled. You gotta be kidding me. Okay, let’s compile it from source with the correct flags. I would usually probably take 20+ minutes to figure this out, but I think after all these years playing with linux distros I learned something. It took me less than 3 minutes to go to /usr/ports/opt/mutt and edit the Pkgfile over there, then run pkgmk and finally pkgadd -u to install it. I didn’t have any prior knowledge of this stuff, it was mostly a matter of Cmd-F’ing the handbook webpage and introspecting (=a fancy word for trial-and-error) the command line.

OK, mutt is now installed. WITH SUPPORT FOR EVERYTHING I NEED, damn it. Now…let’s log in. Cool, it works. Actually…my email provider (Google, yaaay) tells me I am logging in from an insecure app, and thus it blocks my login attempt. Aaaaaaaa….ok, I like this feature! But I temporarily disable it (note to self: re-enable it later, you security freak creature!).

Test #1: hello world email sent back to myself. OK, my phone rings. In fact, twice. Leave me alone, I am migrating my apps, I have more than one email client installed on it. You never did that?! Well…everything’s working, so I just send an email to little@eudyptyla.

And this is supposed to be a happy ending. For today. Except that…maybe this challenge does not even exist anymore. I hope it does, I really want to do it. Time is key.

Screen Shot 2016-07-12 at 9.35.04 PM.png


(1) man anymore: this is my first footnote. For more information, see anymore(8).

Journalog #1: eudyptula

Community Ethos

I don’t know how to name this post. These are a couple of resources I think every user that participates in online communities should know about — or, at least, become aware of:

Community Ethos

From OS X to Arch Linux: Part #5: Prelude

Booting to other operating systems

TL;DR: just hold the Option (Alt) key while booting.

Yeah, you’ve read it right: the title is not wrong. I intend to install Arch Linux on a Mac, by optimizing these conditions:

  • the primary operating system of the Mac should be OS X
    • Implication #1: most of the disk space is gonna be allocated to OS X (in fact, I’ll reserve only 16 GB to my Arch system; my SSD has 256GB).
    • Implication #2: most storage will be done on OS X (movies, pictures, etc). In fact, most web browsing will be done on OS X too. Arch is gonna be useful to (for example) access connections that require more security (e.g. bank accounts), CTF stuff, hardcore low-level programming stuff (haha).
    • Implication #3: most desktop programs will be installed on OS X only. This includes, for example, audacity, VLC, etc. This Arch will be a lightweight system, with just low-disk usage apps. It will almost look like a Chrome OS, except that I’m not using it just for web browsing, but for several Linux stuff that I like. Hobby is a thing, ya see.
    • Implication #4: grub is not taking control of this machine. Neither systemd-bootd. I’ll stick to the default bootloader from the Mac / OS X. In this case, I’ll just have to hold the Option (alt) key during the initialization whenever I want to boot into Arch.
  • Arch should not interfere with OS X and vice-versa
    • Though I’ll make some experiments about OS X trying to access Linux filesystems (ext4 and/or btrfs likely) and Linux trying to access OS X filesystems, the final purpose is for each system to be quiet and don’t fiddle with the other. This means: no /etc/fstab mounts with the neighbour OS. Also, just read-only mounts while testing, for the sake of stability of both systems.
  • Purpose
    • compare battery consumption
    • analyze the experience of using Arch in an Apple hardware
    • <and etc, all the stuff you already know about the Arch way and so>
    • and, of course, this is my way to still keep connected with the Arch community, at least every now and then


When I have time I’ll write more about this. And there are still things to be done on OS X itself.

Update (2015-09-17): I’ll probably stop this series for a while. A while might last several days, weeks or months. But the good thing is it’s not finished (yet)! =P

From OS X to Arch Linux: Part #5: Prelude