How to use latexmkrc with Overleaf
Hands up if you've heard of a
latexmkrc file? Now keep your hands up if you know what it does. Now keep your hands up if you've ever written your own. Anyone with their hands still up—you probably don't need to read the rest of this post.
Why the interest in
latexmkrc? We've recently had a number of users get in touch to ask how to do certain things with Overleaf, to which our answer has begun: "Firstly, create a custom
latexmkrc file in your project...". Given that this isn't the most intuitive part of LaTeX, and documentation on the web (and examples in particular) are quite sparse, we thought we'd explore it here in a bit more detail.
What is a
If you've never seen it before, a
latexmkrc file is a configuration / initialization (RC) file for the
Latexmk is used by Overleaf to control the compilation of your source LaTeX document into the final typeset PDF file. By using a customized configuration file called
Latexmk you can override the default compilation commands to allow Overleaf to compile your document in a special way.
Why would I want to use a
Well, as an example, did you know that all the dates and times in the PDF compiled on Overleaf are the dates and times of the server’s by default. What if instead you'd like to use your local date/time?
To display the date/time local to your timezone, you can change the
TZ (timezone) environment variable using a custom
- In your project editor window, click on the “Upload” icon on the top of the file tree panel.
- Select “New file”, and name the file
- Add the following line to the file
latexmkrc:or whichever timezone required. Here's a list of supported time zones for reference.
Dates and times (e.g.
\currenttime from the
datetime package) in the PDF should then give values local to the specified time zone.
latexmkrc file is very useful used to debug a project that has fatal errors; read more about that in the Compile timeout help page.
Where can I find more examples of
As a start, check out the following examples from our help pages:
- How does Overleaf compile my project?
- Can I run plain TeX on Overleaf?
- Does Overleaf support pTeX?
- Find fatal compile errors blocking the compilation
- I have a lot of .cls, .sty, .bst files, and I want to put them in a folder to keep my project uncluttered. But my project is not finding them to compile correctly.
- How can I make the xr package work on Overleaf?
- How do I make \today display the date according to my time zone? (that example is re-used above)
If those don't help, please feel free to contact us page or try the popular TeXStackExchange and LaTeXCommunity forums.
- Creating a document in Overleaf
- Uploading a project
- Copying a project
- Creating a project from a template
- Using the Overleaf project menu
- Including images in Overleaf
- Exporting your work from Overleaf
- Working offline in Overleaf
- Using Track Changes in Overleaf
- Using bibliographies in Overleaf
- Sharing your work with others
- Using the History feature
- Debugging Compilation timeout errors
- How-to guides
- Guide to Overleaf’s premium features
- Creating your first LaTeX document
- Choosing a LaTeX Compiler
- Paragraphs and new lines
- Bold, italics and underlining
- Mathematical expressions
- Subscripts and superscripts
- Brackets and Parentheses
- Fractions and Binomials
- Aligning equations
- Spacing in math mode
- Integrals, sums and limits
- Display style in math mode
- List of Greek letters and math symbols
- Mathematical fonts
- Using the Symbol Palette in Overleaf
Figures and tables
- Inserting Images
- Positioning Images and Tables
- Lists of Tables and Figures
- Drawing Diagrams Directly in LaTeX
- TikZ package
References and Citations
- Bibliography management with bibtex
- Bibliography management with natbib
- Bibliography management with biblatex
- Bibtex bibliography styles
- Natbib bibliography styles
- Natbib citation styles
- Biblatex bibliography styles
- Biblatex citation styles
- Multilingual typesetting on Overleaf using polyglossia and fontspec
- Multilingual typesetting on Overleaf using babel and fontspec
- International language support
- Quotations and quotation marks
- Sections and chapters
- Table of contents
- Cross referencing sections, equations and floats
- Management in a large project
- Multi-file LaTeX projects
- Lengths in LaTeX
- Headers and footers
- Page numbering
- Paragraph formatting
- Line breaks and blank spaces
- Text alignment
- Page size and margins
- Single sided and double sided documents
- Multiple columns
- Code listing
- Code Highlighting with minted
- Using colours in LaTeX
- Margin notes
- Theorems and proofs
- Chemistry formulae
- Feynman diagrams
- Molecular orbital diagrams
- Chess notation
- Knitting patterns
- CircuiTikz package
- Pgfplots package
- Typesetting exams in LaTeX
- Attribute Value Matrices
- Understanding packages and class files
- List of packages and class files
- Writing your own package
- Writing your own class