51 lines
1.8 KiB
R
51 lines
1.8 KiB
R
# setwd("C:/Users/nwickelmaier/Nextcloud/Documents/MDS/2023ss/60100_master_thesis/code")
|
|
|
|
# TODO: Write an Rmd file this way and render at the end? Then put it in a
|
|
# function, so everybody can do it???
|
|
devtools::load_all("../../../../software/mtt")
|
|
|
|
fname <- "../overview_artworks_8o8m.tex"
|
|
if (file.exists(fname)) file.remove(fname)
|
|
|
|
path <- "C:/Users/nwickelmaier/Nextcloud/Documents/MDS/2023ss/60100_master_thesis/data/8o8m/Content8o8m"
|
|
artworks <- dir(path = path)
|
|
|
|
dat <- extract_artworks(artworks, xmlfiles = paste0(artworks, "_de.xml"), xmlpath = path)
|
|
|
|
fout <- file(fname, "a") # open in append mode
|
|
|
|
writeLines("\\documentclass[a4paper,12pt]{article}", fout)
|
|
writeLines("\\usepackage{graphicx}", fout)
|
|
writeLines("\\usepackage[margin = 2cm]{geometry}", fout)
|
|
writeLines("\\author{Nora Wickelmaier}", fout)
|
|
writeLines("\\title{Overview of Artworks from 8 Objects 8 Museums (8o8m)}", fout)
|
|
writeLines("\\date{\\today}", fout)
|
|
writeLines("\\begin{document}", fout)
|
|
writeLines("\\maketitle", fout)
|
|
#writeLines("\\newpage", fout)
|
|
|
|
for (artwork in dat$artwork) {
|
|
|
|
writeLines(paste0("\\section*{Artwork Number ", artwork, "}"), fout)
|
|
writeLines("", fout)
|
|
writeLines("\\noindent", fout)
|
|
writeLines(paste0("Artist: ", dat[dat$artwork == artwork, "artist"]), fout)
|
|
writeLines("", fout)
|
|
writeLines("\\noindent", fout)
|
|
writeLines(paste0("Title: ", dat[dat$artwork == artwork, "title"]), fout)
|
|
writeLines("", fout)
|
|
|
|
writeLines("\\begin{center}", fout)
|
|
art_path <- paste(path, artwork, artwork, sep = "/")
|
|
writeLines(paste0("\\includegraphics[width = 12cm]{", art_path, "}"), fout)
|
|
writeLines("\\end{center}", fout)
|
|
writeLines("", fout)
|
|
writeLines("\\noindent", fout)
|
|
writeLines(paste0("Info: ", dat[dat$artwork == artwork, "misc"]), fout)
|
|
writeLines("\\newpage", fout)
|
|
}
|
|
|
|
writeLines("\\end{document}", fout)
|
|
close(fout)
|
|
|