# The latexmkrc file

Overleaf uses a Perl-based tool called **`LatexMk`** (LaTeX make) to compile your project. This tool allows you to provide a special file named **`latexmkrc`** that can customize how the compile process is run.&#x20;

In some cases, a `latexmkrc` file is needed in a project in order to set a variable value for the LatexMk process, or to add extra steps to the compile process.

## Example: setting the time zone

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 time zone, you can change the `TZ` (time zone) environment variable using a custom `latexmkrc` file:

1. In your project editor window, click on the **Upload** icon on the top of the file tree panel.
2. Select **New file** and name the file `latexmkrc`.
3. Add the following line to the file `latexmkrc`:

   ```perl
   $ENV{'TZ'}='Canada/Central';
   ```

   or whichever time zone is required. Here's a [list of supported time zones for reference](http://php.net/manual/en/timezones.php).

Dates and times (e.g. `\today` and `\currenttime` from the `datetime` package) in the PDF should then give values local to the specified time zone.&#x20;

## Example: setting the `TEXINPUTS` variable

Another practical use of the `latexmkrc` file is to add additional paths to the `TEXINPUTS` environment variable, see: [adding-latex-dependencies](https://docs.overleaf.com/managing-projects-and-files/adding-latex-dependencies "mention").

## Overleaf’s LatexMk file

Overleaf’s “system-wide” configuration file follows LatexMk conventions (for Linux): it is named **`LatexMk`** and is located in the folder `/usr/local/share/latexmk/`. **Note**: this file is read *before* any user-level configuration files.

User-level configuration files must be named `latexmkrc` and added to your Overleaf project to provide custom rules addressing the specific requirements of your Overleaf LaTeX project/document.

Overleaf’s `LatexMk` file contains code for Overleaf-specific processing plus rules for glossaries, nomenclature, and other commonly used packages. Overleaf’s `LatexMk` file may show some variation between releases of TeX Live to accommodate changes and updates made to packages and software tools within TeX Live itself.

### How to view a copy of Overleaf’s `LatexMk` file

The following link opens a project to typeset the  Overleaf `LatexMk` file being used with your project’s LaTeX compiler and TeX Live version and also makes it available for download:

```latex
\documentclass[a4paper]{article}
\usepackage[margin=1cm]{geometry}
\usepackage{verbatim,shellesc}
\ShellEscape{cp /usr/local/share/latexmk/LatexMk ./LatexMk}
\begin{document}
\section*{About this project}
This project provides access to the system \texttt{LatexMk} initialization (configuration) file used by Overleaf.  \texttt{LatexMk} is a Perl script which may vary slightly according to the \TeX{} Live version and compiler chosen for the project. If you need to be 100\% certain which  \texttt{LatexMk} is being used, add code from this project to your project and compile to typeset a listing of \texttt{LatexMk} and make it available for download as one of the output files.
\section*{Listing the \texttt{LatexMk} file}
\verbatiminput{./LatexMk}
\end{document}
```

[Open this code in Overleaf.](https://www.overleaf.com/docs?engine=\&snip_name=Display+Overleaf+latexmkrc+file\&snip=%5Cdocumentclass%5Ba4paper%5D%7Barticle%7D%0A%5Cusepackage%5Bmargin%3D1cm%5D%7Bgeometry%7D%0A%5Cusepackage%7Bverbatim%2Cshellesc%7D%0A%5CShellEscape%7Bcp+%2Fusr%2Flocal%2Fshare%2Flatexmk%2FLatexMk+.%2FLatexMk%7D%0A%5Cbegin%7Bdocument%7D%0A%5Csection%2A%7BAbout+this+project%7D%0AThis+project+provides+access+to+the+system+%5Ctexttt%7BLatexMk%7D+initialization+%28configuration%29+file+used+by+Overleaf.++%5Ctexttt%7BLatexMk%7D+is+a+Perl+script+which+may+vary+slightly+according+to+the+%5CTeX%7B%7D+Live+version+and+compiler+chosen+for+the+project.+If+you+need+to+be+100%5C%25+certain+which++%5Ctexttt%7BLatexMk%7D+is+being+used%2C+add+code+from+this+project+to+your+project+and+compile+to+typeset+a+listing+of+%5Ctexttt%7BLatexMk%7D+and+make+it+available+for+download+as+one+of+the+output+files.%0A%5Csection%2A%7BListing+the+%5Ctexttt%7BLatexMk%7D+file%7D%0A%5Cverbatiminput%7B.%2FLatexMk%7D%0A%5Cend%7Bdocument%7D) After compiling the project above, the `LatexMk` file can be downloaded via the **Logs and output files**, see: [generated-files](https://docs.overleaf.com/navigating-in-the-editor/generated-files "mention").
