generated from slds-lmu/lecture_template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
007b6cd
commit 1dccd14
Showing
10 changed files
with
765 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
MATHRMD=latex-math.Rmd | ||
MATHPDF=${MATHRMD:%.Rmd=%.pdf} | ||
|
||
TEXFILES=$(shell find . -iname "basic-*tex" -o -iname "ml-*tex") | ||
|
||
MATHCOMBINED=latex-math-combined.tex | ||
|
||
|
||
.PHONY: all pdf combined help | ||
all: $(MATHPDF) $(MATHCOMBINED) | ||
pdf: $(MATHPDF) | ||
combined: $(MATHCOMBINED) | ||
help: | ||
@echo "Usage: make <target>:\n" | ||
@echo " pdf: render $(MATHRMD) to $(MATHPDF)" | ||
@echo " combined: create the combined tex file $(MATHCOMBINED)" | ||
@echo " clean: remove $(MATHPDF) and $(MATHCOMBINED)" | ||
@echo " all: render $(MATHRMD) to $(MATHPDF) and create the combined tex file $(MATHCOMBINED)" | ||
@echo " help: show this message" | ||
|
||
$(MATHPDF): $(MATHRMD) $(TEXFILES) | ||
@echo rendering $<; | ||
Rscript -e "rmarkdown::render('latex-math.Rmd')" | ||
|
||
$(MATHCOMBINED): $(TEXFILES) | ||
@echo creating $@ from $(TEXFILES); | ||
Rscript --quiet create-latex-math-combined.R | ||
|
||
.PHONY: clean | ||
clean: | ||
@echo Removing $(MATHPDF) if it exists; | ||
latexmk -C | ||
test -f $(MATHPDF) && rm $(MATHPDF) | ||
test -f combined-latex-and-math.tex && rm combined-latex-and-math.tex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Find all .tex files starting with `basic-` or `ml-` | ||
# !! If new file prefixes are added, they must be added to the regex pattern | ||
texfiles <- list.files(pattern = "(ml|basic)-.*\\.tex") | ||
|
||
combined <- vapply(seq_along(texfiles), \(i) { | ||
lines <- readLines(texfiles[[i]]) | ||
chunk <- paste(lines, collapse = "\n") | ||
chunk <- paste0(chunk, "\n") | ||
|
||
paste( | ||
sprintf("%% ------------- %s -------------", basename(texfiles[[i]])), | ||
chunk, | ||
sep = "\n\n" | ||
) | ||
}, character(1)) | ||
|
||
writeLines(combined, "latex-math-combined.tex") |
Oops, something went wrong.