mtt_haum/code/overview_artworks_haum.R

51 lines
1.8 KiB
R

# setwd("C:/Users/nwickelmaier/Nextcloud/Documents/MDS/2023ss/60100_master_thesis/code")
devtools::load_all("../../../../software/mtt")
fname <- "../museums/overview_artworks_haum.tex"
if (file.exists(fname)) file.remove(fname)
xmlpath <- "C:/Users/nwickelmaier/Nextcloud/Documents/MDS/2023ss/60100_master_thesis/data/haum/ContentEyevisit/eyevisit_cards_light"
artworks <- dir(path = xmlpath)
artworks <- artworks[artworks != "glossar"]
dat <- extract_artworks(artworks, xmlfiles = paste0(artworks, ".xml"),
xmlpath = xmlpath)
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 MTT in HAUM}", 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(xmlpath, 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)