use import command in master file if lectures are in other directory

This commit is contained in:
Maximilian Keßler 2021-09-16 18:55:10 +02:00
parent fabcf60219
commit 81b46dd01b

View file

@ -53,8 +53,12 @@ class Notes:
def update_lectures_in_master(self, r): def update_lectures_in_master(self, r):
header, footer = self.get_header_footer(self.master_file) header, footer = self.get_header_footer(self.master_file)
if self.lectures.root.relative_to(self.root) == Path('.'):
input_command = r'\input{'
else:
input_command = r'\import{' + str(self.lectures.root.relative_to(self.root)) + '/}{'
body = ''.join( body = ''.join(
' ' * 4 + r'\input{' + number2filename(number) + '}\n' for number in r) ' ' * 4 + input_command + number2filename(number) + '}\n' for number in r)
self.master_file.write_text(header + body + footer) self.master_file.write_text(header + body + footer)
def compile_master(self): def compile_master(self):