Forum archive 2000-2006

Šarūnas Burdulis - Brace macro expansion

Šarūnas Burdulis - Brace macro expansion

by Arnold Pizer -
Number of replies: 0
inactiveTopicBrace macro expansion topic started 6/7/2006; 11:33:09 AM
last post 6/8/2006; 9:05:09 AM
userarūnas Burdulis - Brace macro expansion  blueArrow
6/7/2006; 11:33:09 AM (reads: 508, responses: 5)
Using Webwork and PG 2.2.0. When $LBRACE and $RBRACE macros are used as in the problem context below, they do not correctly expand in HTML view as { and }. Instead 'lbrace' and 'rbrace' are generated. The same is with $LB and $RB. LBRACE() is output as 'lbrace' too. $DOLLAR and $PERCENT work correctly. Any ideas what we are missing here?

Thanks, Sarunas

DOCUMENT();

loadMacros( PG.pl, PGbasicmacros.pl, PGchoicemacros.pl, PGanswermacros.pl, PGauxiliaryFunctions.pl ); ... ... ...

TEXT(beginproblem());

BEGIN_TEXT $LBRACE $RBRACE END_TEXT ... ... ...

ENDDOCUMENT();

<| Post or View Comments |>


userMichael Gage - Re: Brace macro expansion  blueArrow
6/7/2006; 12:39:08 PM (reads: 626, responses: 0)
This is a bug. \lbrace and \rbrace are supposed to be defined in a preamble file which is loaded before running tex on the formula. For some reason the file is not being loaded. I've added this to the bug list. It may take a few days to track down how this behavior arose so that we can fix it properly without creating some new bug. :-)

-- Mike

<| Post or View Comments |>


userJohn Jones - Re: Brace macro expansion  blueArrow
6/7/2006; 1:48:53 PM (reads: 617, responses: 0)
\lbrace and \rbrace are standard commands in LaTeX, but they are only valid in math mode. Perhaps a solution would be to have $LBRACE expand to \ensuremath\lbrace in TeX mode.

John

<| Post or View Comments |>


userMichael Gage - Re: Brace macro expansion  blueArrow
6/7/2006; 3:53:09 PM (reads: 612, responses: 0)
That's probably a good idea, but the problem here is deeper, I think. For some reason the Tex preamble is not being read in either image or "formatted text", i.e. tth mode.

Still haven't tracked it down completely, but you can look in the bug reports to see the progress so far.

http://bugs.webwork.rochester.edu/show_bug.cgi?id=1034

<| Post or View Comments |>


userMichael Gage - Re: Brace macro expansion  blueArrow
6/7/2006; 5:40:37 PM (reads: 618, responses: 1)
Two things to try. First, as John Jones remarks above, make sure that the \lbrace and \rbrace are inside math mode:

 

BEGIN_TEXT 
\( $LBRACE $RBRACE \)



END_TEXT



since TeX code is only evaluated inside one of the math modes.

This will probably fix the problem. If not

you may need to place the line:

use WeBWorK::Constants;

in the file pg/lib/WeBWorK/PG/ImageGenerator.pm

just after

use WeBWorK::EquationCache;

<| Post or View Comments |>


userarūnas Burdulis - Re: Brace macro expansion  blueArrow
6/8/2006; 9:05:09 AM (reads: 713, responses: 0)
Thank you!

( $LBRACE $RBRACE )

does the trick.

Sarunas

<| Post or View Comments |>