Annotation of loncom/html/adm/help/tex/Authoring_Output_Tags.tex, revision 1.21

1.1       bowersj2    1: \label{Authoring_Output_Tags}
                      2: 
                      3: 
1.2       vandui11    4: This group of tags generates useful output. 
1.1       bowersj2    5: 
                      6: \begin{itemize}
1.17      lira        7: \item \textbf{algebra}\index{algebra}\index{format algebra}: Typesets algebraic expressions
1.3       albertel    8: \begin{verbatim}
1.8       felicia     9: <algebra>2x^y+sqrt(3/x^2)</algebra>
1.3       albertel   10: \end{verbatim}
1.9       riegler    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}.
1.17      lira       12: \item \textbf{chem}\index{chem}\index{format reaction}: Typesets chemical equation 
1.3       albertel   13: \begin{verbatim}
1.10      raeburn    14:   <chem>O2 + 2H2 -> 2H2O</chem>
1.3       albertel   15: \end{verbatim}
1.17      lira       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. 
1.3       albertel   17: \begin{verbatim}
1.17      lira       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
1.3       albertel   26: \end{verbatim}
                     27: \item \textbf{parse}\index{parse}: to display the parsed view of a variable's
                     28: contents
                     29: \begin{verbatim}
1.8       felicia    30:   <script type="loncapa/perl">
1.13      bisitz     31:    $table='<table>';
1.3       albertel   32:    for ($i=1;$i<=10;$i++) {
1.13      bisitz     33:       $table.='<tr><td>'.$i.'</td><td>'.&random(1,10,1).'</td></tr>';
1.3       albertel   34:    }
1.13      bisitz     35:    $table.='</table>';
1.3       albertel   36:   </script>
1.8       felicia    37:   <parse>$table</parse>
1.3       albertel   38: \end{verbatim}
                     39: 
1.8       felicia    40: \item \textbf{standalone}\index{standalone}: Everything in between the
1.2       vandui11   41: start and end tag is shown only on the web and only if the resource
1.1       bowersj2   42: is not part of a course. 
                     43: \item \textbf{displayduedate}\index{displayduedate}: This will insert the
1.2       vandui11   44: current due date if one is set in the document. It is generated to
1.6       foxr       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}
1.1       bowersj2  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}
1.7       albertel  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}
1.8       felicia   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
1.16      www       119: \item \textbf{printtext} the text that should appear instead of a footnote when printed
1.7       albertel  120: \end{itemize}
                    121: 
1.14      www       122: When printing, the included text will get turned into a real footnote.
                    123: 
1.15      www       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: 
1.14      www       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
1.21    ! raeburn   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'
1.14      www       140: \end{itemize}
                    141: 
                    142: When printing, the included text will be rendered in a visible box.
1.7       albertel  143: 
1.4       albertel  144: 
1.1       bowersj2  145: \item \textbf{m}\index{m}: The inside text is \LaTeX{}, and is converted
1.8       felicia   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
1.4       albertel  148: overriden by setting the attribute \textbf{display} to one of
1.20      raeburn   149: ``\textbf{tth}'' or ``\textbf{mimetex}''which
1.18      lira      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/}.
1.4       albertel  152: 
1.8       felicia   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
1.19      bisitz    155: example,  $<$m eval=``on''$>$\$ \$eqn \$$<$/m$>$,
1.8       felicia   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: 
1.19      bisitz    168: \texttt{$<$m eval=``on''$>$\$ \$eqn \$$<$/m$>$}
1.8       felicia   169: 
                    170: You will get the equation rendered with no +-, no matter what value
                    171: \$b may take on.
                    172: 
                    173: 
1.2       vandui11  174: \item \textbf{randomlabel}\index{randomlabel}: This shows a specified image
1.1       bowersj2  175: with images or text labels randomly assigned to a set of specific
                    176: locations. Those locations may also have values assigned to them.
1.2       vandui11  177: A hash is generated that contains the mapping of labels to locations,
1.1       bowersj2  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:     
1.5       albertel  199: \end{verbatim}
                    200: 
                    201:  Possible attributes are:
1.1       bowersj2  202: 
                    203: \begin{itemize}
                    204: \item \textbf{bgimg}\index{bgimg}: Either a fully qualified URL for an
1.2       vandui11  205: external image or a LON-CAPA resource. It supports relative references
1.1       bowersj2  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.
1.2       vandui11  209: \item \textbf{texwidth}\index{texwidth}: The width of the image in millimeters.
1.1       bowersj2  210: \end{itemize}
1.11      felicia   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 />
1.12      raeburn   215: The formula for the circumference of a circle is 2*pi*r
1.11      felicia   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: 
1.1       bowersj2  221: \end{itemize}

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