(Category) (Category) LON-CAPA User Help :
Authoring
Anything related to authoring
Subcategories:
(Category) Authoring Problems
(Category) Authoring Maps
(Category) Publishing

Answers in this category:
(Answer) Is there any place I can learn the LON-CAPA vocabulary?
(Answer) Information co-authors
(Answer) I just want a list of all the tags and functions supported by LON-CAPA
(Answer) What's better, HTML formatting or TeX formatting?
(Answer) <m > tag?
(Answer) samba help, (I mapped my LON-CAPA server on my windows machine)?
(Answer) How do I get rid of unmatched tag warnings?
(Answer) Can I incorporate Power Point slides into LON-CAPA?
(Answer) How do I create a new page?
(Answer) When I try to construct a new item, all I see is the login screen below the construction bar.
(Answer) Can I have conditional rendering of HTML?
(Answer) Can I make a document link back to me, or elsewhere?
(Answer) Can I jump into the middle of a page?
(Answer) Can I highlight something in somebody else's page?
(Answer) How can I change the looks of a page for my course?
(Answer) Can I have multilingual resources?
(Answer) How do I add an image
(Answer) Can I (or how can I) include an .eps file image in a LONCAPA problem?
(Answer) What HTML greek chatacters can I use safely?
(Answer) How can I edit my resources using search and replace methods?
(Answer) New Item
(Answer) New Item

[New Answer in "Authoring"]
(Category) (Category) LON-CAPA User Help : (Category) Authoring :
Authoring Problems
Homework Problems, etc
Subcategories:

Answers in this category:
(Answer) HTML to TeX conversions
(Answer) Why can't the students see the <img>s that the author sees?
(Answer) Can one safely omit "<th>" tags in "<table>"s if headers are undesired?
(Answer) Why did I get text boxes instead of drop-down boxes in the option-response editior?
(Answer) What's a foil?
(Answer) My students see 1.33333333333 as their answer, can I format this?
(Answer) How can I add a picture to my problem?
(Answer) How do I create a problem?
(Answer) How do I display dollar signs in my problem?
(Answer) How do I code an absolute value?
(Answer) Parameters for parts problems
(Answer) Where are the LON-CAPA units defined?
(Answer) How do units work?
(Answer) How do I define the default tolerance of a problem?
(Answer) temperature units
(Answer) Is there anything special I need to do to prepare for exam-style questions?
(Answer) tolerance?
(Answer) Formula response questions with XML example
(Answer) How do I put a table in my problem?
(Answer) What do I do about warnings?
(Answer) Display TeX, using &tex, <tex >, <web >, etc
(Answer) Is there a LON-CAPA analog to the CAPA functions?
(Answer) When I click ScriptVars in constructions space, what does $" mean?
(Answer) How do I center an entire problem, including the [Submit Answers] button?
(Answer) How do I make a dynamically generated plot?
(Answer) How can I create a dynamic plot of a piecewise defined function?
(Answer) Gnuplot Example 1
(Answer) Gnuplot Example 2
(Answer) Can I create a problem which presents a choice from completely different questions?
(Answer) Equation Entry Example
(Answer) When to use <display> tag
(Answer) Adaptive Hints
(Answer) How do I make a multi-part problem
(Answer) How do I have hints show up after more than 1 try?
(Answer) How can I hard code the default maximum number of tries in a problem.
(Answer) how to display variables that must be parsed first
(Answer) Specifying wrong answers for exam mode
(Answer) multiple correct answers for String Response problems using Regular Expressions
(Answer) How can I use the quantity "pi" in a formularesponse?
(Answer) New Item

[New Answer in "Authoring Problems"]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
HTML to TeX conversions
Will <table >s get converted well to TeX tables for printing-- or should one set up tables in TeX and use <m > to convert them to HTML?

Yes, html tables will be converted to TeX in the print script. If you wish, you can put a TeX table in the resource using the <m > tag instead. Either method will work.

[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
Why can't the students see the <img>s that the author sees?
Trivial answer:

Possibly because the author needs to include appropriate <allow > tags in the XML for the specific images. These tags are generated automatically for "non-dynamic" <img > tags but not for dynamically specified ones.

Thus, for example:

<img src="/res/domain/name/subdir/$variable.gif" /> will cause the tag

<allow src="res/domain/name/subdir/$variable.gif" /> to be automatically generated and appear just prior to the </problem > tag. However, that is non-functional because there is no specific image having that name. (It would probably be better if it were not generated at all.) The author will have to hand-generate an appropriate allow tag for any images that may translate to $variable.gif.

A global specification such as <allow src="/res/domain/name/subdir/*.gif" /> seems to work OK.

[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
Can one safely omit "<th>" tags in "<table>"s if headers are undesired?
<th ></th > tag is not necessary, but headers can help make your resource more accessible, especially with users with visual impairments that use screen-readers to view the web.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
Why did I get text boxes instead of drop-down boxes in the option-response editior?
If you create an option response problem, the options that correspond to all of your foils MUST be listed as an option.

The template defaults with the options "True" and "False", but you want the options "Red", "Blue", and "Green". If you delete "True" and "False" first, you will notice that the foils have the words "True" and "False" in text boxes now. This is because the option does not exist in the main list.

To avoid this problem, add all your new options first, change the foils to what you want them to be and pick the correct option for each foil. Finally, you can delete the options you don't want, in this case "True" and "False"

When deleting an option from a multiple option response problem, in order to avoid losing the information associated with the foils associated with the option, the "correct option" entry is made a text entry box. This allows you to add a new option and change the preexisting foils to match this new option. Otherwise you would have to reenter the foils to change the option name.

All foils for an <optionresponse> question only will present the options from the list of options you defined.
The "Typed In Value" option does not allow a student to "type in" a value but for an instructor to say that the correct option for ths foil comes from a variable.
This option is most often used when coupled with a <randomlabel> problem. Or where you are randomizing the probelm text.
If you want the student to provide a typed in answer, use the String Response.

[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
What's a foil?
"Foil" is the term we used for the statements in radio-response and option-response problems.  For example:

Which of the statements are true and which are false:
2 is greater than 4
5 is less than 10
7 is odd
6 is odd
4 is even

Each of the statements above are a foil and the "options" are True and False given in the drop-down boxes.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
My students see 1.33333333333 as their answer, can I format this?
Yes.  In the parameter for the numerical response, you can use the following:

2e  (answer will display as 1.33e01)
2f  (answer will display as 1.33)
$format (you can use a variable where $format evaluates to something like "2e".

For those who use XML to code thier problems:

<numericalresponse answer="$answer"> (shows all digits)
<numericalresponse answer="$answer" format="2e"> (for example prints 1.23e-04)
<numericalresponse answer="$answer" format="$format"> 
<numericalresponse answer="@answer"> (shows all digits of all answers)
<numericalresponse answer="@answer" format="2e"> (shows all answers in 2e)
<numericalresponse answer="@answer" foramt="$format"> 
<numericalresponse answer="@answer" foramt="@format">
If you want your answers to a numerical problem to display only digits
after the decimal when answers are shown, then enter "2f" in the format
box next to the numerical answer box.

2f - 3.333333 will be displayed 3.33
0f - 3.333333 will be displayed 3
2E - 333.3333 will be displayed 3.33 E2
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
How can I add a picture to my problem?
First, you will need to upload the graphic (e.g. .gif or .jpg file) to your construction space and then publish it. THen in the text area of your problem, add the following:
        <img src="/res/DOMAIN/AUTHOR/directory-of-picture/picture.jpg" />
(Advanced Users) You can also have:
        <img src="$picture" />
If $picture is one of many ranomized graphics, you will need to "Edit XML" and add all the various graphics to the <allow > tags at the bottom. Look at other problems that have images to see how the <allow > tag should be formatted.
More complete is the following:
<img src="picture.jpg" alt="(Picture of Large Duck)" width="400" TeXwidth="50%" />
This will probably alternate text for ADA-compliance and non-graphical browsers. The Web version will show up at 400 pixels wide (though it's typically better to use the natural width of the figure). In this case, the width of the figure in TeX will be half of one column.

[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
How do I create a problem?
To create problems, do the following:

1.) Become author
2.) Go into the appropriate folder
3.) In the drop-down box near the very top that says "Select Action" select 
the option "New Problem"
4.) In the text-box next to the drop-down box that says "Type Name Here" type the
name of your new problem.
5.) Click Go
6.) Click the continue button after you are prompted on the new screen.
7.) Select a problem template on the new screen from the drop-down box.  
8.) Click the Create Problem button.
9.) Use the Edit button to edit the problem template.  
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
How do I display dollar signs in my problem?
if you did $dollar='$'; this will work however this is a bad
idea. Have them do this:

Script:
$a=&random(1,10,.01);

Text:
You have $${a} monies.

If they want to use $ in the answer they will need to do a string
answer type. They will also need to do this:

Script:
$a=&random(1,10,.01);
$answer='$'.$a;

Text:
You have $${a} or $answer monies.

Response:
<stringresponse answer="$answer">
You can also use:

<display>&prettyprint($var,'$2f')</display>
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
How do I code an absolute value?
in the script block:
$a=-2; $c=&abs($a);
in the text block: I have $a and $c.

displays:
I have -2 and 2.

[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
Parameters for parts problems
You should fill in the parameter fields as
Name: tol
Description: Tolerance

no matter which part it is in.

The system will take care of putting the [Part: num] for you when it
is published.  The same goes for sig and "Signficant Digits"
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
Where are the LON-CAPA units defined?
/res/adm/includes/capa.units

As of April 11, 2002:

# The LearningOnline Network with CAPA
# Physical Unit definitions
#
# $Id: 94,v 1.9 2003/06/13 20:08:58 apache Exp $
#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
#
# LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LON-CAPA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LON-CAPA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# /home/httpd/html/adm/gpl.txt
#
# http://www.lon-capa.org/
#
# 
# ======================= Unit section =============
# Base Unit
# name      symbol     comment

<< Base Unit >>

meter           m      # length
kilogram        kg     # mass
second          s      # time
ampere          A      # electric current
kelvin          K      # thermodynamic temperature
mole            mol    # amount of substance
candela         cd     # luminous intensity
decibel         dB     # log of pressure amplitude

#   Prefix     symbol     factor
<< Prefix >>

yotta            Y         10^{24}
zetta            Z         10^{21}
exa              E         10^{18}
peta             P         10^{15}
tera             T         10^{12}
giga             G         10^9
mega             M         10^6
kilo             k         10^3
hecto            h         10^2

deci             d         10^-1
centi            c         10^-2
milli            m         10^-3
micro            u         10^-6
nano             n         10^-9
pico             p         10^{-12}
femto            f         10^{-15}
atto             a         10^{-18}
zepto            z         10^{-21}
yocto            y         10^{-24}




# Derived Unit
# name       symbol     unit          comment
# name must be in oneword
<<Derived Unit>>

gram            g      0.001 kg      # mass
day             day    24.0 hr       # time
year            yr     365.24 day    # time
hour            hr     3600. s       # time
hour            h      3600. s       # time
minute          min    60 s          # time
pound           lb     0.45359237 kg # mass
ounce           oz     1.77185E-3 kg # mass
inch            in     2.54 cm       # length
foot            ft     12 in         # length
mile            mi     5280 ft       # length
yard            yd     0.9144 m      # length
nautical_mile   n_mi   6080 ft       # length, nautical mile (UK)
rood            rood   1210 yd^2     # area, rood
acre            acre   4840 yd^2     # area, acre
hertz           Hz     1/s           # frequency
litre           L      10^3*cm^3     # volume
newton          N      m*kg/s^2      # force
pound_force     lbf    4.44822 N     # force
dyne            dyn    1E-5 N        # force
pascal          Pa     N/m^2           # pressure, stress
bar             bar    1E5 Pa          # pressure
mmHg            mmHg   1.33322E2 Pa    # pressure, millimeter of mercury
torr            torr   1 mmHg          # pressure
atm             atm    760 torr        # standard atmosphere
joule           J      N*m             # energy, work, heat
electronvolt    eV     1.6021892E-19 J # energy
calorie         cal    4.1868 J        # energy
Btu             Btu    1.05506E3 J     # energy
watt            W      J/s             # power, radiant flux
coulomb         C      A*s             # electric charge
volt            V      J/C           # electric potential, electromotive force
ohm             ohm    V/A           # electric resistance, use this in /ANS
ohm             ohms   V/A           # electric resistance
ohm             Ohm    V/A           # electric resistance
ohm             Ohms   V/A           # electric resistance
siemens         S      1/Ohm         # electric conductance
farad           F      C/V           # electric capacitance
tesla           T      V*s/m^2       # magnetic flux density
weber           Wb     V*s           # magnetic flux
henry           H      V*s/A         # inductance
radian          rad    m/m            # plane angle
degree          deg    1.745329E-2 rad # plane angle (Pi rad=180 deg)
steradian       sr     m^2 /m^2        # solid angle
lumen           lm     cd*sr         # luminous flux
lux             lx     cd*sr/m^2     # illuminance
becquerel       Bq     1/s           # activity (radioactive)
gray            Gy     J/kg          # absorbed dose (of radiation)
sievert         Sv     J/kg          # dose equivalent (dose equivalent index)
astroUnit       AU     1.49598E11 m  # mean distance earth to sun
celcius         degC   1 K           # multiplicatively OK
farenheight     degF   .5555555555 K # multiplicatively OK
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
How do units work?
English  
http://capa4.lite.msu.edu/devolibrary/Links/UnitsSymbolsT2.html
Hungarian
http://capa4.lite.msu.edu/devolibrary/Links/UnitsSymbolsTh.html

The above pages describe how units are used in CAPA (and LON-CAPA).
If you enter two units with a space, multiplication assumed.  For example, if you 
enter "N m", that is that equivalent to a J.

Spaces are not allowed for the multiplier prefixes?  In other words, you can't 
enter "k m" and have that be equivalent to a km.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
How do I define the default tolerance of a problem?
> I have a pink parameters box so I can enter a tolerance.
> 
> What do I put in for Name?

tol

> What do I put in for Type?

tolerance

> What do I put in for Description?

Numerical Tolerance

> What do I put in for Default?

2%

> Are all of those fields necessary, or can I just put in "tol" for Name
> and "2%" for Default and leave the rest blank?

That would work, but without the tolerance for type, you can't change
it without changing the problem, and without a description it will
call it (tol) in the parmset screen.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
temperature units
There is K degC and degF 

degC == K

So don't ask for absolute temperatures, only delta tempatures.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
Is there anything special I need to do to prepare for exam-style questions?
The following is from an email from myself, Guy Albertelli, and Ed Kashy.

> As for the exam dual mode, I wonder if there is a way for Guy to program
> LON-CAPA such that if a problem is put in a *.exam file and it happens
> to be a <numerical responce> problem, then the conversion to exam mode
> will happen automatically.

This is the plan. There might need to be some hints from the
instructor about whether it is an online vs. a bubble sheet style
exam.


> I'm copying this message to Guy.  If Guy thinks that we will need to
> use an <exam-style > tag, 

We decided that this was an unnesseary idea.

Additionally when a .problem/.exam/.quiz/.survey file is stuck in to a
map you can change it's "behavior" from the default of what the
extension implies to however you care to use it.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
tolerance?
A tolerance of 2% means the student can be off by 2% and still get the answer correct. A tolerance of 2 means that the student can be off by +/-2
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
Formula response questions with XML example
<problem >
<script type="loncapa/perl">
        $coeff1=&random(1,5,.1);
        $coeff2=&random(1,5,.1);
        $power1=&random(1,4,1);
        $power2=&random(1,4,1);
        $answer="$coeff1*x^$power1+$coeff2*y^$power2";
</script >
<startouttext />Answer is <m eval="on">$ $answer $</m ><endouttext />
<formularesponse samples="x,y@1,-1:3,10#10;10,1.01:1000,-1000#4" answer="$answer">
    <responseparam name="tol" type="tolerance" description="Numerical Tolerance"
default="1%" />
    <textline size="50" />
    <hintgroup >
    </hintgroup >
</formularesponse >
</problem >


The samples is supposed to be the points you sample the equation
at. It lists the variables first (comma seperated) then an @ then

(
  (a comma seperated list of numbers equal to the number of variables)
 or
  (a comma seperated list of numbers equal to the number of variables,
  followed by an : followed by a comma seperated list of numbers equal
  to the number of variables, followed by a # folowed by an integer)
)

Then optionally a ; and more of the numbers
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
How do I put a table in my problem?
Make your variables in a script block:

$a = 1;
$b = 2;
$c = 3;
$d = 4;

Two ways to make a table:

First Method:

Make a table in dreamweaver (or any other html editor).  Use the
variables ($a, $b, etc.) in the table.  Take the html code from your
table (everything between <table > and </table >) and paste into the text
block.  

Auxilliary First Method: 

(I've never tried this, but give it a shot).  Save your table as some
file name, example table.html, and upload it to your construction
space.  In the textblock of your problem, type:
        <import >/res/msu/ciskepau/your-directory/table.html</import >
Tell me if this works!

Second Method:

Type the HTML code into the textblock yourself:

<table >
  <tr >
    <td > stuff for row one, column one </td >
    <td > stuff for row one, column two </td >
    <td > $a </td >
  </tr >
  <tr >
    <td > stuff for row two, column one </td >
    <td > stuff for row two, column two </td >
    <td > $b </td >
  </tr >
  <tr >
    <td > stuff for row three, column one </td >
    <td > stuff for row three, column two </td >
    <td > $c </td >
  </tr >
  <tr >
    <td > stuff for row four, column one </td >
    <td > stuff for row four, column two </td >
    <td > $d </td >
  </tr >
</table >
I've written a routine to produce tables easily for my problems which 
might be useful to people.  Here's a quick description of how to use it:

1) import the library
put this at the top of your problem (before any script blocks)
   <import>/res/msu/hamlinmi/lib/MyLib.library</import>

2) construct the table
In your perl script block, collect your table entries into an 
array (each row in sequence):
   $p1 = random(450,500);  # some random data...
      ...
   # the table entries in order...
   @data = ('age','number of births (thousands)',
      '18-25',$p1,
      '26-35',$p2,
      '36-50',$p3,
      '51-65',$p4);
   $table = &DTable(2,@data);   # create a 2-column table

3) display the table
In your problem text (or even outside of an "outtext" block)
simply
   <display>$table</display>


Notes using DTable:

1) the table is centered.  If you don't like that, use the 
GTable routine instead.  Currently thats the only difference 
between them.

2) because the table is displayed usnig <display>, entries in the 
table cannot contain markup (HTML), unless you specifically prepare 
them for both output modes, by using the web() function for example.
In other words, don't feed this to DTable:
    @data = ( '<i>heading</i>', 'data',   ... );
because although this would look fine on the web, it would NOT 
print properly.  If you really want those italics, do something 
like this instead, which should print fine:
    @data = ( web('','{\em heading}','<i>heading</i>'), '', ... );

3) columns are usually center aligned by default, although you can 
change this:
    $o_calign = 'rl';  # column alignments: right, left
    $table = &DTable(2,@data);
The $o_calign string has one letter for each column, acceptable
letters are {r, l, c}.  For those familiar with LaTeX, this 
string is passed as the first parameter for a tabular environment,
and you may also include vertical bars "|" for vertical dividers
in your table:
    $o_calign = 'c|cl';   # vertical bar between column 1 and 2
    $table = &DTable(3,@data);  # 3 columns
Currently you can only add bars to the LaTeX output, not the web
output.. (hope to get it for web too eventually)

4) other options to control the display of the table are also 
working.  Simply set the value of these variables before calling 
the DTable routine.
This one sets the absolute text size:
    $o_tsize = 3;   # use a large text font
    $o_tsize = -2;  # use small text (any value -4 to 5 accepted)
This one appends (or prepends) text to all table entries:
    $o_utag = ' cm';  # append ' cm' to every table entry
    $o_utag = '^the ';  # prepend 'the ' to every entry
    $o_utag = web('^$','^\$','^$');  # prepend $
This one prepends each table entry with a label (Note: if you use 
this, column alignment defaults to left instead of center):  
    $o_labelt = 'A';  # label entries with capital letters
    $o_labelt = 'a';  # label with lowercase letters
    $o_labelt = '1';  # label with numbers
These options currently affecting LaTeX output only (at some point 
they should affect web output too):
    $o_vskip = 2;        # add 2mm space after each line 
    $o_hbars = ' -  ';   # horizontal line below 1st row (3-row table)
    $o_hbars = '-   -';  # horizontal line above and below 4-row table

More improvements are eventually coming...
hamlinmi@msu.edu
Click on the link titled "Show this answer as Text" to see the code examples I gave in the correct form.
  
The FAQ-o-Matic has its own markup rules and it doesn't show the text as I typed it...
hamlinmi@msu.edu
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
What do I do about warnings?
GET RID OF THEM! Make sure all your tags have a closing tag or have a slash at the end (<br ></br > can be denoted <br />). Problems should have no warnings! Plain HTML pages _may_ be able to handles some of the warnings, but problems should be warning free.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
Display TeX, using &tex, <tex >, <web >, etc
&tex('tex argument','web argument')

could become
<tex >tex argument</tex ><web >web argument</web >


inside of <tex >, <m >, and &tex():
$ math mode $

$$ display equation mode $$

\[ display equation mode \]
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
Is there a LON-CAPA analog to the CAPA functions?
Yes, for example random(1.0,10.0,0.5) can be replaced by &random(1.0,10.0,0.5). All of the CAPA functions can work in the LON-CAPA script - just put a "&" in front.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
When I click ScriptVars in constructions space, what does $" mean?
$" is the default list seperator value. It always shows up. Don't worry about it.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
How do I center an entire problem, including the [Submit Answers] button?
> > The centering problem:
> > 
> > <problem >
> >   <startouttext />
> >     <center ><table ><tr ><td >
> >       <endouttext />
> >         <part >
> >         </part >
> >       <startouttext />
> >     </td ></tr ></table ></center >
> >   <endouttext />
> > </problem >
> > 
> > Works.  There is the problem of having no part 0 anymore, but if all of
> > their problems are based of this template all new problems will be a
> > part 11 problem.
> 
> Is the <part ></part > necessary?  
> 

Yes, if you want the submit button and computer feedback centered as well.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
How do I make a dynamically generated plot?
Dynamically generated plots are used to produce graphs which will be different for each student who views them. The plots are produced by calling 'gnuplot', and in fact the xml tag for the plots is <gnuplot >. Online help for the <gnuplot > tag is available by accessing the 'help' link when editing the problem.

Dynamically generated plots should be used in conjunction with a perl script block which generates the data to be plotted. If you are using static data a dynamically generated plot is not appropriate because of the overhead associated with generating the plot.

There are a great deal of parameters that can be set for a plot. These parameters are accessed by including various sub-tags. By default only the <gnuplot > tag and <curve > tag are present in a plot. The sub-tags allow you to define the axes of the plot, the presence of a key, the placement of gridlines, and the title and legends on the plot. The example given below shows the use of the <axis > sub-tag to set the domain and range shown in the graph.

Below is an example which produces a simple plot. To use it, create a new problem and [edit xml]. Remove all of the text and replace it with the text below:

 <problem>
 <script type="loncapa/perl">
 $amplitude = &random(3,5,1);
 for ($x=-6.0; $x<=6.0; $x+=0.05) {
     push @X,$x;
     push @Y, $amplitude * sin($x);
 }
 </script>
 <gnuplot font="medium" width="400" grid="on" height="300" border="on"  
      fgcolor="x000000" alttag="dynamically generated plot" align="center"  
      bgcolor="xffffff" transparent="off">
     <axis ymin="-6.0" ymax="6.0" xmin="-5.0" xmax="5.0" color="x000000" /> 
     <curve 
          linestyle="lines"
          pointtype="1"
          pointsize="1"
          name=""
          color="x000000">
         <data >@X</data>
         <data >@Y</data>
     </curve>
 </gnuplot>
 <startouttext /><br />
 What is the amplitude of this function?
 <endouttext />
 <numericalresponse answer="$amplitude">
     <responseparam type="tolerance" default="5%" name="tol" 
                    description="Numerical Tolerance" />
     <responseparam name="sig" type="int_range,0-16" default="0,15"  
                    description="Significant Figures" />
     <textline />
 </numericalresponse>
 </problem>
Below is a screenshot (in construction space) of the resulting plot.

(dynamically_generated_plot.gif)

It's likely that the above plot doesn't quite look right. It would be nice to have the gridlines drawn every 1 unit instead of every 2 units. A title, and labels on the axes, would be a nice addition. Although it's overkill for this example, we can also add a key for the plot. We can accomplish these changes by inserting sub-tags into the <gnuplot> tag.

Gridlines can be set using the <xtics> and <ytics> tags. The names of these tags correspond to the names of the commands used in gnuplot. We specify the beginning, end, and increment of the tick marks. Gnuplot only puts gridlines on the tick marks.

Inserting the <title>, <xlabel>, and <ylabel> commands allows us to set the title and axes labels as one would expect. Inserting a <key> tag, but not changing any of the information in it, signals gnuplot to place a key in the graph. If we decide we don't want the key, deleting the <key> tag will remove it from the graph.

These changes in the xml are shown below and a screenshot of the new plot is provided as well.

 <problem>
 <script type="loncapa/perl">
 $amplitude = &random(3,5,1);
 for ($x=-6.0; $x<=6.0; $x+=0.05) {
     push @X,$x;
     push @Y, $amplitude * sin($x);
 }
 </script>
 <gnuplot font="medium" width="400" grid="on" height="300" border="on"  
       fgcolor="x000000" alttag="dynamically generated plot" align="center"  
       bgcolor="xffffff" transparent="off">
     <key title="" pos="top right" box="off" />
     <ylabel >Y</ylabel>
     <xlabel >X</xlabel>
     <title >A sample plot</title>
     <xtics end="5.0" location="border" start="-5.0" increment="1.0" mirror="on" />
     <ytics end="6.0" location="border" start="-6.0" increment="1.0" mirror="on" />
     <axis ymin="-6.0" ymax="6.0" xmin="-5.0" xmax="5.0" color="x000000" />      
     <curve linestyle="lines" pointtype="1" pointsize="1" name="f(x)"   
         color="x000000">
         <data >@X</data>
         <data >@Y</data>
     </curve>
 </gnuplot>
 <startouttext />
 <br />
 What is the amplitude of this function?
 <endouttext />
 <numericalresponse answer="$amplitude">
     <responseparam type="tolerance" default="5%" name="tol" 
                    description="Numerical Tolerance" />
     <responseparam name="sig" type="int_range,0-16" default="0,15"  
                    description="Significant Figures" />
     <textline />
 </numericalresponse> 
 </problem>

(dynamic_plot_2.gif)

[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
How can I create a dynamic plot of a piecewise defined function?
I want to plot a piecewise defined function similar to
 f(x)= a*x + b     if (x < 4.5)
 f(x)= a*x         if (x >= 4.5)


Below is xml for creating a dynamic plot based on this. The work is done in the <script ></script > block that generates the data sets used in the plot.

 <script type="loncapa/perl" >
 $a = &random(2,5,1);
 $b = &random(3,6,1);
 
 for ($x = 0; $x<4.5; $x+= 0.05) {
     push @X, $x;
     push @Y, $a*$x + $b;
 }
 
 for ($x = 4.5; $x<=10; $x+= 0.05) {
     push @X, $x;
     push @Y, $a*$x;
 }
 </script >
 <gnuplot font="medium" width="500" grid="on" height="400" border="on" 
          fgcolor="x000000" alttag="dynamically generated plot" align="center" 
          bgcolor="xffffff" transparent="off" >
     <curve linestyle="lines" pointsize="1" pointtype="1" color="x000000" 
      name="">
         <data >@X</data >
         <data >@Y</data >
     </curve >
 </gnuplot >
The above script works, but it produces a plot that looks like the one below:
(dynamic_plot_piecewise_crappy_example.gif)


A better solution is to use two seperate <curve > statements to plot two separate curves. So on the second piece of the function we use @X2 and @Y2 instead of @X and @Y. Then in the <gnuplot > tag we include a second <curve > sub-tag.

 <script type="loncapa/perl" >
 $a = &random(2,5,1);
 $b = &random(3,6,1);
 
 for ($x = 0; $x<4.5; $x+= 0.05) {
     push @X, $x;
     push @Y, $a*$x + $b;
 }
 
 for ($x = 4.5; $x<=10; $x+= 0.05) {
     push @X2, $x;
     push @Y2, $a*$x;
 }
 </script >
 <gnuplot font="medium" width="500" grid="on" height="400" border="on" 
          fgcolor="x000000" alttag="dynamically generated plot" align="center" 
          bgcolor="xffffff" transparent="off" >
     <curve linestyle="lines" pointsize="1" pointtype="1" color="x000000" 
      name="" >
         <data >@X</data >
         <data >@Y</data >
     </curve >
     <curve linestyle="lines" pointsize="1" pointtype="1" color="x000000" 
      name="" >
         <data >@X2</data >
         <data >@Y2</data >
     </curve >
 </gnuplot >

(dynamic_plot_piecewise_better.gif)

This is still not a desirable result. Typically one wants an open circle or closed circle defining the domain of each piece. Unfortunately there is no easy way to do this in gnuplot currently. If this effect is desired, perhaps using a static image and a randomlabel problem would be the best approach. A second solution would be to add data which draws a circle to your curves.

[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
Gnuplot Example 1
<problem>

<script type="loncapa/perl">
# Enter computations here
$m = random(-3,3,2);
$b = random(-4,3,1);
$equation = "$m*x+$b";
</script>

<gnuplot font="small" samples="100" width="500" grid="on" height="300"
         alttag="Linear Plot" border="on" fgcolor="x000000" 
         align="center" bgcolor="xffffff" transparent="off">
    <xtics 
        end=" 10.0" 
        location="border" 
        start="-10.0" 
        increment="1.0" 
        mirror="on" />
    <ytics 
        end=" 10.0" 
        location="border" 
        start="-10.0" 
        increment="1.0" 
        mirror="on" />
    <axis ymin="-4.0" ymax="4.0" xmin="-6.0" xmax="6.0" color="x000099" />
    <xlabel>X</xlabel>
    <ylabel>Y</ylabel>
    <curve linestyle="lines" pointtype="0" name="Line" color="x000000">
        <function>$equation</function>
    </curve>
    <curve 
         linestyle="lines"
         pointtype="1"
         pointsize="1"
         name=""
         color="x000000" >
        <data>-10,0,10</data>
        <data>0,0,0</data>
    </curve>
    <curve 
         linestyle="lines"
         pointtype="1"
         pointsize="1"
         name=""
         color="x000000" >
        <data>0,0,0</data>
        <data>-10,0,10</data>
    </curve>
</gnuplot>

<startouttext /><br />
What is the slope of the line graphed above?
<endouttext />

<numericalresponse answer="$m">
    <responseparam name="tol" type="tolerance" description="Numerical Tolerance" default="5%" />
    <responseparam name="sig" type="int_range,0-16" description="Significant Figures" default="0,15" />
    <textline />

</numericalresponse>
</problem>


hallmat3@msu.edu
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
Gnuplot Example 2
<problem>

<script type="loncapa/perl">
# Enter computations here
#
# We will plot the graph of y=a sin((x-b)/2pi) by generating points
#
# The points will be stored in two arrays, @X and @Y.
#
$a = &random(2,5,0.5);
$b = &random(0,4,1);

$x_min = -8;
$x_max =  8;
$x_delta = 0.1;
for ($x = $x_min;$x<=$x_max;$x+=$x_delta) {
    push (@X,$x);
    push (@Y,($a*sin(($x-$b)/2*$pi)) );
}
</script>

<gnuplot font="large" width="600" samples="100" grid="on" height="300" 
        alttag="Sine Curve Plot" border="on" fgcolor="x000000" 
        align="center" bgcolor="xffffff" transparent="off">
    <axis ymin="-5" ymax="5" xmin="$x_min" xmax="$x_max" color="x000000" />
    <curve linestyle="linespoints" pointtype="0" color="x000000" name="Sine Curve">
        <data>@X</data>
        <data>@Y</data>
    </curve>
</gnuplot>

<startouttext /><br />
What is the amplitude of the sine curve graphed above?
<endouttext />

<numericalresponse answer="$a">
    <responseparam name="tol" type="tolerance" description="Numerical Tolerance" default="5%" />
    <responseparam name="sig" type="int_range,0-16" description="Significant Figures" default="0,15" />
    <textline />
</numericalresponse>

</problem>

hallmat3@msu.edu
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
Can I create a problem which presents a choice from completely different questions?
Yes.  
e.g.  (where * = a response type, such as "radiobutton", "string", "numerical")

<randomlist show="1">
<*response id="11">
...statement and response parameters etc...
< /*response>
<*response id="12">
...statement and response parameters etc...
< /*response>
<*response id="13">
...statement and response parameters etc...
< /*response>
< /randomlist>

The above will produce a single question that is selected randomly 
from the different questions delineated by the 
<*response >< /*response> tags.


OR 

 You could put the individual problem choices in libraries -- 
and choose problem parts from selected groups:

<part id="11">
<randomlist show="1">
<import id="12">sample1.library< /import>
<import id="13">sample2.library< /import>
<import id="14">sample3.library< /import>
< /randomlist>
< /part>
<part id="15">
<randomlist show="1">
<import id="16">sample4.library< /import>
<import id="17">sample5.library< /import>
<import id="18">sample6.library< /import>
< /randomlist>
< /part>

The above will make a two-part problem where there is one library chosen from each group of three.


CAUTION: It is advisable NOT to use 

<randomlist show="1">
<part id="11">whatever< /part> 
<part id="12">whatever< /part> 
<part id="13">whatever< /part>
< /randomlist> 

as this will create multiple (redundant or useless) part numbers in PARM and SPRS and make grading and course management more difficult.



batchelo@sfu.ca
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
Equation Entry Example

<problem>
<script type="loncapa/perl">
# Enter computations here 
$x1 = random(2,4,1);
$y1 = random(3,7,1);

$x2 = random($x1+1,9,1);
$y2 = random($y1+1,15,1);

$m = "($y2-$y1)/($x2-$x1)";
$b = "$y1-$m*$x1";
$answer = "$m*x+$b";
$answer =~ s/\+-/-/g;
$answer =~ s/-\+/-/g;
</script>

<startouttext />
<p>
What is the equation of the line which passess through ($x1,$y1) and ($x2,$y2)?
</p>
y = 
<endouttext />

<formularesponse samples="x@-5:5#11" id="11" answer="$answer">
    <textline size="25" />    
</formularesponse>

</problem>


hallmat3@msu.edu
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
When to use <display> tag
Functions that must be inside of a <display> when outputting text:
&prettyprint
&tex
&web
&xmlparse
Functions that shouldn't be used but if used need it
&dollarformat (use pretty print instead with '$2f')
&var_in_tex

More gory details:

When coverting the HTML of a problem to LaTeX, Lon-CAPA assumes that the contents of the entire problem, and the contents of all variables that it expands is HTML,.

LaTeX has some charactes that are special, as they tell it to do special things.

In order to not have the characters that HTML generates confuse LaTeX we need to protect them.

The problem with the &xmlparse(), &prettyprint() etc functions is that when printing, these functions rather than genearte HTML, they generate LaTeX code.

So the assumption that everything is in HTML is wrong, and can cause things to break.

Thus enters the <display> tag.

The <display> tag says, that this variable's value or function's result is safe to pass directly to the LaTeX engine.


[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
Adaptive Hints
Adaptive or conditional hints in LON-CAPA

Note: an extra space has been added before each tag closure in any tags included below so that the text will be displayed correctly by the FAQ-O-Matic.


Hints are placed within <hintgroup ></hintgroup > tags. The first part of the hint is the condition, which includes a specification of the foil(s) and foil answer(s) required to trigger the hint. The answers specified in the hint condition are compared with the user's submission, and if the condition is met, the hint action included in the conditional hint block will be executed (for example this could be the display of a block of text).  You can set multiple hint conditions for a particular problem.  Hint conditions are identified by a name.  The corresponding hint action includes this hint condition name in the "on" parameter). When a hint condition evaluates to true, the corresponding hint action is triggered.  Besides providing hint actions within  <hintpart on="NAME" ></hintpart > tags for each named (NAME) hint condition, a hint can be designated for display if none of the  conditional hints evaluate to true.  The default hint is not displayed if the conditions were met for any of the conditional hints.   The default hint action is included between <hintpart on="default" ></hintpart > tags.

There are five types of hint condition:


Formula Hint condition

Numerical Hint condition

Option Response Hint condition

Radiobutton Hint condition

String Hint condition


The syntax used to describe the foil(s) and the foil answer(s) differ for the
five types:

1. Formula Hint condition

The formulahint tag takes three parameters: answer, name, and samples.
The "name" is the unique name given to the hint condition. The formula answer
for which you wish to provide conditional  is included in the answer
parameter. The samples parameter includes the points (or range of points) over
which sampling of the student's submitted answer and the formula included in
the formula hint answer parameter are to be compared.  The syntax
is the same as used to specify sampling points in the samples parameter of the
formula reponse tag itself. The formula submitted by the student is evaluated
at the sample points for the hint and the calculated values are compared 
with the corresponding values determined by evaluating  the "hint" answer at
the same sampling points. A close correspondence  between the two sets of
values will trigger the hint action specified in the <hintpart > tag.

<problem >
 <script type="loncapa/perl" ># Enter computations here 
 $x1 = random(2,4,1);
 $y1 = random(3,7,1);

 $x2 = random($x1+1,9,1);
 $y2 = random($y1+1,15,1);

 $m = "($y2-$y1)/($x2-$x1)";
 $b = "$y1-$m*$x1";
 $answer = "$m*x+$b";
 $answer =~ s/\+-/-/g;
 $answer =~ s/-\+/-/g;

 $inverted = "($x2-$x1)/($y2-$y1)";
 $wrongans = "$inverted*x";
 $wrongans =~ s/\+-/-/g;
 $wrongans =~ s/-\+/-/g;
</script >

<startouttext /><p >
What is the equation of the line which passess through ($x1,$y1) and
($x2,$y2)?</p >
y = 
<endouttext />

<formularesponse samples="x@-5:5#11" id="11" answer="$answer" >
 <textline size="25" / >
  <hintgroup >
   <formulahint samples="x@-5:5#11" answer="$wrongans" name="inversegrad" >
   </formulahint >
   <hintpart on="inversegrad" >
    <startouttext />You have inverted the slope in the question.  Slope is
(y2-y1)/(x2 - x1) you have the slope as (x2-x1)/(y2-y1).<endouttext / >
   </hintpart >
  </hintgroup >     
 </formularesponse >
</problem >


2. Numerical Response condition

The numericalhint tag takes four parameters: answer, name, unit and format.
The "name" is the unique name given to the hint condition. The numerical
answer for which you wish to provide conditional is included in the answer
parameter. Student submission of that answer in combination with the "unit"
parameter in the hint condition will trigger the hint action specified in the
<hintpart > tag.


<problem >
<startouttext />A car travels 10 km in 10 min.  What is the speed of the car?<endouttext />
  <numericalresponse format="1f" unit="km/hr" answer="60">
   <responseparam description="Numerical Tolerance" default="2%" type="tolerance" name="tol" />
    <textline />
    <hintgroup >
     <numericalhint format="1f" unit="km/min" answer="100" name="speed">
       <responseparam description="Numerical Tolerance" type="tolerance" default="2%" name="tol" />
     </numericalhint >
      <hintpart on="speed">
       <startouttext />You multiplied the distance by the time.  Remember speed = distance/time<endouttext />
      </hintpart >
     </hintgroup >
   </numericalresponse >
</problem >

3. Option Response Hint condition

There are two types of option response hint conditions: one for standalone
foils and one for concept groups. In both cases the option hint tag includes
two parameters: answer and name for standalone foils, and concept and name for
foils grouped together in a concept group.   For the answer parameter, the
names and submitted values for each of the foils that are being included in
the hint condition are provided in a hash, i.e., in the format:
('Foil1'=>'True','Foil2'=>'False').  In the case of a conditional hint for a
concept group, the format of the concept parameter is also a hash that links
the name of each concept group included in the hint condition to either
'correct' or 'incorrect' - e.g.,  <optionhint
concept="('buoyancy'=>'correct','density'=>'correct')" name="fluids" / >
If 'correct' is specified for a named concept then when the conditional hint
is evaluated answers for each of the foils selected by a student must be correct for the hint action to be triggered.  If anything other than 'correct' is provided in the concept hash in the optionhint tag then then students
answers will be compared with the set answers for the foils in the concept
group and as long as at least one answer is incorrect (i.e., the concept group
was not correctly answered) then the corresponding hint action will be triggered.

(a) optionresponse

<problem >
 <startouttext />For each of the following rock types, indicate whether or not the rock is a volcanic rock.<endouttext / >
 <optionresponse max="10" randomize="yes" >
  <foilgroup options="('Yes','No')" >
   <foil location="random" value="No" name="schist" >
    <startouttext />Schist<endouttext / >
   </foil >
   <foil location="random" value="No" name="marble" >
    <startouttext />Marble<endouttext / >
   </foil >
   <foil location="random" value="Yes" name="basalt" >
    <startouttext />Basalt<endouttext / >
   </foil >
   <foil location="random" value="No" name="gabbro" >
    <startouttext />Gabbro<endouttext />
   </foil >
   <foil location="random" value="No" name="granite" >
    <startouttext />Granite<endouttext />
   </foil >
  </foilgroup >
  <hintgroup >
   <optionhint answer="('schist'=>'Yes','marble'=>'Yes')" name="metamorphic"/ >
   <optionhint answer="('gabbro'=>'Yes','granite'=>'Yes')" name="plutonic" / >
   <hintpart on="metamorphic">
    <startouttext />Schist and Marble are both examples of metamorphic rocks
as described on page 2 of the textbook.<br / ><br / ><endouttext / >
   </hintpart >
   <hintpart on="plutonic" >
    <startouttext />Granite and Gabbro are both examples of igneous rocks that crystallized beneath the surface, i.e., they are plutonic rocks.<br / ><br / ><endouttext / >
   </hintpart >
   <hintpart on="default" >
    <startouttext />Volcanic rocks are described on page 22 of the
textbook.<endouttext / >
   </hintpart >
  </hintgroup >
 </optionresponse >
</problem >

(b) optionresponse with concept groups

<problem >
 <startouttext />Choose the likely plate boundary type, where you are most likely to encounter each of the following geologic features or phenomena.<endouttext / >
 <optionresponse max="10" randomize="yes" >
   <foilgroup options="('Convergent','Divergent','Transform')" >
     <conceptgroup concept="faulting" >
       <foil name="normal" value="Divergent" >
         <startouttext / >Normal faults<endouttext / > 
       </foil >
       <foil name="strike" value="Transform" >
         <startouttext / >Strike-slip faults<endouttext />
       </foil >
       <foil name="thrust" value="Convergent" >
         <startouttext />Thrust faults<endouttext />
       </foil >
     </conceptgroup >
     <conceptgroup concept="earthquakes" >
       <foil name="deep" value="Convergent" >
         <startouttext / >Large Magntitude, deep and intermediate focus earthquakes<endouttext / >
       </foil >
       <foil name="shallow" value="Transform" >
         <startouttext / >Large magnitude, shallow focus earthquakes<endouttext />
       </foil >
      <foil name="lowmag" value="Divergent" >
         <startouttext / >Low magnitude shallow focus earthquakes<endouttext />
       </foil >
     </conceptgroup >
     <conceptgroup concept="topography" >
       <foil name="gentle" value="Divergent" >
         <startouttext / >Broad area of elevated topography with a central rift valley.<endouttext / >
       </foil >
       <foil name="linear" value="Transform" >
         <startouttext / >A narrow linear fault zone with limited topgraphic expression.<endouttext / >
       </foil >
       <foil name="trench" value="Convergent" >
         <startouttext />A deep trench adjacent to a volcanic arc.<endouttext / >
       </foil >
     </conceptgroup >
     <conceptgroup concept="volcanism" >
       <foil name="explosize" value="Convergent" >
         <startouttext />Explosive volcanism involving volatile-rich viscous magma.<endouttext / >
       </foil >
       <foil name="fluid" value="Divergent" >
         <startouttext />Non-explosive outpourings of low-viscosity magma.<endouttext / >
       </foil >
       <foil name="nonvolcanic" value="Transform" >
         <startouttext />No volcanic activity.<endouttext / >
       </foil >
     </conceptgroup >
   </foilgroup >
   <hintgroup >
     <optionhint concept="('earthquakes' => 'incorrect')" name="quakes" / >
     <optionhint concept="('volcanism' => 'incorrect')" name="volcactivity" / >
     <optionhint concept="('topography' => 'incorrect')" name="relief" / >
     <hintpart on="volcanism" >
       <startouttext />Volcanism requires a source of magma. Magma can be generated by either a depression in the solidus caused by an influx of volatiles, or by decompression melting. Magma rich in volatiles tends to cause explosive volcanism.<endouttext / >
     </hintpart >
     <hintpart on="quakes" >
       <startouttext />Earthquakes require brittle failure, so there is a correlation between the depth of earthquake foci and the geotherm.  The geotherm is depressed in subduction zones, and elevated at mid-ocean ridges.<endouttext / >
     </hintpart >
     <hintpart on="relief" >
       <startouttext / >On a broad scale topography is an expression of density variation, as embodied in the concept of isostasy.  Density variation in the earth is a function of temperature and composition.  Cold oceanic crust entering a subduction zone is dense, whereas as magma is buoyant and of lower density.<br / ><br / ><endouttext / >
     </hintpart >
    <hintpart on="default" >
     <startouttext / >The characteristics of plate boundaries are described on page 52 of the textbook.<endouttext / >
    </hintpart >
   </hintgroup >
 </optionresponse >
</problem >

4. Radiobutton Hint condition

 The radiobutton hint tag takes two parameters: answer and name.  The name is
the name of the hint condition, and the answer is an array. The first element
of the array will be 'foil'; the remaining elements are the names of the foils
that you require to have been checked by the student for the hint to be
displayed.  For example, if you create a radiobutton response problem with six
foils named: granite, gabbro, gneiss, shale, sandstone and schist, and you
want your hint named: igneous to be displayed when either granite or basalt
had been checked your radiobutton hint would be as follows:
  
 <radiobuttonhint answer="('foil','granite','gabbro')"
name="igneous" ></radiobuttonhint >
  In order to trigger display of this hint you also need to create a
<hintpart ></hintpart > block that will include a textblock that contains the
text of the actual hint.
 <hintpart on="igneous" >
  <startouttext />This type of rock is composed of interlocking crystals, a
characteristic of igneous rocks.<endouttext / >
 </hintpart >
  The complete radiobutton response would look as follows:
 
<problem >
 <startouttext />
 Which of the following is a sedimentary rock?
 <endouttext />

 <radiobuttonresponse max="3" randomize="yes" >
   <foilgroup >
     <foil location="random" value="false" name="granite" >
    <startouttext / >
     Granite
    <endouttext / >
   </foil >

   <foil location="random" value="false" name="gabbro" >
    <startouttext / >
     Gabbro
    <endouttext / >
   </foil >

   <foil location="random" value="false" name="schist">
    <startouttext / >
     Schist
    <endouttext />
   </foil >

   <foil location="random" value="false" name="gneiss" >
    <startouttext / >
     Gneiss
    <endouttext / >
   </foil >

   <foil location="random" value="true" name="shale" >
    <startouttext / >
     Shale
    <endouttext / >
   </foil >
      <foil location="random" value="true" name="sandstone" >
    <startouttext / >
     Sandstone
    <endouttext / >
   </foil >

  </foilgroup >
  <hintgroup >
   <radiobuttonhint answer="('foil','granite','gabbro')"
name="igneous" ></radiobuttonhint >
   <radiobuttonhint answer="('foil','gneiss','schist')"
name="metamorphic" ></radiobuttonhint >

   <hintpart on="igneous" >
    <startouttext />This type of rock is composed of interlocking crystals, a
characteristic of igneous rocks.<br / ><br / ><endouttext / >
   </hintpart >
   <hintpart on="metamorphic" >
    <startouttext />This type of rock is composed of oriented crystals, a
characteristic of foliated metamorphic rocks.<endouttext / >
   </hintpart >
  </hintgroup >
 </radiobuttonresponse >
</problem >


5. String Hint condition

The radiobutton hint tag takes two parameters: answer and name.  The name is
the name of the hint condition, and the answer is a text string.  The type
parameter allows you to choose between case sensitive, case insensitive, and
case insensitive in any order. A simple example is shown below.

<problem >
 <startouttext />Which US state has Lansing as its capital?<endouttext / >
  <stringresponse answer="Michigan" type="ci" >
  <textline size="20" / >
  <hintgroup >
   <stringhint answer="wisconsin" type="cs" name="wisc" >
   </stringhint >
   <stringhint answer="minnesota" type="cs" name="minn" >
   </stringhint >
   <hintpart on="wisc">
    <startouttext />The state capital of Wisconsin is Madison.<endouttext / >
   </hintpart >
   <hintpart on="minn">
    <startouttext />The state capital of Minnesota is St. Paul.<endouttext / >
   </hintpart >
   <hintpart on="default" >
    <startouttext />The state you are looking for is also known as the 'Great Lakes State'<endouttext / >
   </hintpart >     
  </hintgroup >
 </stringresponse >
</problem >
An adaptive hint example for string response with detailed explanation of the code is available at:
http://www.mockster.net/school/loncapa/adaptivestringhint.htm
[Append to This Answer]
raeburn@msu.edu, felicia@lon-capa.org
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
How do I make a multi-part problem
<problem >

<startouttext /> DATA FOR ALL PROBLEM PARTS <endouttext />

<part >USE PART TAGS LIKE PROBLEM TAGS
</part >

<part >
</part >

<part >
</part >

</problem >
felicia@lon-capa.org
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
How do I have hints show up after more than 1 try?
The following problem code displays the hint for all tries greater than 1:


<problem >
<numericalresponse answer="5" >
<textline />
<hintgroup >
<hintpart on="default" >
<script type="loncapa/perl" >
$tries=&EXT("user.resource.resource.$external::part.tries");
</script >
<block condition="$tries > 1">
<startouttext />This is the hint text<endouttext />
</block >
</hintpart >
</hintgroup >
</numericalresponse >
</problem >
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
How can I hard code the default maximum number of tries in a problem.
The xml for this is <parameter description="Maximum Number of Tries" type="int_pos" default="1" name="maxtries">
Change the default="1" to whatever value you want.
Note that this parameter applies to a problem part and is NOT a parameter inside a response block.
It must appear outside the response block tags e.g. before < numericalresponse>
but within the <part > tags for a parted problem.
You can use the CSTR graphical Edit features to aid you in inserting the correct xml when doing this.
However, as of LON-CAPA v1.2, there was not a drop list item to insert parameter tags inside a problem or problem part.
You will have to go to "editXML" and enter a pair of <parameter > tags in the appropriate place.
Once you have done that you will find in Edit that there is available a template for the maxtries parameter.
batchelo@sfu.ca
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
how to display variables that must be parsed first
In script block:
$equation=&xmlparse('<m>$ \theta $</m> &theta; ');

In text block:
<display>$equation</display>
felicia@lon-capa.org

[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
Specifying wrong answers for exam mode
Example code shows how wrong answers are coded into a numerical response problem.

<problem>
<script type="loncapa/perl">$a=&random(50,150,10); #width in cm
$b=&random(.5,3.0,.1); #length in m
$perimeter= 2*$a/100 + 2*$b;

# code to generate a randomly chosen wrong answer, while loop is used
# in case the correct answer is randomly chosen.  This code does not 
# protect against the scenarial where $randomWrong is equal to one of
# the other wrong answer though.
$randomWrong=&random($perimeter-.9,$perimeter*2,10);
while($randomWrong == $perimeter) {$randomWrong=&random($perimeter-.9,$perimeter*2,10)}

# All the possible wrong answers are put in the array below
# note that the maximum number of answer bubbles in order for LON-CAPA to use
# this array of wrong answer is equal to the number wrong answers plus 1 for 
# the correct answer.
@wrongAnswers =( 2*$a+2*$b, $a+$b, $a/100+$b, $a*$b, $a*$b/100, $randomWrong);</script>
<startouttext />What is the perimeter of a rectangle with a width of <num format="0f">$a</num> cm and length of <num format="2f">$b</num> meters?<endouttext />
<numericalresponse unit="m" format="1f" answer="$perimeter" incorrect="@wrongAnswers">
        <responseparam type="tolerance" default="5%" name="tol" description="Numerical Tolerance" />
        <responseparam name="sig" type="int_range,0-16" default="0,15" description="Significant Figures" />
    <responseparam name="numbubbles" type="int_pos" default="7" description="Number of bubbles in exam mode" />
        <textline readonly="no" />
        <hintgroup showoncorrect="no">
                <startouttext />Make sure you are solving for the perimeter and not the area!<endouttext />
        </hintgroup>
</numericalresponse>
</problem>
felicia@lon-capa.org
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
multiple correct answers for String Response problems using Regular Expressions
An example:

<problem>
<script type="loncapa/perl">
@answertext = ("big","huge","large");
$regexpans = join('|',@answertext);
$regexpans = '/^('.$regexpans.')\b/';</script>
<startouttext />Not small, but <endouttext />
<stringresponse answerdisplay="large, big, or huge" answer="$regexpans"
type="re">
<textline readonly="no">
</textline>
<hintgroup showoncorrect="no">
<startouttext /><endouttext />
</hintgroup>
</stringresponse>
</problem>
felicia@lon-capa.org
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
How can I use the quantity "pi" in a formularesponse?
Define "pi" as a variable in the expression, but evaluate it at only 
one value, equal to the Perl variable "$pi".

Example:

<problem>
   <startouttext />
<p>What is the area of a circle w.r.t. the radius, r.</p>
   <endouttext />
   <formularesponse samples="pi,r@$pi,.1:$pi,5.#1,10" answer="pi*r^2">
   <responseparam name="tol" type="tolerance" default="0.01"
description="Numerical Tolerance" />
       <textline readonly="no" size="25" />
<hintgroup showoncorrect="no">
   <startouttext />You need to include &pi; in your response.<br />
Try "pi".<endouttext />
</hintgroup>

   </formularesponse>
</problem>


See the online contextual help for formularesponse in CSTR Edit mode
for the syntax of the argument 'samples'.
batchelo@sfu.ca
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Problems :
New Item
[Append to This Answer]
(Category) (Category) LON-CAPA User Help : (Category) Authoring :
Authoring Maps
Making sequences and pages
Subcategories:

Answers in this category:
(Answer) How do I make a sequence?
(Answer) What's a map? sequence? page?
(Answer) How do I define specific versions of resources in my map?
(Answer) How does group search and group import work?
(Answer) What is simple and advanced edit?
(Answer) Can I "downgrade" a graphical map to a "simple" one?
(Answer) What is Group Copy?
(Answer) How can I import resources into a sequence such that each student sees a selection of n of m specified resources?

[New Answer in "Authoring Maps"]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Maps :
How do I make a sequence?
Write sbdemo.sequence at the end of your URL. 
For example:

change this:  http://s10.lite.msu.edu/priv/felicia/  (using your URL)
to:           http://s10.lite.msu.edu/priv/felicia/sbdemo.sequence (then click enter)

LON-CAPA is resource driven.  It will see that your new resource is a
.sequence file and it will bring up the RAT (Resource Assembly Tool). 
Click on the RAT button.  To make a linear sequence, click start, click "link resource" in the little window, then click finish.  Click the link that says straighten.  Then click the black arror and click "add resource into link" in the little window.  Click the new "res" box that appears and click "browse" or "search" in the little window.  Find the resource you want and then click "Save changes" and then click the pink "save map".  You can do the steps above for each resource that you want, including other sequences.  After that,
click the green "List Directory" button.  In your construction space,
click sbdemo.sequence.  Then click publish this resource at the top. 
Fill in the metadata, then click "Finalize Publication".  Now, you can
use this sequence as your top level sequence when making yourself a
course coordinator.  

(Please notify felicia@lon-capa.org if this becomes outdated, there are changes in plan for the construction space).
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Maps :
What's a map? sequence? page?
sequences and pages are types of maps. Sequences put each resource together in individual pages such that students need to use the arrow button on their remote to move ahead. Pages put the resources in one browser screen. Pages are created in an identical matter as sequences except that you name them *.page.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Maps :
How do I define specific versions of resources in my map?
> I had a question today about versions in LON-CAPA.  How can you get a
> course to not automatically use the the most recent version and stick
> with the one you originally had when started the course?  This seems to
> be the current default action.

There is a bug in here but before we get in to that:

enter the specific version into the Map, (If you want version 9 of
/res/msu/guy/a.problem put /re/msu/guy/a.9.problem into the map)

> Related to that above, say you use the same sequence for more than one
> course, say Fall then Spring.  You want to use the most recent version
> when using your spring course, but you want the ability to look back at
> the Fall class and see the sequence as it was during the time of the
> course.  Is this possible, and if so, how do you set this?

Once again the above would do that.

The bug is that there is no way yet of locking yourself to the most
recent version.

This is planned for but we have got there quite yet.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Maps :
How does group search and group import work?
If you build a new sequence, you can click "Group Import" and check all
the recources that you want imported at one time.  You are also allowed
to change the order of them before you complete the import.  By default,
the resources will be imported in the order that you checked them.
* Group search and Group import are accessed from the RAT
  page (construction space-->a .sequence file-->advanced map editing)
* Group import: browse network directory
    and add many resources to a .page or .sequence
* Group search: search metadata and add many resources to a .page
    or .sequence

(Group import might only work with for Course Coordinators)
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Maps :
What is simple and advanced edit?
There are two map editors built into the system: the "simple" editor, and the "advanced graphical editor".
Which editor you can use depends on the complexity of your map. The simple editor can only handle maps that have neither branchings, conditions, nor special resource types (meaning, "random pick,", "mandatory,", etc).
Basically, a simple map is a map with one straight path from Start to Finish, which will look the same for all students.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Maps :
Can I "downgrade" a graphical map to a "simple" one?
Yes, but only if indeed it is a simple map, one path for all students from Start to Finish. When saving your map from the graphical RAT, choose the option that does not save the graphical layout (the yellow option next to the green "save")
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Maps :
What is Group Copy?
Group Copy is a way to copy parts from another map. You can browse for .sequence and .page files, and load them. They will be shown in linear order, as accurately as possible. You can then check the resources you want. In the next step, you can change their order, just like in Group Import and Group Search.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Authoring Maps :
How can I import resources into a sequence such that each student sees a selection of n of m specified resources?
I see some reference to randompick and randomout in bugzilla, but no documentation?
batchelo@sfu.ca
The following seems to work in v0.6.2
1) put all the resources into a sequence, save and publish it.
2) import that sequence (child) into a parent sequence
3) when saving the import, click on "set parameters" and enter a parameter called "randompick"
4) set the value of randompick to be the number of resources you wish to have randomly selected from the child sequence.
5) save and publish the parent sequence.
The unused resources will be marked "hidden" for individual students.
Note that there may be ugly and unresolved ramifications regarding CHRT, STAT and SPRS and NAV with respect to how this all works.....
There is definitely a problem with PRT for this kind of "randompick" sequence.
batchelo@sfu.ca
[Append to This Answer]
(Category) (Category) LON-CAPA User Help : (Category) Authoring :
Publishing
Publishing stuff
Subcategories:

Answers in this category:
(Answer) How do I make something "public"?
(Answer) How do I make sequences and page-maps "public"?
(Answer) How does the <standalone > tag work?
(Answer) I have resources with a "campus license" ...
(Answer) I do not want anybody to see my stuff yet, but want to try it out

[New Answer in "Publishing"]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Publishing :
How do I make something "public"?
When you make a resource "public", people do not need to login to see it. It still has a URL like any other resource.

After hitting "Publish", pull down the menu next to "Copyright" to "Public".

If all resources in one directory and below should become "Public", it might be a good idea to make an entry in the default.meta file.

[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Publishing :
How do I make sequences and page-maps "public"?
You don't - it does not work.

Since sequences can be adaptive, they only work within the context of a session. Also, initial digestion of maps is time intensive and only happens when first entering a course.

But I really want my resources public AND viewed in sequential order?!

There is the <standalone > tag right now which allows you to embed connections between pages that don't show when a resource is used in a class. <standalone >

  <a href="page2.html" >Back</a >
  <a href="page4.html" >Next</a >
  <br />
</standalone >
The back and Next links only appear when a document is viewed not in a class.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Publishing :
How does the <standalone > tag work?
Anything wrapped between the <standalone > will only display when your resource if viewed outside of a course. For example, you might want to display information on your resources for people searching the LON-CAPA resources to see or when viewing the resources as public. This extra information will not be displayed to users (students, TAs, instructors) who look at your resource from inside their course.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Publishing :
I have resources with a "campus license" ...
You can enforce a "campus license" by publishing material with the "copyright" "Domain Only"
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring : (Category) Publishing :
I do not want anybody to see my stuff yet, but want to try it out
You can publish with copyright "Private".
Make sure to remember to republish with another copyright if you want others to see your material.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
Is there any place I can learn the LON-CAPA vocabulary?
LON-CAPA has a vocabularly all of its own, with words such as "radio-button response problem", "foil", "concept-group", etc.

Ask your LON-CAPA domain coordinator or system admin (the person who added you to the LON-CAPA system) to add you as a student to the demo course. Tell your domain coordinator that the demo course is located at /res/msu/demo/demo.sequence.

[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
Information co-authors
A co-author is someone who has permission to create resources in a users construction space.

At MSU, we sometime create one author, e.g. physics123, and make everyone who will be creating resources for physics123 be co-authors. This method works well for collaborators to work with each other.

To create a co-author, you must log into LON-CAPA as the author, pick the role of author, click CUSR on the remote control, type in the username for the person you want to be a co-author, fill in the data (if the person is not in the system yet), and select the role co_author for the user, and finally submit the data. The other person will have the role of co-author when they log in and can do everything that the author can do in the construction space.

[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
I just want a list of all the tags and functions supported by LON-CAPA
http://s10.lite.msu.edu/adm/help/Problem_LON-CAPA_Functions.hlp#Problem_LON_CAPA_Functions http://s10.lite.msu.edu/adm/help/Script_Functions.hlp#Script_Functions
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
What's better, HTML formatting or TeX formatting?
> If someone uses H<sub >2</sub >O, what will print in the pdf? 

The "correct" thing.

We will auto convert HTML -> TeX Whenever possible.

When preparing a page for printing we already know that <sub > should become:
 \ensuremath{_{ 

and </sub > should be:
 }}

> Isn't it
> more advisable that people create their webpages using <m >/ensuremath
> H/subscript{2}0</m > instead?

Nope.  In fact it is unadvisable, since it is much easier to go from
HTML -> TeX, then from TeX -> HTML/XML

Especially if the lonxml parser throws no warnings about the page.

We want them to be able to use as much HTML as possible, and as little
TeX as neccesary. We only suggest using TeX and (<m ></m > ) if it is
difficult or nearly impossible to do in HTML. And
<tex ></tex ><web ></web > if it is impossible to do something in HTML.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
<m > tag?
Wrapping TeX with <m > </m > will put the TeX through the TTH (tex to html) converter. If you want variables inside of this tag to be evaluated before the tex gets converted, then use <m eval="on" >
<m eval="on">\[$eqn\]</m >, will evaluate the variable $eqn first and then run it through the TTH converter.
The following will get rid of +- and convert it to - inside of equations:
<script >
...
$eq = "$a + $b"; $eq = ~s/\+-/-/s; </script >
In text area:
<m eval="on" >$eq</m >
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
samba help, (I mapped my LON-CAPA server on my windows machine)?
/priv/calc is the root of your construction space, which starts at

/home/calc/public_html

- so your /priv/calc/intro translates into /home/calc/public_html/intro, etc.
I was able to mount apcalc user space on Unix and Windows 2000. Our dept
Sun machines have Samba Client installed. The following options were given to
the smbclient :
smbclient //LONCAPA-SERVER/USERNAME -U USERNAME -W WORKGROUP

For Win2K, the path used for mapping was \\LONCAPA-SERVER\USERNAME. 
The user name is :WORKGROUP/USERNAME

For Win 9X, ME:  You must log into your machine as the username on your LON-CAPA
server in order top add it on your drive.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
How do I get rid of unmatched tag warnings?
Make sure all your tags have a closing tag or have a slash at the end 
(<br ></br > can be denoted <br />). Problems should have no warnings! 
Plain HTML pages _may_ be able to handles some of the warnings, but problems 
should be warning free.

An example:

<p > Paragraph text </p >
<hr > replaced with <hr />
<i ><b > text </b ></i > is correct (<i ><b > text </i ></b > is wrong)
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
Can I incorporate Power Point slides into LON-CAPA?
Static PPT presentations ... not a problem. Current versions of powerpoint support the publication of power point slides and presentations as .html These can clearly be included as resources. For examples see:

http://www.nscl.msu.edu/~fox/session1/presentation_files/frame.htm
- A presentation from a short course in C programming.

[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
How do I create a new page?
After becoming an author and clicking CSTR:

change this:  http://s10.lite.msu.edu/priv/felicia/
to:           http://s10.lite.msu.edu/priv/felicia/DirectoryNamepageName.html 
(then click enter)

Enter HTML in the text box.  Click save and publish when ready.

- OR -

Click Browse in the green frame.  Find the webpage that you created on your local 
machine and then click upload.  You can edit the name to put it in the appropriate
directory if necessary.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
When I try to construct a new item, all I see is the login screen below the construction bar.
Your server administrator has not correctly set up your user account. Please point your server administrator at the FAQ answer for "How do I create a new author?" at http://help.loncapa.org/fom/cache/78.html .
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
Can I have conditional rendering of HTML?
Yep, you can use the <block condition="(perl expression)"> ... 
</block> construct.

Example: the following document testtable.html will render itself 
differently (i.e., with a different "right side") based on the query
string parameters passed to it. The condition uses the &EXT function
to access query string parameters passed to the html-page.

<html>
<head>
<title>
                           Title of Document Goes Here
</title>
</head>
<body bgcolor="#FFFFFF">
<table>
<tr><td width="50%" bgcolor="#BBBBBB"><h1>Left Side</h1><a href="testtable.html?show=a">Show A</a>
<a href="testtable.html?show=b&color=blue">Show B in blue</a>
bla bla
<a href="testtable.html?show=b&color=red">Show B in red</a>
bla bla bla bla
<a href="testtable.html?show=b">Show B</a>

</td>
<td bgcolor="#BBFFBB">
<h1>Right Side</h1>
<block condition="&EXT('query.show') eq 'a'">
<h2>I am A</h2>
Bla bla ...
</block>
<block condition="&EXT('query.show') eq 'b'">
<block condition="&EXT('query.color') eq 'blue'">
I will be blue!!!
</block>
<block condition="&EXT('query.color') eq 'red'">
I will be red!!!
</block>

<h2>I am B</h2>

Bla bla
</block>

</td>
</tr>
</table>
</body>
</html>
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
Can I make a document link back to me, or elsewhere?
Yes, in LON-CAPA you can insert links into other people's documents.
Append a query string to your url and set link= to word>url, for example
 http://(server)/res/domain/author/foo.html?link=cool>http://www.lon-capa.org/
will turn the word "cool" into a hyperlink that points to www.lon-capa.org
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
Can I jump into the middle of a page?
Yes, you can turn any word on a page into an anchor by passing anchor= in the query string
For example,
 http://(server)/res/domain/author/foo.html?anchor=dog
will put an anchor into the page where the word "dog" appears and jump there when you call the page.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
Can I highlight something in somebody else's page?
Yes, pass highlight= in the query string. For example
 http://(server)/res/domain/author/foo.html?highlight=camel
will show the page with every appearance of the word "camel" highlighted.
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
How can I change the looks of a page for my course?
In PARM - "Set Course Environment" you can specify a style file for your
course under "Default XML Style File".

For example, the following style file would replace the <h1>-tag in all
incorporated pages by the annoying <blink>-tag:

<definetag name = "h1">
   <meta></meta>
   <render>
      <web><blink></web>
      <tex>\section{</tex>
      <latexsource>\section{</latexsource>  
  </render>
</definetag>


<definetag name = "/h1">
   <meta></meta>
   <render>
      <web></blink></web>
      <tex>}</tex>
      <latexsource>}</latexsource>  
  </render>
</definetag>

For the print target, it would still use \section as <h1>-rendering.
The file extension of a style file is .sty
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
Can I have multilingual resources?
Yes, use the languageblock tag

Example:


  This is always shown.
  <languageblock exclude="german,swiss,french">
  Do you speak English?
  </languageblock>
  <languageblock include="german,swiss">
  Sprechen Sie Deutsch?
  </languageblock>
  <languageblock include="french,swiss">
  Parlez-vous francais?
  </languageblock>
korte@lite.msu.edu
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
How do I add an image
If you know where the image is, such as graphics/image.gif or /res/domain/author/../image.gif, then just add the following in the text box of a question or webpage:
<img src="graphics/image.gif" />
If the image isn't published, you will need to upload the image and publish it.
felicia@lon-capa.org
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
Can I (or how can I) include an .eps file image in a LONCAPA problem?
Add the gif/jpg/png to the problem with the <img > tag. LON-CAPA will convert the web graphic to an eps. For better quality, in the directory with filename.gif, publish filename.eps. The system will notice that an eps file is in the graphic's directory and grab that image to be used with printing.
felicia@lon-capa.org
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
What HTML greek chatacters can I use safely?
&alpha, &beta, &gamma, &delta, &epsilon, &zeta, &eta, &theta, &iota, &kappa, &lambda, &mu, &nu, &xi, &omicron, &pi, &rho, &sigma, &tau, &upsilon, &phi, &chi, &psi, &omega, &thetasym, &piv, &Alpha, &Beta, &Gamma, &Delta, &Epsilon, &Zeta, &Eta, &Theta, &Iota, &Kappa, &Lambda, &Mu, &Nu, &Xi, &Omicron, &Pi, &Rho, &Sigma, &Tau, &Upsilon, &Phi, &Psi, &Omega

guy@albertelli.com
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
How can I edit my resources using search and replace methods?
Do it off-line. i.e. Write your problem on your own computer using the editor of your choice. When you are happy with the global changes upload it to your construction space. If you need to make changes to an existing problem, you could "download" it to your own computer for this purpose. Personally I'd do it by viewing the problem in the xml editor in CSTR and then copy and paste the txt from that frame into the local editor. Currently files in an author's construction space, created through the web browser, are not owned by the author and there is not group write permission set. So they can only be edited by the author through the browser.
If there is a more satisfying answer to this question, I'd like to hear it.
[Append to This Answer]
batchelo@sfu.ca
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
New Item
[Append to This Answer]
(Answer) (Category) LON-CAPA User Help : (Category) Authoring :
New Item
[Append to This Answer]
Previous: (Category) Course Management
Next: (Category) Server System Administration
This document is: http://help.loncapa.org/cgi-bin/fom?file=3
[Search] [Appearance] [Show Top Category Only] [Show This Category As Text] [Show This Entire Category As Text]
This is a Faq-O-Matic 2.719.
This FAQ administered by the MSU LON-CAPA group. Submit a help request ticket to contact us.