So far I have been working exclusively online via Overleaf. But now I would like to switch to working offline as well. I would like my compilation process to mimic the one by Overleaf exactly. I tried to read how does Overleaf compile my project. I saw that it uses latexmk so I went ahead and installed it. (I also have texlive-latex-extra on my machine,running Ubuntu 18.04, if that makes any difference). Now, according to the article I linked I should add that code to latexmkrc file. But I have no such file so I am stuck. If anyone could provide any help it will be much appreciated.

  • Welcome to TeX S.E.! Paste the content of this code to a file and name it .latexmkrc. You should also check if your texlive-latex-extra comes from the same year as the one installed on overleaf.
    – sztruks
    Oct 5, 2020 at 17:23
  • @sztruks My texlive-latex-extra is practically new. I just installed it a couple of days ago. So I assume there's no problem there. I did as you said. Then run latexmk main.tex and got an error which I don't get with overleaf.
    – cgss
    Oct 5, 2020 at 17:33
  • @sztruks The error was actually unrelated so I think you pretty much solved my problem. If you post it as an answer I will gladly accept it.
    – cgss
    Oct 5, 2020 at 17:52
  • overleaf runs texlive2019 (with a specific set of updates) so any texkive is almost identical but you may have slightly different package versions.(overleaf will be updating to 2020 soon for new projects) Oct 5, 2020 at 18:35
  • @DavidCarlisle So unless I am working with a complete new package I will be good either way, is that what you are saying?
    – cgss
    Oct 5, 2020 at 21:23

1 Answer 1


If you don't have any latexmkrc file, open a new file in your $HOME directory, and name it .latexmkrc (if it is in your document directory, may be named either latexmkrc or .latexmkrc, as stated by Johh Collins in comments) and paste settings given in this article there.

  • I accepted your answer but I recommend to edit it to add the dot in front of the filename to be 100% correct.
    – cgss
    Oct 5, 2020 at 21:26
  • latexmk reads both latexmkrc and .latexmkrc, both are correct. Oct 5, 2020 at 21:32
  • @AlexWatson Are you 100% about this? Because I tried with a non dotted file and it didn't work.
    – cgss
    Oct 5, 2020 at 21:50
  • 2
    Actually in the home directory, the filename must have the dot in front of it: .latexmkrc. In contrast, in the document directory that it can be latexmkrc or .latemkrc. Oct 5, 2020 at 23:48
  • Thanks @JohnCollins and sorry about the confusion. Yes, I always put my rc file in the document directory and omit the dot. Oct 6, 2020 at 22:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .