I have an Overleaf project that contains multiple .tex files to create different PDF documents. If I compile one of the .tex files and download it, it is named after the Overleaf project. Currently, if I want the PDF file to have the same name as the corresponding .tex file, I have to rename the PDF file after downloading. Is there a way to make Overleaf change the PDF filenames to the names of the .tex files they are created from? Say, I have doc1.tex and doc2.tex. My goal is that when I download the PDF file for doc1.tex the PDF file is named doc1.pdf and when I download the PDF file for doc2.tex the filename is doc2.pdf.

My approach is to create a custom latexmkrc file. When I add the following line to Overleaf's default latexmkrc file, the compilation works.

$pdflatex = 'pdflatex -shell-escape -file-line-error --synctex=-1 %O %S ';

But appending -jobname=newfilename to this line does not change the name of the PDF file when I download it.

What is the problem here or is there a better approach?


2 Answers 2


(Tom from Overleaf Support here.)

If your different TeX files are called e.g. first.tex and second.tex, you can achieve having first.pdf amongst the output files so that when you download it, it will be called this way. Note that this is unfortunately not really straightforward; we didn't really intend a single project to be used that way with a lot of downloading of the PDFs for different documents within the project.

Anyway, to achieve the above, you can make a file called e.g. make_first.tex with contents:

\ShellEscape{latexmk -pdf first}

If needed, you can switch -pdf to -lualatex or -xelatex to change the compiler. You can have a similar setup for any of the documents within the project.

However, first.pdf is only shown among the "Logs and Output Files" in the current UI. If you want to reach them better you can opt in for our Beta Program to get a new UI that's currently being finalized and that makes it easier to reach the output files. (This is current as of April 2021.)

  • Neat trick, Pasting the lines \ShellEscape{latexmk -pdf first} and \includepdf[pages=-]{first.pdf} multiple times for different .tex files even one "make" file is sufficient. Thanks.
    – upe
    Apr 26, 2021 at 17:03

A simpler way is to right click on the "download" button (it is to the right of compile) and choose the name of where to save it.

  • 2
    Thanks for your answer. In my browser (Firefox 98.0.1) I need to right-click the download button and select Save Link As... to open the desired save-file dialog. Maybe a screenshot or mentioning which item to select in the right-click context menu could improve your answer.
    – upe
    Mar 22, 2022 at 18:20

You must log in to answer this question.

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