2

So I made a copy of a report template that was shared with me, and my copy will not compile, whereas the project I copied compiles just fine. This is the first error I get:

 /usr/local/texlive/2019/texmf-dist/tex/latex/subfigure/subfigure.sty, line 124
LaTeX Error: Command \c@lofdepth already defined.

Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.124 \newcounter{lofdepth}

Your command was ignored.
Type  I <command> <return>  to replace it with another command,
or  <return>  to continue without it.

I have no idea where the file the error is reading is even located so I'm rather confused.

4
  • 1
    Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Alessandro Cuttin Feb 3 '20 at 16:51
  • 3
    Welcome to TeX.SX! The subfigure package is deprecated and you should not use it. Try subcaption instead. I would guess you are loading subfigure after loading tocloft (both packages define that counter), but there's no way to tell for sure without seeing at least your preamble. Please show us a compilable example of your document. – Phelype Oleinik Feb 3 '20 at 17:25
  • 3
    (I'm on support staff at Overleaf.) Hi, this can sometimes happen when copying an Overleaf project, because existing projects use the TeX Live version that was current when the project was created (to avoid the output changing when we update TL on Overleaf), but new copies of projects will use a newer TL version (to discourage use of outdated packages) if available. This can lead to this behavior, if the packages you use have changed. If you write us at support@overleaf.com with the original and the new project's URL, we can manually set the TL version for your new project to match the old. – Paul Gessler Feb 3 '20 at 20:07
  • Overleaf recently released a new feature to allow users to modify this setting, which invalidates my previous comment. :-) Check my answer for the latest information. – Paul Gessler Apr 30 '20 at 22:08
3

(I'm on support staff at Overleaf.)

This can sometimes happen when copying an Overleaf project, because existing projects use the TeX Live version that was current when the project was created (to avoid the output changing when we update TeX Live on Overleaf). But new copies of projects will use a newer TeX Live version (to discourage use of outdated packages) if available.

This can lead to this behavior, if the packages you use in your document have changed between TeX Live versions. Previously support staff could adjust this, so users had to contact us to change it in their projects. We recently introduced a new feature where you can adjust this setting yourself in your projects if needed.

To do this, open the original working project, then click on the Overleaf menu in the upper left. Scroll down to the "TeX Live version" entry in the settings and note which version is in use for the working project.

enter image description here

Then you can open the new copy of the project and adjust the setting there to match the original project. More information about the feature is available here: https://www.overleaf.com/blog/new-feature-select-your-tex-live-compiler-version

Only make this change if your new project is not working or if you have special requirements to use a specific version of TeX Live. In general, it's better to move newer projects onto the newer version of TeX Live to benefit from the latest enhancements and bugfixes to packages in your documents.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.