File:  [LON-CAPA] / loncom / html / adm / help / tex / Authoring_Output_Tags.tex
Revision 1.21: download - view: text, annotated - select for diffs
Sat Aug 20 16:06:50 2016 UTC (7 years, 11 months ago) by raeburn
Branches: MAIN
CVS tags: version_2_11_2_uiuc, version_2_11_2_msu, version_2_11_2_educog, version_2_11_2, HEAD
- Use LaTeX-style single and double quotes.

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

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