[LON-CAPA-users] modify/view latex code for lon-capa exam?

Stuart Raeburn raeburn at msu.edu
Wed Jul 8 13:36:54 EDT 2015


Hi Uma,

> I'd like to add
> some more/reduce space at a particular point so that a new question shows
> up on a new page).

In the printout generation menu, there is a checkbox: "Start new page
before selected" available for each resource in the folder being  
printed, if you need to force a new question to begin on a new  
page/column.

As an alternative (especially if you are using a two column printout,  
and you are not using randompick in the folder), you may prefer to  
create a "blank" HTML page which includes a <tex></tex> section for  
the printout target containing \strut and \newpage) in Authoring  
Space, and publish, and then import one or more of those into the  
course at the appropriate point in the folder, wherever you need to  
insert a page break when creating a printout PDF, e.g.,

<html>
<head>
<title>Empty Page</title>
</head>
<body>
<tex>
\strut
</tex>
<tex>
\strut
</tex>
<tex>
\newpage
\strut
</tex>
</body>
</html>

> ... For some reason, the
> formatting is not right( for example, the .problem file has an html table
> that displays correctly in Lon-Capa but not in the pdf;

By default the TeX rendering of an HTML table in LON-CAPA will  
generate a table with a width of 70% of the current column width in  
the printout. By default
each table column will have the same width, i.e, if there are 2 columns,
each with be 50% of the table width, if there are three columns each  
will be 33% of the table width etc.

You can also use the standard HTML attribute of colspan for all <td>  
and <th> tags in a particular to control the relative width of table  
columns in the printout. For example if you have a table with two  
columns, including the colspan="2" attribute for each <td> cell in the  
first column will result in a table in which the first column is 67%  
of the table width, and the second is 33% of the table width.

You can also control the width of a table, and the width of individual  
table columns by including a TeXwidth attribute in the <table> tag and  
in the <td> or <th> tags respectively.

The default unit (i.e., if none is specified) is cm. When used for the  
table tag you can also use % as a "unit" for TeXwidth whereas for <td>  
and <th> you can only use mm, cm or in.

The TeXwidth attribute will only affect the TeX version (i.e., in PDF  
printouts) and the web view will be unchanged.

The HTML attribute: border="1" will cause the table to have an external
border and also internal borders for all cells. The attribute  
rules="none" will eliminate cell borders in both web and TeX rendering  
, while the table's external border will be retained for border="N"  
where N is an integer greater than zero.)

If you want complete control over the rendering of a table in TeX  
(used for printout generation) you can create two separate versions of  
thetable: one, wrapped by <web></web> tags would include the HTML tags  
and would provide the rendering when viewed within a web browser; the  
second, wrapped by <tex></tex> tags would include TeX to define the  
layout of the table when viewed within the PDF printout.

Stuart Raeburn
LON-CAPA Academic Consortium

Quoting Uma Ravat <ravat1 at illinois.edu>:

> Hi,
>
> I'm creating a Lon-Capa exam and am wondering if it is possible to edit the
> latex code for the exam that LonCapa is generating. For some reason, the
> formatting is not right( for example, the .problem file has an html table
> that displays correctly in Lon-Capa but not in the pdf; or I'd like to add
> some more/reduce  space at a particular point so that a new question shows
> up on a new page).
>
> Is there a way to modify the latex code that is being generated?
>
> Best,
>
> Uma
>
> Uma Ravat
> Department of Statistics
> University of Illinois at Urbana-Champaign



More information about the LON-CAPA-users mailing list