TransWikia.com

Problem with standalone in Overleaf

TeX - LaTeX Asked by question on December 14, 2020

I am trying to write a template for my homework using the package standalone for every exercise, since they can get really long and I want them to compile fast (since I use overleaf with my colleagues), otherwise I would have to always compile the whole file, which can take some time. I wrote a template and it works but sometimes, when I copy it into a new projekt, I get errors. I managed to find out, that they happen because of [subpreambles=true] in the main tex document, if I leave that, the errors disappear and everything works fine, but I could get a problem if I need to include some older files someday, so I need to use subpreambles. The strange thing is, that this error only happens sometimes. If I delete the project and start a new one with exactly the same code, it works sometimes completely without problems (and if it works once, then it works all the time). Does anyone know, what causes this problem, or could this be a problem of overleaf?

Here comes all my code and the errors. If have a main.tex, this is the code:

documentclass[a4paper,11pt]{article}

usepackage[subpreambles=true]{standalone}
usepackage{import}
usepackage{fullpage}
usepackage[utf8]{inputenc}
usepackage[ngerman]{babel}
usepackage{ifthen}
usepackage{amsmath}
usepackage{amssymb}

newcounter{aufgabe}
renewcommand{theaufgabe}{arabic{aufgabe}}

newcommand{diff}[2]{frac{d#1}{d#2}}

newenvironment{aufgabe}[1]
{smallskiprefstepcounter{aufgabe}textbf{Lösung zu Aufgabe~theaufgabe:}newlinevspace{#1}}
{par hspace*{fill}$square$medskip}

begin{document}
    allowdisplaybreaks
    setlength{parindent}{0pt}
    setlength{baselineskip}{1baselineskip}
    
    1.12.2020 hfill Namen einfügensmallskip
    
    setcounter{aufgabe}{24}
    
    begin{center}
        {largeunderline{Beliebiges Fach - Übungsblatt 7}}
    end{center}medskip
    
    begin{aufgabe}{-0.5cm}
        import{aufgaben/}{aufgabe25}
    end{aufgabe}
    
    clearpage
    
    begin{aufgabe}{-0.5cm}
        import{aufgaben/}{aufgabe26}
    end{aufgabe}
    
    clearpage
    
    begin{aufgabe}{-0.5cm}
        import{aufgaben/}{aufgabe27}
    end{aufgabe}
    
    clearpage
    
    begin{aufgabe}{-0.5cm}
        import{aufgaben/}{aufgabe28}
    end{aufgabe}

end{document}

Then I also have a folder called aufgaben, which holds the files aufgabe25.tex,…, aufgabe28.tex. They all have the same code, that is

documentclass[class=article, crop=false]{standalone}
usepackage[subpreambles=true]{standalone}
usepackage{import}

usepackage{fullpage}
usepackage[utf8]{inputenc}
usepackage[ngerman]{babel}
usepackage{latexsym}
usepackage{amssymb}
usepackage{enumerate}
usepackage{ifthen}
usepackage{amsmath}
usepackage[hidelinks]{hyperref}
usepackage{listings}
usepackage[dvipsnames]{xcolor}
usepackage[framemethod=tikz]{mdframed}
usepackage{bbm}
usepackage[most]{tcolorbox}
usepackage{needspace}

usepackage{silence}% Filter out unwanted warnings and error messages
% Remove all warnings issued by LaTeX that starts with
WarningFilter[todo]{latex}
  {Reference }                      % 'Reference ' and
WarningFilter[todo]{latex}
  {There were undefined references} % 'There were undefined references'

ActivateWarningFilters[todo]% Activate the 'todo' warnings filter

begin{document}

    newcommand{R}{ensuremath{mathbb{R}}}
    newcommand{cunderline}[2]{textcolor{#1}{underline{textcolor{black}{#2}}}}
    newcommand{bunderbrace}[2]{ensuremath{begin{array}[t]{@{}c@{}} underbrace{#1} #2end{array}}}
    newcommand{uproman}[1]{uppercaseexpandafter{romannumeral#1}}
    newcommand*{mybox}[1]{framebox{strut #1}}

    allowdisplaybreaks
    setlength{parindent}{0pt}
    setlength{baselineskip}{1baselineskip}

    Start here...

end{document}

Maybe it looks a bit messy, but I need all the packages. Note that I use the silence package to be able to reference math from other exercises since I do not want to deal with all the warnings when compiling the exercise files.

I cannot post the log file since it has to many characters and I looks like spam for this forum, but all errors come from the standalone package.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP