-1

I have an Overleaf project with two tex files like below:

main.tex

\documentclass[anonymous]{}
...
\begin{document}
\maketitle
...
\end{document}

review.tex

\documentclass[anonymous]{}
...
\begin{document}
\maketitle
...
\end{document}

These files are unrelated; they use different styles and don't share any extra documents. Now, I want to generate 2 different PDFs from each of them.

Since I'm using Overleaf, the perfect scenario should be to select the document, click on "Recompile," and get each PDF. However, it's not so simple.

How can I do it? It should be done in Overleaf.

I found 2 solutions here: The first didn't work (compilation error with more than 100 error messages), and the second cannot be done in Overleaf, I guess.

Overleaf help page informs that it should work, so I guess I'm doing something wrong, but I don't know exactly what.

James
  • 101
  • @DavidCarlisle This is indeed an option, but I want to know if it's possible to do the same project. Since it is apparently possible in other Tex editors, using Overleaf should also be possible, right? – James Jan 23 '24 at 12:30
  • overleaf help page says: Note 1: Any file that contains a \documentclass command, even if it's not designated the "main document", will be compiled if it's opened in the editor when you press the Recompile button. – David Carlisle Jan 23 '24 at 12:37
  • I forgot to mention that I also found this page, but it simply does not work, so I considered that I lost some information and I should configure the project differently. That's the reason for my question. – James Jan 23 '24 at 12:43
  • On the more than 100 errors, you are right, but pasting the full error log here doesn't make sense to me. What I mean is that with this amount of errors, the proposed solution is not good for my scenario. – James Jan 23 '24 at 12:46
  • 2
    it should work, but as you haven't shown any real source code or any indication of the error you got, it's not really possible to help. just open the file and click recompile. Of course if the tex document has errors it may fail unrelated to having multiple files. How can anyone guess? – David Carlisle Jan 23 '24 at 12:47
  • 2
    "this amount of errors" does not mean anything, you may just have one error no later error message is relevant. You have a tex document that you have not shown that generates an error message that you have not shown, and you are asking how to fix it..... – David Carlisle Jan 23 '24 at 12:48
  • 1
    (Tom from Overleaf Support here) Sorry, the solution provided by David C. at https://tex.stackexchange.com/questions/681936/overleaf-compiling-multiple-tex-files-into-multiple-outputs-alternatively-n/681941#681941 probably didn't work. I edited that one and now it should work well. And this is really the same question. – yo' Jan 23 '24 at 14:06
  • 1
    Maybe helpful to add that you can find the separate pdf files using the button Logs and output files (next to the Compile button) and then in the bottom right Other logs and files. – Marijn Jan 23 '24 at 14:41

1 Answers1

3

You do not have to do anything special at all, overleaf will detect the documents have \documentclass and compile the document to a pdf if it is open when you hit recompile.

A two document project

https://www.overleaf.com/read/tyvwwqhnqsqg#50775f

has two documents

one.tex

enter image description here

\documentclass{article}

\title{doc one} \author{d.p.carlisle } \date{January 2024}

\begin{document}

\maketitle

\section{Introduction} some text in a document \end{document}

and

two.tex

enter image description here

\documentclass{article}

\title{doc two} \author{d.p.carlisle } \date{January 2024}

\begin{document}

\maketitle

\section{Introduction} some text in a document \end{document}

Of course if there are errors in the document, then errors may be reported, but that is unrelated to having multiple files.

David Carlisle
  • 757,742
  • With the example, I'm finally able to find my error. The "anonymous" category I used in both documents only exists in one. Indeed, this error message was not evident in the Overleaf interface. – James Jan 24 '24 at 10:41
  • 1
    @James overleaf always makes the full log available, you can find error messages theer even if it doesn't show in the top level GUI summary of errors – David Carlisle Jan 24 '24 at 11:17
  • 2
    @James if you had provided a real example in the question rather than {} for the document class name, the cause of the error would have been easy for anyone helping to debug – David Carlisle Jan 24 '24 at 11:28
  • Now I see it. I'll keep it in mind in my next questions. – James Jan 25 '24 at 10:37