Moodle
  1. Moodle
  2. MDL-21407

default latex preamble is incorrect (spaces before each line)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.5, 1.9.6, 1.9.7
    • Fix Version/s: 1.9.8
    • Component/s: Filters
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      24662

      Description

      The default "LaTeX preamble" in "Site Administration" > "Modules" > "Filters" > "TeX Notation" is incorrect.

      There should not be any spaces before each line, but there is.

      See attached patch file.

        Activity

        Hide
        Anita P. Shauer added a comment -

        This issue is something that has bugged me for a long time. It makes my cats very sad.

        Show
        Anita P. Shauer added a comment - This issue is something that has bugged me for a long time. It makes my cats very sad.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Adding Marc and Mauno here, just in case they can confirm the preamble must have all those whitespaces cleaned. Also adding Howard, that was the original committer of the preamble thing, just in case he knows some good reason for that.

        Also note that, if we are going to fix it we must:

        1) Change the default to a correct value (Jonathan's patch above).
        2) Add one step in upgrade so the current status of the setting becomes fixed too (by replacing any space + backslash by backslash?)

        TIA and ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Adding Marc and Mauno here, just in case they can confirm the preamble must have all those whitespaces cleaned. Also adding Howard, that was the original committer of the preamble thing, just in case he knows some good reason for that. Also note that, if we are going to fix it we must: 1) Change the default to a correct value (Jonathan's patch above). 2) Add one step in upgrade so the current status of the setting becomes fixed too (by replacing any space + backslash by backslash?) TIA and ciao
        Hide
        Mauno Korpelainen added a comment -

        I don't understand how those spaces could cause problems - if they do, it must be some special environment.

        I checked my plugindemo test site that is using Tex Live (Debian) and it had the original preamble + I had added some lines but spaces caused no trouble.
        On my Windows Vista test PC using MikTex I tested preamble with and without spaces and both worked fine.

        As far as I have seen LaTeX ignores "normal" spaces in a math environment and that way the only advantage of "fixing this bug" is that we get 4 spaces shorter code. From the viewpoint of beauty it is of course nicer if all preamble rows are equally aligned in administration of tex filter.

        Show
        Mauno Korpelainen added a comment - I don't understand how those spaces could cause problems - if they do, it must be some special environment. I checked my plugindemo test site that is using Tex Live (Debian) and it had the original preamble + I had added some lines but spaces caused no trouble. On my Windows Vista test PC using MikTex I tested preamble with and without spaces and both worked fine. As far as I have seen LaTeX ignores "normal" spaces in a math environment and that way the only advantage of "fixing this bug" is that we get 4 spaces shorter code. From the viewpoint of beauty it is of course nicer if all preamble rows are equally aligned in administration of tex filter.
        Hide
        Mauno Korpelainen added a comment -

        If some Latex environment does have problems with those spaces it is of course better to take them away like Jonathan's patch suggests.

        If people edit their Latex preamble from settings of tex filter the edited value of field filter_tex_latexpreamble in table mdl_config is used as $CFG->filter_tex_latexpreamble anyway (with or without spaces).

        Show
        Mauno Korpelainen added a comment - If some Latex environment does have problems with those spaces it is of course better to take them away like Jonathan's patch suggests. If people edit their Latex preamble from settings of tex filter the edited value of field filter_tex_latexpreamble in table mdl_config is used as $CFG->filter_tex_latexpreamble anyway (with or without spaces).
        Hide
        Mauno Korpelainen added a comment -

        One more note:

        There seems to be a doubled line in filtersettings.php:

        $items[] = new admin_setting_configtext('filter_tex_density', get_string('density', 'admin'), '', '120', PARAM_INT);
        $items[] = new admin_setting_configtext('filter_tex_density', get_string('density', 'admin'), '', '120', PARAM_INT);

        Show
        Mauno Korpelainen added a comment - One more note: There seems to be a doubled line in filtersettings.php: $items[] = new admin_setting_configtext('filter_tex_density', get_string('density', 'admin'), '', '120', PARAM_INT); $items[] = new admin_setting_configtext('filter_tex_density', get_string('density', 'admin'), '', '120', PARAM_INT);
        Hide
        Jonathan Robson added a comment -

        Well, the white space IS causing problems for us. The server environment(s) is CentOS 4 & 5 (Red Hat).

        We HAVE been able to fix the problem by simply changing the value of the "LaTeX preamble" text field in "Site Administration" > "Modules" > "Filters" > "TeX Notation." This is why I created the issue with a "Minor" priority. I just figured the default should be changed since it IS causing problems in some environments.

        Show
        Jonathan Robson added a comment - Well, the white space IS causing problems for us. The server environment(s) is CentOS 4 & 5 (Red Hat). We HAVE been able to fix the problem by simply changing the value of the "LaTeX preamble" text field in "Site Administration" > "Modules" > "Filters" > "TeX Notation." This is why I created the issue with a "Minor" priority. I just figured the default should be changed since it IS causing problems in some environments.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Hi,

        I've:

        1) Change current default preamble to the trimmed one for new installations.
        2) On upgrade, trim leading whitespace from preamble too (for existing installations)

        So, any Moodle should end using the "trimmed" preamble as suggested.

        Thanks Jonathan and Mauno! Resolving this as fixed. Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Hi, I've: 1) Change current default preamble to the trimmed one for new installations. 2) On upgrade, trim leading whitespace from preamble too (for existing installations) So, any Moodle should end using the "trimmed" preamble as suggested. Thanks Jonathan and Mauno! Resolving this as fixed. Ciao
        Hide
        Vadim Dvorovenko added a comment -

        Hey, if you are patching some spaces wich does not affect any normal Latex, please add to CVS issue MDL-10197

        Show
        Vadim Dvorovenko added a comment - Hey, if you are patching some spaces wich does not affect any normal Latex, please add to CVS issue MDL-10197

          People

          • Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: