File size: 769 Bytes
a0d1776
 
fb8c051
 
a0d1776
 
fb8c051
 
 
 
 
 
 
 
 
 
 
b4c6c2b
a0d1776
 
 
fb8c051
3a7ead9
 
b4c6c2b
 
 
8e698eb
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
import os

def replace_title(save_to_path, title):
    # Define input and output file names
    input_file_name = os.path.join(save_to_path, "template.tex")
    output_file_name = os.path.join(save_to_path , "main.tex")

    # Open the input file and read its content
    with open(input_file_name, 'r') as infile:
        content = infile.read()
    content = content.replace(r"\title{TITLE} ", f"\\title{{{title}}} ")

    # Open the output file and write the modified content
    with open(output_file_name, 'w') as outfile:
        outfile.write(content)


# return all string in \cite{...} \citet{...} or \citep{...}.

# check if citations are in bibtex.


# replace citations

# sometimes the output may include thebibliography and bibitem . remove all of it.