From 11d2fe7491858a35852fa4e8429fc77a0a665d24 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Mon, 28 Oct 2019 09:33:37 +0100 Subject: [PATCH 1/2] Fixed line breaks in LaTeX header --- nw/convert/file/latex.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/nw/convert/file/latex.py b/nw/convert/file/latex.py index 10968a97..e640847b 100644 --- a/nw/convert/file/latex.py +++ b/nw/convert/file/latex.py @@ -23,9 +23,7 @@ class LaTeXFile(TextFile): def __init__(self, theProject, theParent): TextFile.__init__(self, theProject, theParent) - self.theConv = ToLaTeX(self.theProject, self.theParent) - return ## @@ -36,9 +34,9 @@ class LaTeXFile(TextFile): try: self.outFile = open(filePath,mode="wt+") - self.outFile.write(r"\documentclass[12pt]{report}\n") - self.outFile.write(r"\usepackage[utf8]{inputenc}\n") - self.outFile.write(r"\begin{document}\n") + self.outFile.write("\\documentclass[12pt]{report}\n") + self.outFile.write("\\usepackage[utf8]{inputenc}\n") + self.outFile.write("\\begin{document}\n") except Exception as e: self.makeAlert(["Failed to open file.",str(e)], nwAlert.ERROR) return False @@ -48,7 +46,7 @@ class LaTeXFile(TextFile): def _doCloseFile(self): if self.outFile is not None: - self.outFile.write(r"\end{document}\n") + self.outFile.write("\\end{document}\n") self.outFile.close() return True From 22d303c98e902cbf992a2dfd10b6be05c8ae4130 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Mon, 28 Oct 2019 10:15:05 +0100 Subject: [PATCH 2/2] Fixed LaTeX export for no wrapping setting --- nw/convert/file/latex.py | 1 + nw/convert/text/tolatex.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/nw/convert/file/latex.py b/nw/convert/file/latex.py index e640847b..334e9583 100644 --- a/nw/convert/file/latex.py +++ b/nw/convert/file/latex.py @@ -36,6 +36,7 @@ class LaTeXFile(TextFile): self.outFile = open(filePath,mode="wt+") self.outFile.write("\\documentclass[12pt]{report}\n") self.outFile.write("\\usepackage[utf8]{inputenc}\n") + self.outFile.write("\n") self.outFile.write("\\begin{document}\n") except Exception as e: self.makeAlert(["Failed to open file.",str(e)], nwAlert.ERROR) diff --git a/nw/convert/text/tolatex.py b/nw/convert/text/tolatex.py index 7b8a6f51..2002f8d9 100644 --- a/nw/convert/text/tolatex.py +++ b/nw/convert/text/tolatex.py @@ -110,12 +110,13 @@ class ToLaTeX(Tokenizer): tText = tWrap.fill(tText) # Then the text can receive final formatting before we append it to the results. - # We also store text lines in a buffer and merge them only when we find an empty line, + # We also store text lines in a buffer and merge them only when we find an empty line # indicating a new paragraph. if tType == self.T_EMPTY: if len(thisPar) > 0: self.theResult += begText - self.theResult += "%s\n" % tWrap.fill(" ".join(thisPar)) + for tTemp in thisPar: + self.theResult += "%s\n" % tTemp self.theResult += endText thisPar = []