summaryrefslogtreecommitdiffhomepage
path: root/tools/addpaper.ml
blob: 1e281a31ac888bf780eb601fe860ca11b45c21ea (plain)
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
(*
  File: addpaper.ml
  Purpose: Creates a paper template in LaTeX.
  Copyright 2025-2026, Amlal El Mahrouss & NeKernel.org Authors.
  Licensed under Apache 2.0.
*)

open Stdlib
open Out_channel
open Printf

let email_index : int = 4
let author_index : int = 3
let title_index : int = 2
let file_index : int = 1
let format = format_of_string 
"
\\documentclass[11pt, a4paper]{article}
\\usepackage{graphicx}
\\usepackage{listings}
\\usepackage{xcolor}
\\usepackage{hyperref}
\\usepackage[margin=0.5in,top=1in,bottom=1in]{geometry}

\\title{%s}
\\author{%s\\\\%s}
\\date{\\today}

\\begin{document}
\\bf
\\maketitle
\\begin{center}
	\\rule[0.01cm]{17cm}{0.01cm}
\\end{center}
\\abstract{}
\\begin{center}
	\\rule[0.01cm]{17cm}{0.01cm}
\\end{center}
\\end{document}
"
;;

(*
  We just make a LaTeX file with the given title.
*)
let () = if Array.length Sys.argv >= 5 then
  let out_file : string = Sys.argv.(file_index)^".tex" in
    let file = open_text out_file in
    let title = Sys.argv.(title_index) in
    let author = Sys.argv.(author_index) in
    let email = Sys.argv.(email_index) in

    fprintf file format title author email;
    
    close_out file;
  else (
    printf "addpaper: Creates papers for TeX.\n";
    printf "addpaper: usage: <file_name> <document_title>\n"
  );;