Beginners (La)TeX best practises for writing large documents (e.g. thesis)

Some best practises that I have learned when writing my thesis using ((Xe)La)TeX typesetting system – for the first time.
Meaning these are things that I have learned hard way.

1. You will need to manage bibliography. DO NOT USE Mendeley (closed source), use e.g. Zetero (open source). This doesn’t have tons of problems….

1.5 Under no circumstances try to move by the end of your Tex work into a different system. Even if you choose one wrongly. Stick with it. But do regret your choice !!!

2. Start reading this stackoverflow post. A must do.

3. Choose biber + biblatex (not natbib or “natbib=true”). Use textcite(s)/parencite(s)

4. Use xelatex engine because you can use extra fonts. pdflatex cannot do that.

5. If mathematics included, then load 5 packages: \usepackage{amsmath} \usepackage{amsxtra} \usepackage{amsthm} \usepackage{amssymb} \usepackage{amsfonts}

6. Use xcolor (not color) and graphicx (not graphic)

7. listing for source code use examples

8. dtk-logos for logos of XeLatex, etc.

9. marginnote for margin notes on the side

10. nth for “2nd” (stackoverflow)

11. longtable for tables over several pages

12. Do not use makecell, longtable often enough

13. minted for source code -> however use very sparse because of long compile time

14. consider using microtype however with xelatex still very limited

15. use geometry instead of something else for page layout: it is transparent and easy to use

16. Still applies Still very much applies

17. consider using KOMA script: link, link

18. for acronyms do not use “acronym/ac/acro” package but use glossaries

19. take a deep look on when to use which document class and when it is right doubleside/oneside. When used with margins, it will bite you twice later.

20. Use hypersetup to display pdf with metadata/views, etc.

21. (Subjective) Use — instead of one long – or three —

22. Use emph{} for italics

23. Escape dots -> e.g.\

24. Use \dots instead of …


New idea for software ecosystem research

Analyse Python ecosystem according to following DOI: 10.1016/j.jss.2017.06.095 (see local pc)

Displaying HTML in Excel cell

Recently I was tasked with coming up with an idea of how to display HTML tags inside an Excel sheet which were in the rows of 1 column. It had to be done automatically with a click of a button (i.e. conversion of each HTML cell into properly formatted cell that displays HTML content with applied styling) and of course VBA had to play a role in it. (Full disclosure: Idea borrowed from here)

Well, after a lot of trials & errors, here is the general idea & code: For each cell in the column we first open Internet Explorer and navigate to “about:blank” (blank page). Then, we ‘copy’ the cell’s content to such blank page and ‘select all & copy’ the content into the clipboard. From there, we read it again and paste it into the same cell from which we have first copied it.

It might sound fairly complicated because……it is. Plus, one clear disadvantage is that if, during time the macro is executed, anything is copied to clipboard by the user, it will 1000% lead to inconsistent results. And this is not even to talk about speed.

Warning: The code below can take up to 4 minutes with 250 rows to execute. This is intentional because if there is no “Wait()” then for some reason it again leads to inconsistent results (e.g. where the same row will be copied up to 4 times -> 4 rows with same HTML content)

Before you will be able to execute this VBA macro, read this website on how to load “Microsoft Forms 2.0 Object Library”.

Other sources which have been used

Sub DisplayHTMLContentProperly()
Dim rng As Range
Dim row As Range
Dim cell As Range
Dim Ie As Object
Set Ie = CreateObject("InternetExplorer.Application")
Ie.Visible = True 'to be tested
Dim DataObj As MSForms.DataObject ' for clipboard
Set DataObj = New MSForms.DataObject

Dim sht As Worksheet
Dim LastRow As Long
Set sht = ThisWorkbook.Worksheets("SheetName")
LastRow = sht.ListObjects("DataName").Range.Rows.Count

Set rng = Range("L2:L" & LastRow)

For Each row In rng.Rows
For Each cell In row.Cells

Application.CutCopyMode = False
myString = " "
DataObj.SetText " "

If Not IsEmpty(cell) Then
With Ie
.Visible = True
.Navigate "about:blank"
While .Busy Or .ReadyState 4: DoEvents: Wend
.Document.body.InnerHTML = cell 'update to the cell that contains HTML you want converted

.ExecWB 17, 0 'Select all contents in browser
.ExecWB 12, 2 'Copy them

'get data from clipboard (due to copy method above) and paste it into the cell
myString = DataObj.GetText(1)
'MsgBox myString - to debug
cell = myString

'delete anything from the clipboard
Application.CutCopyMode = False
DataObj.SetText " "

End With
End If
'Do Something
Set HTML = Nothing
Application.Wait (Now + 0.000000011574 * 1200)

Next cell
Next row

Set Ie = Nothing
Application.CutCopyMode = False

MsgBox "I am now done with proper formatting of HTML column."

'move to see just summary page

End Sub

Flashing Rom on Xiaomi Redmi 4 Prime

So my recommendation after reading tons of articles is to follow this video.

Essentially there are 2 ways how to move from a custom/vendor ROM to ROM. The method which is being used here in the video is to use the Chinese version of PC Suite and the recovery ROM.

  1. The video assumes the device is bricked but if it is not then it is enough just to turn the device into a recovery mode and use a (recovery) rom. To sum up, “flashing recovery ROM using Chinese version of Mi PC Suite in recovery mode.”
  2. Once done the second step is to unlock bootloader. Again the Chinese version helps. But this time I had to click twice, to unlock it.
  3. Download TWRP by cofface and follow its guidelines. End TWRP with “fastboot reboot” from command line.
  4. Lastly flash EU ROM using this.
  5. WIN

Other links:

Redmi 4/Prime/4A thread:




[MIUI DEVICE TEAM] Flash / Unbrick Redmi 4/Prime/4A:

Bootloader Unlock – Solution for Redmi 4 Pro/Prime (unlocking stuck at 50%):

RedMi 4 Prime/Pro Twrp recovery:

Stable & Dev Rom:


SAS code for replacing missing values with 0 in a folder full of datasets

%macro loopOverDatasets();
/*imho good practice to declare macro variables of a macro locally*/
%local datasetCount datasetName iter inMember;

/*get number of datasets + name of datasets*/
proc sql noprint ;
select count(*)
into: datasetCount
from dictionary.tables
where libname = “EXAM”;

/*initiate loop*/
%let iter=1;
%do %while (&iter.<= &datasetCount.);

proc sql noprint;
select memname
into: datasetName
from dictionary.tables
where libname = “EXAM” and monotonic() eq &iter.;

%put &iter &datasetCount &datasetName &inMember;
/*now you can apply your logic to the dataset*/
data &datasetName.;
set exam.&datasetName.;
array change _numeric_;
do over change;
if change=. then change=0;

%let iter=%eval(&iter.+1);