-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
87 lines (73 loc) · 2.84 KB
/
script.js
File metadata and controls
87 lines (73 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
document.getElementById("template-form").addEventListener("submit", (event) => {
event.preventDefault();
const name = document.getElementById("name").value;
const subjectCode = document.getElementById("subject-code").value;
const title = document.getElementById("title").value;
const studentId = document.getElementById("student-id").value;
const font = document.getElementById("font").value;
const dateFormat = document.getElementById("date-format").value;
const output = `
---
title: |
| \\vspace{8cm} \\LARGE ${title}
author: |
| ${name}
| Student ID: ${studentId}
date: \\currentdate
output:
pdf_document:
extra_dependencies: float
fig_caption: yes
number_sections: true
latex_engine: xelatex
mainfont: ${font}
header-includes: |
\\usepackage{caption}
\\usepackage{fancyhdr}
\\renewcommand{\\headrulewidth}{0pt}
\\usepackage{lastpage}
\\usepackage{textcase}
\\newcommand{\\currentdate}{\`r format(Sys.time(), '${dateFormat}')\`}
\\pagestyle{fancy}
\\fancyhead[L]{${name}}
\\fancyhead[C]{${subjectCode} ${title}}
\\fancyhead[R]{Date of Submission: \\currentdate}
\\fancyfoot[C]{}
\\fancyfoot[R]{Page \\thepage\\ of \\pageref{LastPage}}
\\DeclareCaptionLabelSeparator{IEEE}{.\\quad }
\\captionsetup{labelfont=bf}
\\captionsetup[figure]{name=Fig., labelsep=IEEE, format=hang, justification=centering,singlelinecheck=false}
\\DeclareCaptionTextFormat{up}{\\MakeUppercase{#1}}
\\renewcommand{\\thetable}{\\Roman{table}}
\\captionsetup[table]{name=TABLE, position=above, justification=centering, labelsep=newline, aboveskip=0pt, textfont=bf, textformat=up}
\\usepackage{lscape}
\\usepackage{rotating}
---
\\newpage
\\tableofcontents
\\listoffigures
\\listoftables
\\newpage
\`\`\`{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE,
fig.pos = "H", # Hold figures' position
fig.align = 'center', # Figures go to middle of page
out.extra = "",
out.width = "75%", # 75% can fit two MATLAB figures per page
message=FALSE, # Suppress messages when knitting
warning=FALSE, # Suppress warning when knitting
tidy.opts = list(width.cutoff = 60), # Wrap code-chunk text
tidy = TRUE)
library(ggplot2) # Better plots
library(kableExtra) # Better tables
library(bookdown) # Mainly for referencing tables, figures, eqns.
library(comprehenr)
options(scipen=2) # Prevent scientific notation in plots
\`\`\`
`;
document.getElementById("output").value = output;
});
document.getElementById("hint-toggle").addEventListener("click", () => {
const hintContent = document.getElementById("hint-content");
hintContent.style.display = hintContent.style.display === "none" ? "block" : "none";
});