From 031e4f5f6b36abaa21456e7079ba9e8ecfe1b386 Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Mon, 5 Feb 2024 19:21:17 -0600 Subject: [PATCH] Fix problem pdf --- resources/katex_config.js | 13 ++++++++++--- templates/problem/problem.html | 10 ++++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/resources/katex_config.js b/resources/katex_config.js index a87b1ee..d42039e 100644 --- a/resources/katex_config.js +++ b/resources/katex_config.js @@ -1,13 +1,20 @@ window.renderKatex = (elem=document.body) => { var maths = document.querySelectorAll('.arithmatex'), tex; - console.log(maths); for (var i = 0; i < maths.length; i++) { tex = maths[i].textContent || maths[i].innerText; if (tex.startsWith('\\(') && tex.endsWith('\\)')) { - katex.render(tex.slice(2, -2), maths[i], {'displayMode': false, 'throwOnError': false}); + katex.render(tex.slice(2, -2), maths[i], { + 'displayMode': false, + 'throwOnError': false, + 'strict': false, + }); } else if (tex.startsWith('\\[') && tex.endsWith('\\]')) { - katex.render(tex.slice(2, -2), maths[i], {'displayMode': true, 'throwOnError': false}); + katex.render(tex.slice(2, -2), maths[i], { + 'displayMode': true, + 'throwOnError': false, + 'strict': false, + }); } } } \ No newline at end of file diff --git a/templates/problem/problem.html b/templates/problem/problem.html index dfe71aa..348ffdf 100644 --- a/templates/problem/problem.html +++ b/templates/problem/problem.html @@ -66,10 +66,12 @@ if (!$('#raw_problem').attr('src')) { $('#raw_problem').attr('src', '{{problem.code}}/raw') } - while(!$('.math-loaded', frames['raw_problem'].document).length){ - await new Promise(r => setTimeout(r, 200)); - } - frames['raw_problem'].print(); + // while(!$('.math-loaded', frames['raw_problem'].document).length){ + // await new Promise(r => setTimeout(r, 200)); + // } + setTimeout(() => { + frames['raw_problem'].print(); + }, 1000); }); $('#clarification_header').on('click', function() { $('#clarification_header_container').hide();