Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-35694

LaTEX in <img src=""> doesn't work in Numeric Answer questions - Brackets aren't parsed

    XMLWordPrintable

    Details

    • Previous Issue Keys:
      SAM-2015

      Description

      We are using the CodeCogs math equations editor, which adds LaTEX code in a URL that is used as SRC field in IMG tags.

      We have received some feedback about LaTEX formulas with brackets that don't work in Numeric Answers questions in Samigo. I.e. the next html code doesn't work when creating a question:

      Calcula <img align="absmiddle" alt="P\left(\frac{\bar

      {X}-\mu}{\sigma/\sqrt{n}} < 0.12\right)"
      src="http://latex.codecogs.com/gif.latex?P%5Cleft(%5Cfrac{%5Cbar{X}

      -%5Cmu}{%5Csigma%5Csqrt{n}}&space;<&space;0.12%5Cright)" /> =

      {0.52}

      <br />

      Just replacing brackets for their ANSI codes ( "

      {" as %7B and "}

      " as %7D) solves the issue.

      Looking at SAM-902 I can see that something similar has been fixed for 2.8 and a new method getFIBFINanswers() has been added to ItemAddListener.java, to parse brackets in HTML, so they are not parsed as the answer brackets.

      However, after applying the patch, I receive the same error message. Looking in the code, it seems that before parsing brackets, method isErrorFIN() is called also in ItemAddListener and it just checks the
      brackets opening and closening, so two opened brackets in a row cause the issue, no matter if the total count of opened an closed brackets matches.

        Gliffy Diagrams

          Zeplin

            Attachments

              Issue Links

                Activity

                  People

                  • Assignee:
                    samigoteam SAMIGO TEAM (Inactive)
                    Reporter:
                    daniel.merino Daniel Merino Echeverría
                  • Votes:
                    0 Vote for this issue
                    Watchers:
                    2 Start watching this issue

                    Dates

                    • Created:
                      Updated:
                      Resolved:

                      Git Integration