Closed fwsl closed 6 years ago
Thanks for reporting this. We forwarded this issue to our developer for further checking.
I reviewed this bug and can confirm this.
The creating of the pdf file works as follows: Every Latex-Formula is converted into an image of the formula and inserted in an html-Version of the question. This is then printed on the PDF by our used pdf-library, which is integrated in Moodle (tcpdf). I tried to fix your problem by changing the way the html is printed onto the PDF, but that caused other problems, which isn't really easy to fix, because the Code there is really old and horrible to read You can try it, just look up the pdflib.php file and try to understand what exactly happens, if you want. Therefore I would recommend you to print your questionsheets as word or directly as latex-File, which is a feature introduced some versions ago, although the latex-Version doesn't support images (yet).
This problem exists in all of the formats. In docx tex equations are in new line and centered on the page, and in tex they are in $$ $$ $$\mathbf{x}^{i+1}=(0,2,2)$$
which creates new line before and after the equation.
Hello, This bug is still present in v3.3.0 (2017081100) in pdf, latex and docx formats. I'll make a pull request with simple workaround for the latex version. could you check if this doesn't break anything else? Thanks
Thanks for the pull request. Ive merged it into the master, and it will be solved for Version 3.4. We will discuss, if we also release a bugfix-version for version 3.3.0
This is a simple fix, I can create a pull request for v3.3 if needed.
I've dug into this, and it wasn't pretty
There were two issues
The "In answer texts we want a line break to avoid the picture going above the line." in html2text adds a new line before every img, because of this it is impossible to put image inline, or two images side by side. I've removed it, and things got a lot better for LATEX and also text based answers with images. Because of this removal images start above the line. But I think this repairs more than it breaks.
The span attribute added by TEX filter generated line break after each LATEX usage. I've added two preg replaces. This fixes the line break after each LATEX usage.
I've made a pull request, let me know if this fix is acceptable.
@univietw Hi, any update on my second pull request?
@kaspot @univietw Hi, any update if my pull request is ok?
Hi, I was looking through your pull request and your point in 1.) is not as easy as it seems.
I don't know the exact story behind this, but I had a conversation with the old maintainer of the software once, where he told me, that he tried a lot of things, and every time something else broke and the solution we have now is the one that produces the lowest amount of support tickets. I would consider an option in the plugin, so everyone can choose what works best for him.
Ok, I understand your point. This would change output for all quizes. I'll try adding:
Would this be ok?
@univietw I've made this behavior configurable by default sitewide setting and per quiz override setting. Could you check if it's ok? I've created a new pull requests for master and 3.3 branches.
Hello, I'm a bit lost with those informations, can we consider that this bug is fixed with Moodle 3.4 and plugin v3.4.0..? We are currently testing it on Moodle 3.2 and plugin v3.2.5.. What if we install plugin 3.4.0 on MDL 3.2..? Thanks in advance
Hey,
actually the bugfix is included in our develop_33, master and Moodle_34_Stable branch.
That means, that it`s included in offline test v3.4.0. We made some small changes to your pull requests (langstring, appearance). You can finde now two settings - an adminsetting (global) and a setting for every offlne instance (local). Have fun!
Hello Thanks a lot for the fast answer ! We'll postpone use of latex until couple 3.4/3.4.0 so I guess the best way to use it is to set it locally when questions includes latex..? Or can it be set widely without side effects..? I think i didn't understood what they were... :/ Thanks in advance
Hi global setting - what the default value for all new quizzes should be local setting - can overwrite the global setting in quiz.
It will also change how other images(not only tex) are printed in question sheets(no new lines before and after the image).
@goggo24 will this change be available in Moodle_33_Stable?
Hi @fwsl does this affect only this plugin or it has effects on other images in other activities or questions types, that's what i don't distinguish in conversation below.. Thanks !
This only affects how images are printed in documents (mainly pdf) generated by this plugin.
The setting only effects the offline test PDF question sheets. The option disables new lines before and after images (picture, latex formula) in answers. Picture left without / picture right with the settting.
@fwsl : at the moment in the develop_33 your pull request is included and tested. So you could use develop_33. For 3.4. we did some small changes, we haven't transfered them back in 33 and therefore we didn't do a new 3.3 version.
Thanks ! ^^ ..but in fact i read again the discussion and the issue is "only" a matter of new line, in my case latex doesn't appear at all, only a new line, does latest versions solves this too..?
@crosj: What do you mean with "latex doesn't appear at all"?
Our teachers work with Latex in offlinequiz too. Most of them use the LATEX format for the questions sheets (form settings) and so get the whole answer sheet output in latex. Or use the DOCX format to reviste aferwards the file instead of PDF. Maybe you can open a new github issue for the problem and provide more information/screenshots.
@goggo24 On this screenshot on the left : PDF generated with online quiz and on the right : the same question in an usual test from the bank
I used $$\frac{8}{2}$$ and $$\sqrt{16}$$
As i'm testing on MDL 3.2 and plugin 3.2.5 maybe it's outdated even if those versions are quiet recent..
Could it be an issue of pdf generation of moodle..? I may test in a book resource i guess..
@crosj It looks like you may have problem with latex. In filters disable mathjax and enable tex notation filter. If you stop seeing latex formulas, go to https://docs.moodle.org/33/en/TeX_notation_filter#Debugging_TeX_filter
Thanks for the recommandation @fwsl i deactivated mathjax and left tex notation filter activated and regenerated PDF : no formulas (but they were in preview)..did the opposite : the same (as well in preview)...i can't tell if it's a plugin issue or filter or pdf generation.. :/
The offline Test uses TEX Notation for creating the PDF Output. I tried $$\frac{8}{2}$$ and $$\sqrt{16}$$ and it works fine in our moodle installation. I can see it in the pdf.
i checked but i don't see imagemagick (i added a scrshot of the page)
I don't see where i could output docx..? If it's supposed to be in plugin's settings page, i don't have it (3.2.5 ?)
Thanks for your suggestions !
We have nearly the same settings, but use GIF instead of SVG. I just tried it with SVG and it works fine & I can see the formula in the pdf. Can you try to install convert on your server and try again?
Hello Thanks @goggo24 looking up my issue I'm not keen on administration, but isn't it yet installed as i see "/usr/bin/convert" in filter_tex | pathconvert's field..or the X means it is not..? Thanks Julien
@crosj: yes, x means that it is not installed. Has the installation changed anything? Does it work now?
Hello @goggo24 Not yet installed (i haven't the ability to do so), i'll keep up to date the conversation if i have any change. Thanks for the reply
Hello, I have same problem, did the proposed answer fix this bug ? Thanks
Hi, I've got problem while creating pdf (and latex) question forms that contain latex code eg.
$$\mathbf{x}^{i+1}=(0,1)$$
. Everything looks fine in theCreate forms
Preview
tab, but there is additional new line before and after each$$TeX$$
when pdf form is created. This may be because$$TeX$$
is the way moodle recognizes when to use TeX filter, but in latex$$
is a new line symbol.