From 06ef44817de918e6507b3e9c448b4dbdc09d6390 Mon Sep 17 00:00:00 2001 From: eyihluyc Date: Wed, 4 Dec 2024 15:05:28 +0300 Subject: [PATCH] Make latex output complete (parseable) --- eo-phi-normalizer/app/Main.hs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/eo-phi-normalizer/app/Main.hs b/eo-phi-normalizer/app/Main.hs index cd883fde..26185bb5 100644 --- a/eo-phi-normalizer/app/Main.hs +++ b/eo-phi-normalizer/app/Main.hs @@ -597,7 +597,7 @@ main = withUtf8 do Nothing -> do ruleSet :: RuleSet <- decodeThrow $(embedFileRelative "test/eo/phi/rules/new.yaml") return (False, ruleSet.title, convertRuleNamed <$> ruleSet.rules) - unless (single || json || (chain && latex)) $ logStrLn ruleSetTitle + unless (single || json || latex) $ logStrLn ruleSetTitle bindingsWithDeps <- case deepMergePrograms (program' : deps) of Left err -> throw (CouldNotMergeDependencies err) Right (Program bindingsWithDeps) -> return bindingsWithDeps @@ -647,8 +647,19 @@ main = withUtf8 do logStrLn [fmtTrim|{linesCombined}|] logStrLn "\\end{phiquation*}" logStrLn "\n\\end{document}" - | latex -> + | latex -> do + logStrLn + [fmtTrim| + % {ruleSetTitle} + + \\documentclass{{article}} + \\usepackage{{eolang}} + \\begin{{document}} + |] + logStrLn "\\begin{phiquation*}" logStrLn . toLatexString $ logEntryLog (head (head uniqueResults)) + logStrLn "\\end{phiquation*}" + logStrLn "\n\\end{document}" | otherwise -> do logStrLn "Input:" logStrLn (printTree program')