File:  [LON-CAPA] / loncom / html / adm / help / tex / Authoring_Output_Tags.tex
Revision 1.10: download - view: text, annotated - select for diffs
Thu Oct 15 03:40:45 2009 UTC (14 years, 10 months ago) by raeburn
Branches: MAIN
CVS tags: version_2_9_99_0, bz6209-base, bz6209, PRINT_INCOMPLETE_base, PRINT_INCOMPLETE, HEAD, GCI_3
- Let's use chemical symbols within the <chem> tag example.

    1: \label{Authoring_Output_Tags}
    2: 
    3: 
    4: This group of tags generates useful output. 
    5: 
    6: \begin{itemize}
    7: \item \textbf{algebra}\index{algebra}: Typesets algebraic expressions
    8: \begin{verbatim}
    9: <algebra>2x^y+sqrt(3/x^2)</algebra>
   10: \end{verbatim}
   11: Expressions are displayed using the math expression display mechanism defined in the user's preferences.  The default is tth.  See the section below concerning the $<$m$>$ tag for more information on that as well as on the attribute \textbf{display}.
   12: \item \textbf{chem}\index{chem}: Typesets chemical equation 
   13: \begin{verbatim}
   14:   <chem>O2 + 2H2 -> 2H2O</chem>
   15: \end{verbatim}
   16: \item \textbf{num}\index{num}: Typesets a number formatted in scientific notation, fixed point, fixed point with commas, fixed point with commas and dollar sign, or in significant digits. 
   17: \begin{verbatim}
   18:   <num format="2E">31454678</num>
   19:   <num format="2f">31454678</num>
   20:   <num format="2f">31454678</num>
   21:   <num format=",2f">31454678</num>
   22:   <num format="$2f">31454678</num>
   23:   <num format="2s">31454678</num>
   24: \end{verbatim}
   25: \item \textbf{parse}\index{parse}: to display the parsed view of a variable's
   26: contents
   27: \begin{verbatim}
   28:   <script type="loncapa/perl">
   29:    $table=`<table>';
   30:    for ($i=1;$i<=10;$i++) {
   31:       $table.=`<tr><td>'.$i.`</td><td>'.&random(1,10,1).`</td></tr>';
   32:    }
   33:    $table.=`</table>';
   34:   </script>
   35:   <parse>$table</parse>
   36: \end{verbatim}
   37: 
   38: \item \textbf{standalone}\index{standalone}: Everything in between the
   39: start and end tag is shown only on the web and only if the resource
   40: is not part of a course. 
   41: \item \textbf{displayduedate}\index{displayduedate}: This will insert the
   42: current due date if one is set in the document. It is generated to
   43: be inside a table of 1x1 elements.  The displayduedate tag accepts
   44: The following attributes:
   45:    \begin{description}
   46:       \item{style=``plain'' }  Makes the due date appear without any boxing.
   47:                                If the parameter value is other than  ``\emph{plain}'',
   48: 			       or if the \textbf{style} parameter is omitted, the
   49: 			       due date will be displayed within a box.
   50:       \item{format=``fmt\_string''} 
   51:                               Allows you to control the format of the due date.
   52: 			      ``\emph{fmt\_string}'' is an arbitrary string that
   53: 			      can contain any of the following formatting items:
   54: 			      \begin{description}
   55: 			         \item{\%a} Replaced by the abbreviated weekday
   56: 				            name according to the current locale.
   57: 			         \item{\%A} Replaced by the full weekday name 
   58: 				           according to the current locale.
   59: 		                 \item{\%b} The abbreviated month name according to the
   60: 				            current locale.
   61: 			         \item{\%B} The full month name according to the
   62:                                             current locale.
   63: 			         \item{\%c} The preferred date and time representation
   64: 				            for the current locale (the default format
   65: 					    string is just this).
   66: 			         \item{\%C} The century number as a two digit integer
   67: 				 \item{\%d} The day of the month as a decimal number.
   68: 				            Leading zeroes are shown for single digit day numbers.
   69: 				 \item{\%D} Equivalent to \%m/\%d/\%y  
   70: 				 \item{\%e} Like \%d but a leadnig zero is replaced by a space.
   71: 				 \item{\%F} Equivalent to \%Y-\%m-\%d
   72: 				 \item{\%G} The four digit year number.
   73: 				 \item{\%g} The two digit year numbger.
   74: 				 \item{\%H} The hour as a two digit number in the range 00 thorugh 23.
   75: 				 \item{\%I} The hour as a two digit number in the range 00 through 12.
   76: 				 \item{\%j} The day your the year in the range 001 through 366.
   77: 				 \item{\%k} The hour (24 hour clock), single digits are preceded by a blank.
   78: 				 \item{\%l} Like \%k but using a 12 hour clock.
   79: 				 \item{\%m} The month as a two digit decimal number in the range 01 through 12.
   80: 				 \item{\%M} The minute as a two digit decimal number in the range 00 through 59.
   81: 				 \item{\%n} A newline character.
   82: 				 \item{\%p} AM or PM depending on the time value.
   83: 				 \item{\%P} am or pm.
   84: 				 \item{\%r} The time in am or pm notation.
   85: 				 \item{\%R} Time in 24 hour notatinon (\%H:\%M).  See also \%T below.
   86: 				 \item{\%s} Number of seconds since midnight of January 1, 1970.
   87: 				 \item{\%S} The second as a decimal number int the range 00 through 59.
   88: 				 \item{\%t} A horizontal tab character.
   89: 				 \item{\%T} The time in 24 hour notation (\%H:\%M:\%S).
   90: 				 \item{\%u} Day of the week as a decimal number with Monday as 1.
   91: 				 \item{\%U} The week number of the current year in the range 00 through 53.
   92: 				            Week 1 is the week containing the first Sunday of the year.
   93: 				 \item{\%V} Same as \%U but week 1 is the first week with at least 4 days,
   94: 				            with Monday being the first day of a week.
   95: 			         \item{\%w} Day of the week as a decimal integer in the range 0 through 7, Sunday is 0.
   96: 				 \item{\%W} Week number of the current year in the range 00 through 53, where
   97: 				            the first Monday of the year is the first day of week 01.
   98: 			         \item{\%x} The preferred date notation in the current locale without the time.
   99: 				 \item{\%X} The preferred time notation in the current locale without the date.
  100: 				 \item{\%y} The year as a decimal number without the century (range 00 through 99).
  101: 				 \item{\%Y} The year as a decimal number including the century.
  102: 				 \item{\%\%} A \% character.
  103: 				 \item{\%+} Date and time in the form returned by the Unix date command.
  104: 			      \end{description}
  105:    \end{description}
  106: \item \textbf{displaytitle}\index{displaytitle}: This will insert the title
  107: of the problem from the metadata of the problem. Only the first \textbf{displaytitle}
  108: in a problem will show the title; this allows clean usage of \textbf{displaytitle}
  109: in LON-CAPA style files.
  110: 
  111: \item \textbf{window}\index{window}: This creates a link that when clicked shows the intervening information in a pop-up window. By default the window will be 500 pixels wide and 200 pixels tall, and the link text will be a superscript * (so as to look like a footnote). These can be changed using the attributes
  112: 
  113: \begin{itemize}
  114: \item \textbf{width} controls the starting width of the popup window
  115: \item \textbf{height} controls the starting height of the popup window
  116: \item \textbf{linktext} the text that should appear as the link that causes the creation of the window
  117: \end{itemize}
  118: 
  119: When printing, this included text will get turned into a real footnote.
  120: 
  121: 
  122: \item \textbf{m}\index{m}: The inside text is \LaTeX{}, and is converted
  123: to HTML (or MathML) on the fly. The default is to convert
  124: to the display mechanism that the user has selected in preferences. This can be
  125: overriden by setting the attribute \textbf{display} to one of
  126: ``\textbf{tth}'' or ``\textbf{jsMath}'' or ``\textbf{mimetex}''which
  127: will force a specfic display mechanism. Note, however, that setting the attribute \textbf{diplay} to \textbf{jsmath} is generally discouraged as it requires users to have installed jsmath software on their computer.
  128: 
  129: If you want variables inside of this tag to be evaluated before the
  130: tex gets converted, then use eval=``on'' \index{eval=on}. For
  131: example,  $<$m eval=``on''$>$\textbackslash{}[\$eqn\textbackslash{}]$<$/m$>$,
  132: will evaluate the variable \$eqn first and then run it through the
  133: TTH\index{TTH} converter.  Anytime you use a variable inside of the m tag,
  134: you will want to set eval to on.
  135: 
  136: For example, put the following in a script in the resource:
  137: 
  138: \texttt{\$eqn = "\$a+\$b";}
  139: 
  140: \texttt{\$eqn =~ s/\textbackslash{}+-/-/g;}
  141: 
  142: and in a text area, you can type:
  143: 
  144: \texttt{<m eval=``on''>\$eqn</m>}
  145: 
  146: You will get the equation rendered with no +-, no matter what value
  147: \$b may take on.
  148: 
  149: 
  150: \item \textbf{randomlabel}\index{randomlabel}: This shows a specified image
  151: with images or text labels randomly assigned to a set of specific
  152: locations. Those locations may also have values assigned to them.
  153: A hash is generated that contains the mapping of labels to locations,
  154: labels to values, and locations to values. Example: \begin{verbatim}
  155: 
  156:  <randomlabel bgimg="URL" width="12" height="45" texwidth="50">
  157:     <labelgroup name="GroupOne" type="image">
  158:       <location x="123" y="456" value="10" />
  159:       <location x="321" y="654" value="20" />
  160:       <location x="213" y="546" value="13" />
  161:       <label description="TEXT-1">IMG-URL</label>
  162:       <label description="TEXT-2">IMG-URL</label>
  163:       <label description="TEXT-3">IMG-URL</label>
  164:     </labelgroup>
  165:     <labelgroup name="GroupTwo" type="text">
  166:       <location x="12" y="45" />
  167:       <location x="32" y="65" />
  168:       <location x="21" y="54" />
  169:       <label>TEXT-1</label>
  170:       <label>TEXT-2</label>
  171:       <label>TEXT-3</label>
  172:     </labelgroup>
  173:    </randomlabel>
  174:     
  175: \end{verbatim}
  176: 
  177:  Possible attributes are:
  178: 
  179: \begin{itemize}
  180: \item \textbf{bgimg}\index{bgimg}: Either a fully qualified URL for an
  181: external image or a LON-CAPA resource. It supports relative references
  182: (../images/apicture.gif). The image must either be a GIF or JPEG.
  183: \item \textbf{width}\index{width}: The width of the image in pixels.
  184: \item \textbf{height}\index{height}: The height of the image in pixels.
  185: \item \textbf{texwidth}\index{texwidth}: The width of the image in millimeters.
  186: \end{itemize}
  187: \end{itemize}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>