[LON-CAPA-users] Help with formatting

Lars Jensen lon-capa-users@mail.lon-capa.org
Thu, 30 Oct 2003 10:54:58 -0800 (PST)


Hi Felicia,

Something like this works, although not perfectly (there's a small space
after the whole part):

<script type="loncapa/perl">#Enter the computations here
$a=&random(1,9,1);
$b=&random(1000,2000,1);
$c=&random(100,999,1);
$d=&random(1,9,1);
</script>
<startouttext />Enter the problem text here.

<m eval="on">
\begin{tabular}{r @{.} l}
$a & $c \\ 
$b & $d \\ 
\end{tabular}
</m>

<endouttext />

Lars.
On Thu, 30 Oct 2003, Felicia Berryman wrote:

> > You can use sprintf to properly format things.
> 
> What is sprintf?
> 
> > Or
> > 
> > <table>
> > <tr><td align="right">4</td><td>.</td><td align="left">54</td></tr>
> > ...
> > 
> > You can use perl to divide the number up and display it this way.
> > 
> > Let me know if you need full working code.
> 
> I think this is the solution I need.  I would appreciate knowing some of 
> the perl to at least divide the number.  I should be able to figure out 
> the rest on my own.  Dividing the number up is necessary especially when 
> you don't know where the decimal point will show in your randomly 
> generated number.
> 
> I was hope TeX would have something easy for this, but I guess most 
> people don't write elementary math text in TeX.
> 
> Thanks!
> -- 
> Felicia Berryman
> LON-CAPA Coordinator
> Michigan State University
>    Email:  felicia@lon-capa.org
>    Phone:  (517)432-9866
> http://www.lon-capa.org
> 
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users@mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
> 

--
Lars Jensen, TMCC/Vista B200, 7000 Dandini Blvd, Reno NV 89512-3999. 
Internet: <jensen@physics.unr.edu>, http://www.scsr.nevada.edu/~jensen/
Tel: 775.673.7113  FAX: 775.674.7592