novathesis icon indicating copy to clipboard operation
novathesis copied to clipboard

[BUG] Error: Command \c@subfigure already defined.

Open tpdsantos opened this issue 1 year ago • 2 comments

Template: Version 2022-01-11 [6.9.1] engine: pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2022/dev/Debian) OS: Ubuntu 22.04.1 LTS kernel: 5.10.16.3-microsoft-standard-WSL2

I was trying the new WSL 2 to see if I could remove the dual-boot for good, so I installed the Ubuntu version with the specs above.

After deleting all auxiliary files, I run make and this error occurs:

! LaTeX Error: Command \c@subfigure already defined.
               Or name \end... illegal, see p.192 of the manual.

Interestingly, this error only appears after cleaning auxiliary files and/or modifying any source file. If I run make twice in a row without modifying anything in between, the error stops occurring and the document is well compiled.

In the end, the PDF is produced and is produced correctly, but only after running make twice after each modification and/or cleaning, which is quite annoying.

For further information I attached my main.log file: main.log

and my Makefile:

SILENT = -silent

MAINFILE   = main
DRAFTFILE  = main-draft
OUTPUTFILE = PhDThesis-TiagoPereiraDosSantos-nr54218
BUILD      = build

T = $(MAINFILE).pdf
S = $(MAINFILE).tex

F = -time -shell-escape -synctex=1 -interaction=nonstopmode -outdir=$(BUILD)

default: pdf

$(T): $(S)
	make

.PHONY: pdf final
pdf final: $(S)
	latexmk $(F) -pdf $(SILENT) $(MAINFILE)
	@cp $(BUILD)/$(MAINFILE).pdf $(OUTPUTFILE).pdf

.PHONY: view
view:
	@xdg-open $(OUTPUTFILE).pdf &

.PHONY: view-draft
view-draft:
	@xdg-open $(BUILD)/$(DRAFTFILE).pdf &

.PHONY: draft
draft: $(S)
	latexmk $(F) -pdf $(SILENT) $(DRAFTFILE)
	@cp $(BUILD)/$(DRAFTFILE).pdf $(DRAFTFILE).pdf

.PHONY: draft-kill
draft-kill: $(S)
	@killall latexmk
	@rm -f .nohup.out
	@cp $(BUILD)/$(DRAFTFILE).pdf $(DRAFTFILE).pdf

.PHONY: draft-continuous
draft-continuous: $(S)
	nohup latexmk $(F) -pvc -pdf $(SILENT) $(DRAFTFILE) > .nohup.out &

.PHONY: verb verbose
verb verbose:
	latexmk $(F) -pdf $(MAINFILE)

.PHONY: clean
clean:
	@rm -f $(BUILD)/* $(DRAFTFILE).pdf $(OUTPUTFILE).pdf .nohup.out
	@find . -name "*~" -type f | xargs rm -f

.PHONY: plots
plots:
	@find . -name "extract-jsondata.sh" -type f | xargs bash
	@find . -name "*.gnuplot" -type f | xargs gnuplot
	@find . -name "extract-jsondata.sh" -type f | xargs -I {} bash {} remove

.PHONY: julia
julia:
	@find . -name "data-treatment.jl" -type f | \
	xargs julia --quiet --startup-file=no

.PHONY: test
test:
	@echo "" && echo "\033[1mTREATING DATA...\033[0m"
	@make -s julia
	@echo "" && echo "\033[1mBUILDING PLOTS...\033[0m"
	@make -s plots
	@echo "" && echo "\033[1mBUILDING DISSERTATION...\033[0m"
	@make -s
	@echo "" && echo "\033[1mTHESIS ALL READY!!!\033[0m"

PHONY: full
full:
	@/usr/bin/time --format="\nBUILD DURATION: %E" make -s test

Thank you

tpdsantos avatar Sep 14 '22 14:09 tpdsantos

Forgot one thing. In my current system everything works correctly, no errors whatsoever.

Template: Version 2022-01-11 [6.9.1] engine: pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) OS: Ubuntu 20.04.5 LTS kernel: 5.15.0-46-generic

tpdsantos avatar Sep 14 '22 14:09 tpdsantos

@tpdsantos Which version of the novathesis template are you using? That incampatibility should have been solved some time ago… Please update to the latest version and let me know if you still have the problem. Thanks.

joaomlourenco avatar Sep 19 '22 15:09 joaomlourenco

@tpdsantos That error is due to an incompatibility between "subcaption" and "memoir", which I avoid by, at some point in the "novathesis.cls" file (line 2170), checking if "subcaption" is loaded and do different stuff in case it is loaded. If you don't have this line in your "template.tex"

\@ifpackageloaded{subcaption}{}{\newsubfloat{figure}}

please upgrade to the latest version.

joaomlourenco avatar Sep 24 '22 20:09 joaomlourenco