I am using the Tex to store my own notes, specifically with the Sharelatex website. I have set everything up in the following way with the standalone package:

I have a preamble.sty file that begins like this


% The rest of the file has \usepackage and \newcommand instructions

Then, I have all of my notes are in different files "topic_name.tex" and begin like


% Document %


I do this so that I can edit my macros and settings in one place instead of having to do it over and over again for many files. I use the standalone package so that I can combine the notes together into a single document if I want, but this question concerns only compiling the files of the form above.


When I try to compile a document, I will periodically get the error message

Extra } or Forgotten \Endgroup

\usr\local\texlive\2017\texmf-dist\tex\latex\standalone\standalone.sty line 543

If I just wait a little while or try compiling other projects and then hit compile again, the issue usually just goes away and everything works. This has been going on for months. But the larger my notes get, the more it seems to happen. Finally, today, my document will no longer compile and always produces this message.

Since I didn't write the standalone.sty file, I don't know how to fix the error. If there is any additional information that is necessary to answer the question please let me know. Also, I apologize if this is too Sharelatex specific to be appropriate for this website, but I do not know where else to ask about this problem.

  • Can you provide a complete yet minimal code example that can actually be compiled without additional information/code (have a look at * filecontents* package to do so)? And indeed, that (your problem) seems strange! – Dr. Manuel Kuehner Nov 11 '18 at 13:52
  • 1
    @Dr.ManuelKuehner I will try. It's very difficult because the compiler seems to work or fail randomly, from my perspective. – user3281410 Nov 11 '18 at 14:00
  • For example, when I try to delete parts of the file that does not compile in order to find what part is causing the problem, it eventually compiles if I delete enough. But then when I paste what I deleted back, it still compiles (and says no errors, good job). – user3281410 Nov 11 '18 at 14:06
  • Sometimes there are errors that are located in auxiliary files that are generated when you compile the document. For example stuff in \section{} and so on. Maybe this is also the case in your example. If you are able to generate a so-called MWE that I am sure that the experts here can help you. – Dr. Manuel Kuehner Nov 11 '18 at 15:32
  • Have a look here tex.meta.stackexchange.com/questions/228 and search the website for 'filecontents'. – Dr. Manuel Kuehner Nov 11 '18 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.