Forum archive 2000-2006

Andy Wildenberg - equations embedded in tables

Andy Wildenberg - equations embedded in tables

by Arnold Pizer -
Number of replies: 0
inactiveTopicequations embedded in tables topic started 9/25/2001; 11:33:08 AM
last post 9/25/2001; 1:32:47 PM
userAndy Wildenberg - equations embedded in tables  blueArrow
9/25/2001; 11:33:08 AM (reads: 1447, responses: 3)
I have a strange problem. I am using the begintable/endtable in some of my problems, and embedding formulas in the row commands using the '( )' format. When I do this, the formulas work fine in 'paper' mode, and in 'typeset' mode, but they aren't parse in 'Latex2HTML' mode. Any idea what I can do to change this and/or make this work?

<| Post or View Comments |>


userAndy Wildenberg - Re: equations embedded in tables  blueArrow
9/25/2001; 11:36:13 AM (reads: 1714, responses: 0)
BTW, here is one of my tables (slightly redacted).
TEXT(
begintable(2),
row( 'a', 'Idempotent Law'),
row( 'b', 'Double Negation'),
row( 'c', 'De Morgan~~'s Law'),
row( 'j', 'Identity Laws \((p \vee f = p \wedge t = p) \) '),
row( 'k', 'Tautology \((p vee \neg p = t) \) '),
row( 'l', 'Contradiction \((p \wedge \neg p = f) \) '),
row( 'm', 'Negation of the goal to prove '),
row( 's', 'Disjunctive Addition'),
endtable()
);

<| Post or View Comments |>


userMichael Gage - Re: equations embedded in tables  blueArrow
9/25/2001; 1:25:48 PM (reads: 1697, responses: 0)
Hi,

I think you are having the trouble in the "formatted text" mode in which the TeX code is run through Hutchinson's tth filter to produce HTML (as opposed to producing gifs as in Latex2HTML = typeset mode). In TeX (paper) and Latex2HTML (typeset) modes the entire problem is set in TeX and then run through the TeX interpreter. In "formatted text" mode only the equations are run through the TeX interpreter and in order for this to happen the string containing the TeX code goes through one of the two PG evaluators: "EV2" or "EV3". The BEGIN_TEXT/END_TEXT construction is "syntactic sugar" for passing all of the enclosed text through EV3.

(More details on this at http://webhost.math.rochester.edu/webworkdocs/docs/pglanguage/pod/pgbasicmacros#evaluation%20macros and at http://webhost.math.rochester.edu/webworkdocs/docs/pglanguage/tutorial/problemtext)

Here is one way to solve the problem: Others appear in the next message.

Hope this helps.

-- Mike

############
BEGIN_TEXT
\{begintable(2)\}
\{ row( 'a', 'Idempotent Law')\}
\{ row( 'b', 'Double Negation')\}
\{row( 'c', "De Morgan's Law")\}
\{row( 'j', 'Identity Laws \((p \vee f = p \wedge t = p) \) ' ) \}
\{row( 'k', 'Tautology \((p \vee \neg p = t) \) ')\}
\{row( 'l', 'Contradiction \((p wedge \neg p = f) \) ')\}
\{ row( 'm', 'Negation of the goal to prove ')\}
\{row( 's', 'Disjunctive Addition')\}
\{endtable() \}
END_TEXT
Notice that each command has to be in a separate \{ \} construction, since only the output from the last command is printed. Also notice the use of double quotes for "De Morgan's Law" so that I can write the enclosed single quote without resorting to the ~~ construction. You could also use q/De Morgan's Law/. (see the section on quotes in http://webhost.math.rochester.edu/webworkdocs/docs/pglanguage/tutorial/perlbasics for a little more info, and the Perl manual for a lot more about Perl's powerful and versatile quoting methods.

 

 

<| Post or View Comments |>


userMichael Gage - Re: equations embedded in tables  blueArrow
9/25/2001; 1:32:47 PM (reads: 1690, responses: 0)
Here are some other possibilities. I list them mainly as an aide to understanding what can become a rather tricky business: evaluating complicated text. In particular the problem of handling the backslash \ can be very delicate, since the proper way to write it depends on how many times the text string is going to be evaluated. (Incidently -- to prodcue a backslash in these discussion notes you need to double it: \\ becomes \. To achieve the proper spacing and line breaks put all code between <pre> .... </pre> (stands for preformatted) tags.

 

TEXT( 
begintable(2),
row( 'a', 'Idempotent Law'),
row( 'b', 'Double Negation'),
row( 'c', 'De Morgan~~'s Law'),
row( 'j', EV3( 'Identity Laws \\((p \\vee f = p \\wedge t = p) \\) ' )),
row( 'k', EV2('Tautology \((p \vee \neg p = t) \) ' )),
row( 'l', EV2('Contradiction \((p wedge neg p = f) \) ')),
row( 'm', 'Negation of the goal to prove '),
row( 's', 'Disjunctive Addition'),
endtable()
);
Notice that you need to double the backslashes for EV3 but not for EV2.
TEXT(EV2(
begintable(2),
row( 'a', 'Idempotent Law'),
row( 'b', 'Double Negation'),
row( 'c', 'De Morgan~~'s Law'),
row( 'j', 'Identity Laws \((p \vee f = p \wedge t = p) \) ' ),
row( 'k', 'Tautology \((p \vee \neg p = t) \) '),
row( 'l', 'Contradiction \((p \wedge \neg p = f) \) '),
row( 'm', 'Negation of the goal to prove '),
row( 's', 'Disjunctive Addition'),
endtable()
));



TEXT(EV3(
begintable(2),
row( 'a', 'Idempotent Law'),
row( 'b', 'Double Negation'),
row( 'c', "De Morgan's Law"),
row( 'j', 'Identity Laws \\((p \\vee f = p \\wedge t = p) \\) ' ),
row( 'k', 'Tautology \\((p \\vee \\neg p = t) \\) '),
row( 'l', 'Contradiction \\((p \\wedge \\neg p = f) \\) '),
row( 'm', 'Negation of the goal to prove '),
row( 's', 'Disjunctive Addition'),
endtable()
));

<| Post or View Comments |>