Forum archive 2000-2006

Robin Cruz - Math fonts not displaying correctly on the screen

Robin Cruz - Math fonts not displaying correctly on the screen

by Arnold Pizer -
Number of replies: 0
inactiveTopicMath fonts not displaying correctly on the screen topic started 9/4/2005; 7:08:44 PM
last post 9/15/2005; 2:00:30 PM
userRobin Cruz - Math fonts not displaying correctly on the screen  blueArrow
9/4/2005; 7:08:44 PM (reads: 1099, responses: 11)
I am in the process of getting WeBWorK 2.1.3 up and running for Fall term. I'm almost there, but the math fonts are not displaying correctly on the screen. The problem templates I am using worked with WeBWork 1.9. I did not try to update the 1.9, but instead followed the new installation instructions. I am not trying to get these guys to work together.

For WeBWorK 2, I am concentrating on using tth or jsmath. I have the newest version of tth and the recommended fonts for jsmath are installed on the computer where WeBWorK 2 lives. Tth works fairly well, but for example, it does not show bar or overline characters correctly. For ( bar x ) it shows up as a small square in front of the x character.

When I try jsmath, the symbols show up better but the equations are not placed correctly. I have been following the 2.1 Installation instructions, but just noticed that there has been an update for jsmath in the 2.2 Installation instructions. Should I follow these instructions?

Note that the printed versions of these problems look fine.

-- rac

<| Post or View Comments |>


userDavide P. Cervone - Re: Math fonts not displaying correctly on the screen  blueArrow
9/4/2005; 10:39:45 PM (reads: 1199, responses: 0)
Can you be more specific about the situation for jsMath? Errors in jsMath usually are very dependent on the browser you are using, and the version of jsMath that you are using. I assume this is with MSIE, since Internet Explorer has most of the placement bugs. When you say "the recommended fonts are installed on the computer where WeBWorK 2 lives", that makes me think you have updated to jsMath v2 and have unpacked the jsMath-fonts.tar.gz file. (If instead you have downloaded the TeX fonts from the jsMath web site and put the .ttf files on the server, that is a mistake, as the .ttf files need to be on the STUDENT'S machine.)

If you are using jsMath v2, you will get a small "jsMath" button in the lower right. Clicking that will bring up the control panel for jsMath, and it will tell you the exact version number, and which display method is being used (right below the version, in parentheses). Let me know what those are. Then can you be more specific about what "not placed correctly" means? Are there specific situations what don't work (e.g. fractions), or are there problems with ALL equations? Once I know what the problem is and the browser(s) that produce it, I'll look into it.

As for the 2.2 instructions, you should follow them if you have downloaded jsMath v2. They have to do with unpacking the fonts and the values in global.conf that control jsMath. If you are still using jsMath 1.7, then the new instructions don't apply.

Davide

<| Post or View Comments |>


userRobin Cruz - Re: Math fonts not displaying correctly on the screen  blueArrow
9/6/2005; 6:11:44 PM (reads: 1170, responses: 1)
I'm not sure what version of jsMath I have, but I cannot find a small "jsMath" button on the lower right of any of my problem pages. I downloaded the stuff from the jsMath web site so I'm guessing I don't have v2. (I'm using WeBWorK 2.1.3 which I downloaded at the beginning of August.) By the way, I have only looked at machines with Windows Explorer.

I guess part of the problem is that I do not understand how the fonts are being accessed (delivered by the server or used off of the student's computer). I have a better idea now. I want the math fonts to be as easy for the students to use as possible -- I don't think most of them will be able to download the fonts without help. Mostly I use WeBWorK for a 100 level stat's course. It might be better to only use the "images" and "jsMath" options. The "images" option is working fine.

When I sent the first note above I was looking at a problem on my WeBWorK test course from a computer without the fonts recommended by the jsMath website. One of the matching problems had the three formulas to be matched printed on top of each other. In other problems, the composition symbol "\circ" is shown as a square and in other cases, "\bar x" only shows the bar but no x. I have tried these problems on several machines and sometimes the formulas/equations show up OK and sometimes not. So, it seems that upgrading to jsMath v2 might solve the problem.

However, I followed the instructions to access the CVS and (once again) I seem to be doing something wrong. I followed the second option for setting up to access the CVS. I saved the helper file and changed the permisssions, but it has no extension -- should it? There was no config file in the .shh folder so I copied/pasted the code from the instructions and saved it into the .shh folder as config. (no extension either.) I cd'd to the jsMath directory and typed in the command (and several hours worth of permutations) but was either told that cvs could not find the folder or it could not access the folder.

I also tried the update command, but was asked for gage's password each time.

What command (exactly) should I type to get the tar file so that I can upgrade to jsMath v2?

Thanks for your help -- rac

<| Post or View Comments |>


userDavide P. Cervone - Re: Math fonts not displaying correctly on the screen  blueArrow
9/7/2005; 2:11:59 PM (reads: 1271, responses: 0)
I'm not sure what version of jsMath I have, but I cannot find a small "jsMath" button on the lower right of any of my problem pages.

Then you probably have jsMath v1.7e (which is what shipped with WW2.1.3 in August). There were a number of MSIE-specific fixes in jsMath v2.1, so you will probably ned to get that. One of them had to do with placement issues, so I'm hoping that will fix it for you.

 

I downloaded the stuff from the jsMath web site so I'm guessing I don't have v2

You should not need to download anything from the jsMath site. Everything required by WW is included in the webwork2/htdocs/jsMath directory. (Though STUDENTS may want to download the fonts from the jsMath site. In the past, this was pretty important, but with jsMath v2, it is less critical, as the image fallback fonts work pretty well.)

 

It might be better to only use the "images" and "jsMath" options. The "images" option is working fine.

You can remove the other ones from the options panel by setting the value of the $pg{displayModes} variable in global.conf. For example

    $pg{displayModes} = [ qw(images jsMath) ];
would do it.

 

One of the matching problems had the three formulas to be matched printed on top of each other. In other problems, the composition symbol "\circ" is shown as a square and in other cases, "\bar x" only shows the bar but no x.

These (or at least the latter ones) sound like problems related to the unicode fallback method, which should be alleviated if we can get you jsMath version 2. I'm hopnig the overlapping problems are also taken care of there (I haven't seen that one before).

 

I followed the instructions to access the CVS and (once again) I seem to be doing something wrong.

It's a little tricky, and one thing that is not mentioned there is that it requires ssh protocol version 2. You might have only an ssh1 implementation (that was the case for the ssh that ships with Mac OS X for example -- luckily I had a version of ssh2 that I had compiled for other reasons).

I could not get "Option 2" from the WeBWorK CVS page to work but I did get "Option 1" to work. This option does not require a config file in .ssh, and no, the helper file does not include an extension. It should be made executable, however (e.g., chmod +x ~/.ssh/webwork-anoncvs-helper). I did have to edit this file to use ssh2 rather than ssh, but you may not have to do that if your ssh is already ssh2 (the command in the file does try to force the level 2 protocol with the -2 switch, but that didn't seem to work for me). Other than that, I simply followed the instructions for setting up the file and creating the wwcvs command.

Once you have that set up, however, you will need to check out a NEW copy of the files you want, not use cvs in the directories from the WW2.1.3 tarball. Although the tar file contains CVS directories, these will not be set up to be used by you remotely. (Mike: should these really be included in the tar file?) It is because of these incorrect CVS files that you were asked for gage's password (since Mike's user ID is the one stored in the CVS files).

Instead, try

    cd /tmp
wwvcs d :ext:anoncvs@cvs.webwork.rochester.edu:/webwork/cvs/system checkout webwork2/htdocs/jsMath
cp -R webwork2/htdocs/jsMath path-to-ww2-on-your-system/webwork2/htdocs/jsMath
rm -rf /tmp/webwork2
cd path-to-ww2-on-your-system/webwork2/htdocs/jsMath
tar vfxz jsMath-fonts.tar.gz

There are also changes to global.conf and to pg/macros/PG.pl that are needed for jsMath version 2. First, in global.conf, change $webworkURLs{jsMath} to be

    $webworkURLs{jsMath} = "$webworkURLs{htdocs}/jsMath/jsMath-ww.js";
and change $pg{displayModeOptions}{jsMath} to be
$pg{displayModeOptions}{jsMath} = {
reportMissingFonts => 0, # set to 1 to allow the missing font message
missingFontMessage => undef, # set to an HTML string to replace the missing font message
noImageFonts => 0, # set to 1 if you didn't install the jsMath image fonts
};

For pg/macros/PG.pl, it looks like you should be able to get the current version of that without ill effect (but save the old one just in case). You can either check it out using CVS (analogous to the example above), or get a copy from the web version of CVS at

  http://cvs.webwork.rochester.edu/viewcvs.cgi/pg/macros/PG.pl?cvsroot=UR+WeBWorK+System

Hope that works for you.

Davide

<| Post or View Comments |>


userRobin Cruz - Re: Math fonts not displaying correctly on the screen  blueArrow
9/8/2005; 3:24:22 PM (reads: 1114, responses: 0)
I think you are right about most of my problems with the fonts being the version of WeBWorK I was using. So, I reinstalled WeBWorK 2 from the CVS. (I'm getting kind of good at it-- it only took a few hours.) My ssh implemention must have been compatible with the Option 2 method of accessing the CVS since I was been able to access it. I downloaded from the rel-2-1-patches.

I followed your instructions (note: There was a minor typo in the wwcvs command-- it should be: "wwcvs -d"), and everything was fine until I tried to use the new PG.pl file. I used the link in your note and downloaded the newest version. It opened in a web page, but I copied it into an editor and saved it as PG.pl. I also saved a copy of the old PG.pl file as you recommended. When I restarted the server and logged into my test course, I got the following error message which showed up for all of the problems in my test course as well as for the screen header: ------


WeBWorK Error

WeBWorK has encountered a software error while attempting to process this problem. It is likely that there is an error in the problem itself. If you are a student, report this error message to your professor to have it corrected. If you are a professor, please consult the error output below for more information. Error messages

Can't use an undefined value as a HASH reference at line 529 of [PG]/macros/PG.pl Died within main::ENDDOCUMENT called at line 29 of [TMPL]/setM151_00Review/screenHeader.pg Error details

Problem0 ERROR caught by Translator while processing problem file:setM151_00Review/screenHeader.pg * Can't use an undefined value as a HASH reference at line 529 of [PG]/macros/PG.pl Died within main::ENDDOCUMENT called at line 29 of [TMPL]/setM151_00Review/screenHeader.pg

* ----


I put the old PG.pl back, restarted the server and the error mesage went away and everything seems to work -- including the fonts. The global.conf file still has the changes you suggested and I can see the jsMath icon in the lower right corner as you said I should if v2 were running.

Is there another version of the PG.pl file I should be using?

Thanks so much for all your help -- rac

<| Post or View Comments |>


userDavide P. Cervone - Re: Math fonts not displaying correctly on the screen  blueArrow
9/8/2005; 5:04:06 PM (reads: 1125, responses: 0)
There are changes that you will need to make to PG.pl in order to have it work reliably (it will not work in all situations with the PG.pl from 2-1-patches). You will have to make them manually (first make a backup of PG.pl again, just in case). There are two places you need to make changes.

The first is around line 176, where you should replace

       $STRINGforOUTPUT = '<SCRIPT SRC="'.$main::envir{jsMathURL}.'"></SCRIPT>' . "\n" .         
'<NOSCRIPT><CENTER><FONT COLOR="#CC0000">' .
'<B>Warning: the mathematics on this page requires JavaScript.<BR>' .
'If your browser supports it, be sure it is enabled.</B>'.
'</FONT></CENTER><p></NOSCRIPT>' .
$STRINGforOUTPUT if ($main::envir{displayMode} eq 'HTML_jsMath');
to
         if ($main::envir{displayMode} eq 'HTML_jsMath') {
my $prefix = "";
if (!$main::envir{jsMath}{reportMissingFonts}) {
$prefix .= '<SCRIPT>noFontMessage = 1</SCRIPT>';
} elsif ($main::envir{jsMath}{missingFontMessage}) {
$prefix .= '<SCRIPT>missingFontMessage = "'.$main::envir{jsMath}{missingFontMessage}.'"</SCRIPT>';
}
$STRINGforOUTPUT =
$prefix .
'<SCRIPT SRC="'.$main::envir{jsMathURL}.'"></SCRIPT>' . "\n" .
'<NOSCRIPT><CENTER><FONT COLOR="#CC0000">' .
'<B>Warning: the mathematics on this page requires JavaScript.<BR>' .
'If your browser supports it, be sure it is enabled.</B>'.
'</FONT></CENTER><p></NOSCRIPT>' .
$STRINGforOUTPUT;
$STRINGforOUTPUT .= '<SCRIPT>jsMath.Setup.Script("plugins/noImageFonts.js")</SCRIPT>'
if ($main::envir{jsMath}{noImageFonts});
}

Then at around 448, change

     $STRINGforOUTPUT .= '<SCRIPT> jsMath.ProcessBeforeShowing() </SCRIPT>'
if ($main::envir{displayMode} eq 'HTML_jsMath');
to
     $STRINGforOUTPUT .= '<SCRIPT> jsMath.wwProcess() </SCRIPT>'
if ($main::envir{displayMode} eq 'HTML_jsMath');

That should do it. I'm glad that the fonts seem to be working for you.

Davide

<| Post or View Comments |>


userRobin Cruz - Re: Math fonts not displaying correctly on the screen  blueArrow
9/9/2005; 11:34:23 AM (reads: 1150, responses: 1)
The PG.pl file I downloaded (which does not work) had the changes already except the second set of lines were a lot further down in the file - line 519. (Note: I downloaded the PG.pl file from the very top of the download page.) The error is occurring at line 529 (don't know if there is any connection.)

So far, things are "working" with the old PG.pl file, but I'm sure I have not tested all possible situations. I am still interested in finishing this update if there is anything else I should do.

Let me know and thanks again for all your help -- rac

<| Post or View Comments |>


userDavide P. Cervone - Re: Math fonts not displaying correctly on the screen  blueArrow
9/9/2005; 11:56:28 AM (reads: 1231, responses: 0)
Yes, I know the new one had those lines, but the old one doesn't, so you need to copy those. The reason the new one didn't work is that is also included OTHER changes that are related to updates in other files, and you DON'T want THOSE. So you need to manually copy the changes needed fot jsMath from the new PG.pl to the old one. I gave you the line numbers in the OLD file, not the new one. Yes, those lines in the new PG.pl are in a different location.

You should copy the new jsMath lines from the new PG.pl into the one you have. This is important for making it work reliably with MSIE. The code in the old PG.pl will work most of the time, but there are situations where it will not. (The last change from ProcessBeforeShowing to wwProcess is the most important one.)

Davide

<| Post or View Comments |>


userRobin Cruz - Re: Math fonts not displaying correctly on the screen  blueArrow
9/14/2005; 11:33:26 AM (reads: 1132, responses: 2)
The code in the (old) PG.pl file for the first change I am to make is not quite the same as what you gave me to look for. This is the code in the file the system is currently using: --

 

$STRINGforOUTPUT =
$prefix .
'<SCRIPT SRC="'.$main::envir&#123;jsMathURL&#125;.'"></SCRIPT>' . "n" .
'&lt;NOSCRIPT><CENTER><FONT COLOR="#CC0000">' .
'<B>Warning: the mathematics on this page requires JavaScript.<BR>' .
'If your browser supports it, be sure it is enabled.</B>'.
'</FONT></CENTER><p>&lt;/NOSCRIPT>' .
$STRINGforOUTPUT;
&#125;

$STRINGforOUTPUT = '<SCRIPT SRC="'.$main::envir&#123;asciimathURL&#125;.'"></SCRIPT>' . "n" .
'<SCRIPT>mathcolor = "black"</SCRIPT>' . $STRINGforOUTPUT
if ($main::envir&#123;displayMode&#125; eq 'HTML_asciimath');

--


The code for the second change is as you sent.

Should I still change what I have to what you suggested?

<| Post or View Comments |>


userDavide P. Cervone - Re: Math fonts not displaying correctly on the screen  blueArrow
9/14/2005; 4:48:24 PM (reads: 1221, responses: 0)
Whatever the lines are, you need to replace the code block
    if ($main::envir{displayMode} eq 'HTML_jsMath') {
...
}
by the corresdponding code from the current version of PG.pl. The last lines of the code you show above is for asciimath mode; you should not remove that.

Davide

<| Post or View Comments |>


userDavide P. Cervone - Re: Math fonts not displaying correctly on the screen  blueArrow
9/14/2005; 7:04:24 PM (reads: 1229, responses: 0)
PS, you should also change the second section as well. That is the most important one to change.

Davide

<| Post or View Comments |>


userRobin Cruz - Re: Math fonts not displaying correctly on the screen  blueArrow
9/15/2005; 2:00:30 PM (reads: 1093, responses: 0)
OK. I think things are looking good. I made the changes and restarted our service -- so far, so good!

Thanks for all your help -- rac

<| Post or View Comments |>