Beispiel #1
0
#     print('_________________________')
#     print(src[j])
#     print(target[j])
#     if '#' in target[j]:
#         break

print("Generating latex code...")


def text_to_latex(text):
    code = unicode_to_latex(text)
    #code = '*UnicodeEncodeError*'
    return code


result = latex_templates.get_latex_start(title=title, author=author)
result += text_to_latex(srcs[0]) + '\n\\switchcolumn\n' + text_to_latex(
    targets[0])

for i in range(1, min(len(srcs), len(targets))):
    src_t = text_to_latex(srcs[i])
    targt_t = text_to_latex(targets[i])
    result += '\n\\switchcolumn*\n' + src_t + '\n\\switchcolumn\n' + targt_t

result += latex_templates.get_latex_end()
filepath = os.path.join(
    r'C:\Users\gcvic\Documents\bilingual-document-generator\code.txt')
with open(filepath, 'w', encoding='utf8') as fp:
    fp.write(result)
print("Goed gedaan!", filepath)
Beispiel #2
0
#     print('_________________________')
#     print(src[j])
#     print(target[j])
#     if '#' in target[j]:
#         break

print("Generating latex code...")


def text_to_latex(text):
    code = unicode_to_latex(text)
    #code = '*UnicodeEncodeError*'
    return code


result = latex_templates.get_latex_start(title='Le streghe',
                                         author='Roald Dahl')
result += text_to_latex(srcs[0]) + '\n\\switchcolumn\n' + text_to_latex(
    targets[0])

for i in range(1, min(len(srcs), len(targets))):
    src_t = text_to_latex(srcs[i])
    targt_t = text_to_latex(targets[i])
    result += '\n\\switchcolumn*\n' + src_t + '\n\\switchcolumn\n' + targt_t

result += latex_templates.get_latex_end()
filepath = os.path.join(
    r'C:\Users\gcvic\Documents\bilingual-document-generator\code.txt')
with open(filepath, 'w', encoding='utf8') as fp:
    fp.write(result)