WeBWorK Main Forum

status of underscore in hardcopy generate

status of underscore in hardcopy generate

by Joel Trussell -
Number of replies: 2
my problem (teaching Matlab) uses the underscore in the problem statement

ind_p1 = t>=0 & t<1;
ind_p2 = t>=0 & t<2;
ind_p3 = t>=-1 & t< 0;
ind_p4 = t>=0 & t<3;
ind_p5 = t>=3 & t< 4;
ind_p6 = t>=1 & t < 2;
ind_p7 = t>=0 & t < 10;
ind_p8 = t>-10 & t<=0;

when I try to generate hardcopy of the problem set I get the error

First error in TeX log is:
! Missing $ inserted. <inserted text> $ l.237 \leavevmode\\\relax ind_ p1 = t>=0 & t<1; I've inserted a begin-math/end-math symbol since I think you left one out. Proceed, with fingers crossed.
Is it possible generate hardcopy with an underscore?

I didn't see anything in the forum search.
In reply to Joel Trussell

Re: status of underscore in hardcopy generate

by Nathan Wallach -
PG defined $US as underscore, as it is a special character in LaTeX so needs special handling, as do characters like '<' which have a special meaning in HTML. Have a look at pg/macros/PGbasicmacros.pl


Pulling out of that file - here is a list of most of those special macros. I did not include begin/end macros for formatting features.

$PAR PAR() paragraph character (\par or <p>)
$BR BR() line break character
$BRBR BRBR() line break character
$LQ LQ() left double quote
$RQ RQ() right double quote
$LTS LTS() strictly less than
$GTS GTS() strictly greater than
$LTE LTE() less than or equal
$GTE GTE() greater than or equal
$US US() underscore character
$SPACE SPACE() space character (tex and latex only)
$NBSP NBSP() non breaking space character
$NDASH NDASH() en dash character
$MDASH MDASH() em dash character
$HR HR() horizontal rule
$LBRACE LBRACE() left brace
$LB LB () left brace
$RBRACE RBRACE() right brace
$RB RB () right brace
$DOLLAR DOLLAR() a dollar sign
$PERCENT PERCENT() a percent sign
$CARET CARET() a caret sign
$PI PI() the number pi
$E E() the number e
$LATEX LATEX() the LaTeX logo
$TEX TEX() the TeX logo
$APOS APOS() an apostrophe
In reply to Nathan Wallach

Re: status of underscore in hardcopy generate

by Davide Cervone -
Alternatively, use PGML, which handles special characters properly in all output modes without special handling on the part of the author.