[LON-CAPA-cvs] cvs: modules /damieng/graphical_editor/loncapa_daxe/web LocalStrings_de.properties LocalStrings_en.properties LocalStrings_fr.properties loncapa_daxe.dart loncom/html/adm/help/png daxecollapsible.png daxeleftpanel.png daxeradio.png daxetoolbar.png loncom/html/adm/help/tex Authoring_Daxe_CSS.tex Authoring_Daxe_FAQ.tex Authoring_Daxe_Introduction.tex Authoring_Daxe_Left_Panel.tex Authoring_Daxe_Math.tex Authoring_Daxe_Menus.tex Authoring_Daxe_Radiobuttonresponse.tex Authoring_Daxe_Templates.tex Authoring_Daxe_Toolbar.tex Authoring_Daxe_UI.tex Authoring_Daxe_Variables.tex

raeburn raeburn at source.lon-capa.org
Wed Mar 27 12:39:44 EDT 2024


raeburn		Wed Mar 27 16:39:44 2024 EDT

  Added files:                 
    /loncom/html/adm/help/png	daxetoolbar.png daxeradio.png 
                             	daxeleftpanel.png daxecollapsible.png 
    /loncom/html/adm/help/tex	Authoring_Daxe_CSS.tex 
                             	Authoring_Daxe_FAQ.tex 
                             	Authoring_Daxe_Introduction.tex 
                             	Authoring_Daxe_Left_Panel.tex 
                             	Authoring_Daxe_Math.tex 
                             	Authoring_Daxe_Menus.tex 
                             	Authoring_Daxe_Radiobuttonresponse.tex 
                             	Authoring_Daxe_Templates.tex 
                             	Authoring_Daxe_Toolbar.tex 
                             	Authoring_Daxe_UI.tex 
                             	Authoring_Daxe_Variables.tex 

  Modified files:              
    /modules/damieng/graphical_editor/loncapa_daxe/web	
                                                      	LocalStrings_en.properties 
                                                      	LocalStrings_fr.properties 
                                                      	LocalStrings_de.properties 
                                                      	loncapa_daxe.dart 
  Log:
  - Contents of tutorial/getting_started.xhtml divided into 11 .tex files
  - Two links added to "Help" dropdown in Daxe Editor:
     one to Daxe FAQ,
     one to LON-CAPA Math Syntax (describes lm tag).              
  - Existing "Getting Started" link points to composite of 9 .hlp files
    to facilitate multilingual support.
  
  
-------------- next part --------------
Index: modules/damieng/graphical_editor/loncapa_daxe/web/LocalStrings_en.properties
diff -u modules/damieng/graphical_editor/loncapa_daxe/web/LocalStrings_en.properties:1.20 modules/damieng/graphical_editor/loncapa_daxe/web/LocalStrings_en.properties:1.21
--- modules/damieng/graphical_editor/loncapa_daxe/web/LocalStrings_en.properties:1.20	Mon Mar 27 17:35:05 2017
+++ modules/damieng/graphical_editor/loncapa_daxe/web/LocalStrings_en.properties	Wed Mar 27 16:39:44 2024
@@ -38,6 +38,8 @@
 # Help menu
 help = Help
 getting_started = Getting Started
+daxe_faq = Frequently Asked Questions
+daxe_math = LON-CAPA Math Syntax
 author_manual = Author Manual
 about_lcdaxe = About LON-CAPA Daxe
 
Index: modules/damieng/graphical_editor/loncapa_daxe/web/LocalStrings_fr.properties
diff -u modules/damieng/graphical_editor/loncapa_daxe/web/LocalStrings_fr.properties:1.20 modules/damieng/graphical_editor/loncapa_daxe/web/LocalStrings_fr.properties:1.21
--- modules/damieng/graphical_editor/loncapa_daxe/web/LocalStrings_fr.properties:1.20	Mon Mar 27 17:35:05 2017
+++ modules/damieng/graphical_editor/loncapa_daxe/web/LocalStrings_fr.properties	Wed Mar 27 16:39:44 2024
@@ -38,6 +38,8 @@
 # Help menu
 help = Aide
 getting_started = Pour Commencer
+daxe_faq = Questions Fréquemment Posées
+daxe_math = Syntaxe Mathématique de LON-CAPA
 author_manual = Manuel Auteur
 about_lcdaxe = A propos de LON-CAPA Daxe
 
Index: modules/damieng/graphical_editor/loncapa_daxe/web/LocalStrings_de.properties
diff -u modules/damieng/graphical_editor/loncapa_daxe/web/LocalStrings_de.properties:1.2 modules/damieng/graphical_editor/loncapa_daxe/web/LocalStrings_de.properties:1.3
--- modules/damieng/graphical_editor/loncapa_daxe/web/LocalStrings_de.properties:1.2	Mon Mar 25 18:57:12 2024
+++ modules/damieng/graphical_editor/loncapa_daxe/web/LocalStrings_de.properties	Wed Mar 27 16:39:44 2024
@@ -38,6 +38,8 @@
 # Help menu
 help = Hilfe
 getting_started = Getting Started
+daxe_faq = Frequently Asked Questions
+daxe_math = LON-CAPA Math Syntax
 author_manual = Autorenhandbuch
 about_lcdaxe = About LON-CAPA Daxe
 
Index: modules/damieng/graphical_editor/loncapa_daxe/web/loncapa_daxe.dart
diff -u modules/damieng/graphical_editor/loncapa_daxe/web/loncapa_daxe.dart:1.55 modules/damieng/graphical_editor/loncapa_daxe/web/loncapa_daxe.dart:1.56
--- modules/damieng/graphical_editor/loncapa_daxe/web/loncapa_daxe.dart:1.55	Sat Mar 23 23:50:32 2024
+++ modules/damieng/graphical_editor/loncapa_daxe/web/loncapa_daxe.dart	Wed Mar 27 16:39:44 2024
@@ -15,7 +15,7 @@
   along with LON-CAPA.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-// $Id: loncapa_daxe.dart,v 1.55 2024/03/23 23:50:32 raeburn Exp $
+// $Id: loncapa_daxe.dart,v 1.56 2024/03/27 16:39:44 raeburn Exp $
 
 library loncapa_daxe;
 
@@ -911,7 +911,11 @@
 Menu _makeHelpMenu() {
   Menu menu = new Menu(LCDStrings.get('help'));
   menu.add(new MenuItem(LCDStrings.get('getting_started'),
-      () => h.window.open('tutorial/getting_started.xhtml', '_blank')));
+      () => h.window.open('/adm/help/Authoring_Daxe_Introduction,Authoring_Daxe_Menus,Authoring_Daxe_UI,Authoring_Daxe_Toolbar,Authoring_Daxe_Left_Panel,Authoring_Daxe_Templates,Authoring_Daxe_CSS,Authoring_Daxe_Radiobuttonresponse,Authoring_Daxe_Variables.hlp', '_blank')));
+  menu.add(new MenuItem(LCDStrings.get('daxe_faq'),
+      () => h.window.open('/adm/help/Authoring_Daxe_FAQ.hlp', '_blank')));
+  menu.add(new MenuItem(LCDStrings.get('daxe_math'),
+      () => h.window.open('/adm/help/Authoring_Daxe_Math.hlp', '_blank')));
   menu.add(new MenuItem(LCDStrings.get('author_manual'),
       () => h.window.open('/adm/help/author.manual.pdf', '_blank')));
   menu.add(new MenuItem(LCDStrings.get('about_lcdaxe'),

Index: loncom/html/adm/help/tex/Authoring_Daxe_CSS.tex
+++ loncom/html/adm/help/tex/Authoring_Daxe_CSS.tex
\label{Authoring_Daxe_CSS}

\textbf{Using CSS styles in Daxe} 

A CSS stylesheet can be used to define styles for the document.
A particular style can be reused for any number of elements, 
which is convenient when it is used widely.

\emph{CSS} is a syntax for defining stylesheets, which are stored in
\texttt{.css} files. In LON-CAPA, a CSS file can be used by defining the
\texttt{cssfile} parameter for a document. This can be done by authors 
with a top-level parameter in the document, or by course coordinators 
with the course parameter. A course coordinator can override a document 
style with a parameter, and adapt it to the course. The same stylesheet 
can be used for any number of documents.

Some examples of styles that can be defined with CSS are text styles such as 
font, size, italic/bold, color, and layout such as positions, borders and margins.

Here are some examples of usage:

\begin{description}

  \item[\textmd{\normalsize\textit{Make the text bigger, or with a different color}}]

For instance, if you want to make titles blue, you can use this code at the beginning 
of the document:
\begin{verbatim}
<style>
h1 {
  color: blue;
}
</style>
\end{verbatim}
If you have a category of words (for instance: stars) that should be displayed with 
a larger font, you can use:
\begin{verbatim}
<style>
star {
  font-size: 150%;
}
</style>
\end{verbatim}
You can then select a word, insert a \texttt{span} element on it, and use the ``star''
\texttt{class} attribute.

When you have several CSS declarations, it is better to use an external CSS file and 
link to it with a parameter (inserted at the beginning of the \texttt{problem} element).  
This way you can easily reuse that stylesheet with various documents, and it can be
overridden by course coordinators who wish to use a different presentation.

\begin{verbatim}
<parameter name="cssfile" type="string" default="my_stylesheet.css"/>
\end{verbatim}

  \item[\textmd{\normalsize\textit{Change the borders in a table}}]

This has to be done with CSS, because the \texttt{border} attribute is deprecated.
Typically, you will choose how to display tables in your CSS stylesheet, 
for instance to get a simple border for all cells in all tables:

\begin{verbatim}
table {
  border-collapse: collapse;
}
table, th, td {
  border: 1px solid black;
}\end{verbatim}

  \item[\textmd{\normalsize\textit{Add some space between two paragraphs}}]

Simply adding an empty paragraph between two paragraphs with text will not 
increase the spacing between them, because most browsers ignore empty 
paragraphs entirely. But to add some space after or before a block 
(paragraph, division or other), one can use CSS.

For instance, to add a line of space after a single paragraph, 
right-click inside the paragraph, choose ``paragraph attributes'', 
and add this to the \texttt{style} attribute:

\begin{verbatim}
padding-bottom: 1em;
\end{verbatim}

Note that paragraphs already have a default margin, and the padding will add to it.  
Margins can overlap, but paddings do not.

Using this technique, more precise spacing can be achieved than by simply using line breaks.  
For instance, it is possible to set the space between all list items to half a line with the 
following code in a stylesheet:

\begin{verbatim}
li {
  margin-bottom: 0.5em;
}\end{verbatim}

\end{description}

Note that LON-CAPA does not currently use CSS for printing (it uses LaTeX), and CSS instructions 
will generally be ignored when printing documents.

For more information about CSS:
\begin{itemize}
        \item \href{https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_started}{Tutorial}
        \item \href{https://www.w3.org/TR/CSS1/}{CSS1 specification}
        \item \href{https://www.w3.org/Style/CSS/}{Other specifications}
\end{itemize}


Index: loncom/html/adm/help/tex/Authoring_Daxe_FAQ.tex
+++ loncom/html/adm/help/tex/Authoring_Daxe_FAQ.tex
\label{Authoring_Daxe_FAQ}

\textbf{Daxe Editor -- Frequently Asked Questions}

\begin{description}

  \item[\textmd{\normalsize\textit{Is Daxe compatible with the other LON-CAPA editors?}}]

It should be. But a conversion is needed before a document can be loaded into Daxe, 
and a conversion is done afterwards to match the syntax of the other editors.  
So it is possible that the initial conversion fails, and it is possible that the syntax 
or spacing is altered in some ways. Still, this should not change the output.

  \item[\textmd{\normalsize\textit{Which browsers are supported?}}]

Recent versions of all browsers, on all platforms.  
This constraint is related to the technology used to create Daxe, which is Dart. No plugin is needed.

  \item[\textmd{\normalsize\textit{What is an element?}}]

``element'' is a technical term related to the XML syntax used by Daxe.  
It refers to a part of the document, starting with a start tag and ending with an end tag.  
A hierarchical structure can be created by putting elements inside other elements.  
The tags are usually hidden in LON-CAPA Daxe (a whole element being often represented as a box),
but you will see them if you look at the XML source with the File menu.

  \item[\textmd{\normalsize\textit{What is an attribute?}}]

An attribute is a property of an element. It has a name and a value.  
For instance, the \texttt{img} element (which represents an image) has a
\texttt{src} attribute which gives the path to the image file.

  \item[\textmd{\normalsize\textit{How do I select an element?}}]

The easiest way is to double-click on the title when there is one, 
but you can also click before the element, hold and drag until after its end.

  \item[\textmd{\normalsize\textit{How do I move an element?}}]

Select it, cut it with \texttt{ctrl-X}, and paste it where you want with
\texttt{ctrl-V}.

  \item[\textmd{\normalsize\textit{How do I remove an element?}}]

The easiest way is to do a right-click on the title and choose ``Remove''.  
But the \texttt{backspace} or \texttt{del} keys can be used too.

  \item[\textmd{\normalsize\textit{Why is Daxe sometimes not selecting parts of elements?}}]

Daxe is only doing operations that keep the document syntax correct.
So, it will not for instance select a start tag without the end tag, 
because doing operations on a single tag could break the whole document.  
But if you start a selection before a start tag, and continue 
until after the end tag, the whole element will be selected.

  \item[\textmd{\normalsize\textit{How can I insert a movie or sound?}}]

Use the HTML5's \texttt{video} or \texttt{audio} element (in the HTML-Media menu),
with the path to your previously uploaded video/audio file in the \texttt{src} attribute,
and for a video the dimensions in pixels in the \texttt{width} and \texttt{height} attributes.

Remember that not all browsers support all formats, so it is actually better to provide 
several files with the \texttt{source} element instead of using the \texttt{src} attribute.

  \item[\textmd{\normalsize\textit{My Perl script does not seem to be running ...}}]

Make sure you are using the right \texttt{type} attribute.
If a script has no \texttt{type} attribute, it is assumed to be Javascript.

  \item[\textmd{\normalsize\textit{My math is not looking great in the preview ...}}]

The preview uses the default math display engine for your domain (which may not be MathJax),
unless you have set your own user preference which overrides the default.

  \item[\textmd{\normalsize\textit{What is the validation (in the File menu) checking?}}]

It checks that the elements used in the document really exist in the language, 
and that each element inside a parent is allowed under. It also checks for the 
order of the elements when there is a constraint about that, 
but it is rare with LON-CAPA. It also checks for the syntax of each attribute.

The fact that a document validates does not mean that it will run well in LON-CAPA.  
For instance, there might be an error in a Perl script which will only be caught 
when it is executed. But it helps to create documents that will run well everywhere.

  \item[\textmd{\normalsize\textit{How do I change options for the preview?}}]

It is not possible within the Daxe page, but you can use the ``Problem Testing'' display
of the problem (e.g., by expanding the LON-CAPA menu block (if collapsed) and then 
pushing the ``Save and View'' button to try different preview options.

  \item[\textmd{\normalsize\textit{Can I copy/paste source code between Daxe and the LON-CAPA text editor?}}]

No ! The two editors are using a different syntax. 
Daxe is using the XML syntax, while the text editor is using a LON-CAPA-specific syntax.  
For instance, XML special characters are encoded inside m elements and attribute values with Daxe, 
but that syntax would not work in LON-CAPA without a conversion.

So if you need to reuse source code from Daxe with the text editor, save the document, exit Daxe, 
and open the problem with the text editor before copying code.

  \item[\textmd{\normalsize\textit{How can I get the response field on the same line as the question?}}]

Paragraph tags are hidden in the editor, and a paragraph is just indicated with a gray 
\P mark on the lower right. If a response appears on a different line in the preview, 
it might be because it is in a different paragraph, or outside of a paragraph.  
To move the response in the paragraph with the question, one can select it, cut it, 
and paste it after the text in the previous paragraph. The \P mark will appear on the 
lower right of the response. Note that this is only possible with some responses, 
since other responses display as blocks and cannot be put inside a paragraph.

\end{description}

Index: loncom/html/adm/help/tex/Authoring_Daxe_Introduction.tex
+++ loncom/html/adm/help/tex/Authoring_Daxe_Introduction.tex
\label{Authoring_Daxe_Introduction}

\textbf{Daxe Editor Overview}

The LON-CAPA Daxe editor lets authors edit HTML files and LON-CAPA problem files.  
It provides a dynamic graphical user interface with a preview, making it easy to see the resulting web page.  
Daxe understands the LON-CAPA language perfectly, providing a list of elements that can be inserted at the 
cursor position, and checking the file validity in real-time.

Daxe is an alternative to the LON-CAPA ``colorful'' editor (which is the current editor by default).  
Compared to the ``colorful'' editor, Daxe provides a more dynamic interface: elements can be inserted anywhere 
at any time without the need for saving and reloading the document, and the display is updated immediately.  
Daxe also provides a preview that is updated whenever the document is saved.

Daxe is not meant to replace the source editor (which is sometimes called ``plain text editor'', 
or ``XML editor'' even though its syntax is not XML): this text editor can still be useful to fix errors 
in a document syntax, and for authors who prefer to use a simple text editor.  
Note that when Daxe is used, the resulting document will always have a correct syntax, 
so it is a better-suited editor for authors who are not used to the syntax.

Index: loncom/html/adm/help/tex/Authoring_Daxe_Left_Panel.tex
+++ loncom/html/adm/help/tex/Authoring_Daxe_Left_Panel.tex
\label{Authoring_Daxe_Left_Panel}

\textbf{Daxe Left Panel}

\includegraphics[width=0.03\paperwidth]{daxeleftpanel}

There is a hidden panel to the left, which is revealed by dragging the gutter on the left side.  
It contains 2 tabs: insert and tree. The insert tab lists only the elements that can be inserted 
at the cursor position, in the order that they should be inserted in when such an order is required.  
Help buttons provide access to more help about them. Since there can be a lot of elements there sometimes, 
a filter can be used to display only certain categories of elements.

The tree tab displays the structure of the document.  
Clicking on an element moves the main display to its location.

The left panel is initially hidden because it is not necessary to use the editor, 
and the insert panel would sometimes confuse new users: it is tempting to think of it as the only way 
to insert elements, but it is often easier to use the menus for that, 
as they are organized with submenus. Because the insert tab is preserving element order 
when the document requires elements to be ordered, it cannot be organized like the menus 
(and this would just be redundant anyway). 

The tree tab is convenient to navigate within long documents, 
but again this is not very important for new users, and LON-CAPA documents are often short.

Index: loncom/html/adm/help/tex/Authoring_Daxe_Math.tex
+++ loncom/html/adm/help/tex/Authoring_Daxe_Math.tex
\label{Authorinag_Daxe_Math}

\textbf{LON-CAPA math syntax}

As usual, the \texttt{$<$m$>$} element can be used for math with a LaTeX syntax. It can be inserted with the \texttt{\$} button in the toolbar or the \texttt{ctrl-T} shortcut.

Daxe also supports a new LON-CAPA element: the \texttt{$<$lm$>$} element, which allows for a simpler syntax for math. To use the \texttt{$<$lm$>$} element to insert a math expression use the √x button or the \texttt{ctrl-E} shortcut. In the future this syntax may also be used to evaluate \texttt{$<$formularesponse$>$}, but for now its use in \texttt{$<$formularresponse$>$} is limited to the real-time preview of the expression entered in the answer textbox.

Below is a description of the syntax used by \texttt{$<$lm$>$} for displaying math (there is more to this syntax when it is used for evaluation, which is not described here).

Since it can be used for evaluation, it describes mathematical operations rather than appearance (as opposed to LaTeX, which describes how the math should \emph{appear}). Display is the same when the math operations are the same, for instance \texttt{2*(x)} will be displayed just like \texttt{2x}. One advantage to that system is that math will be displayed in a consistent way; disadvantages are that display cannot be chosen precisely, and also the \texttt{$<$lm$>$} element will only be available on servers running LON-CAPA 2.12 (and for now, only at MSU where a modified 2.11.4 with some 2.12 features included, pre-release, has been deployed).
\begin{description}
        \item[\textmd{\normalsize\textit{Spaces}}]

Spaces are always ignored.
        \item[\textmd{\normalsize\textit{Decimal separators and function parameter separators}}]

To keep compatible with previous \texttt{$<$formularesponse$>$} syntax, only \texttt{``.''} can be used as a decimal separator, and \texttt{``,''} is used to separate function and vector/matrix parameters.
        \item[\textmd{\normalsize\textit{Variables and constants}}]

Variable names and constant names are used directly, without any special character before. They are displayed in italics.
        \item[\textmd{\normalsize\textit{Units}}]

Unit names are used directly. They are displayed with a straight font. LON-CAPA has a list of known units and a list of known constants to differentiate them in units mode.
        \item[\textmd{\normalsize\textit{Parenthesis}}]

Parenthesis can be used to specify evaluation order. They are only displayed when necessary.
        \item[\textmd{\normalsize\textit{Operators}}]
\begin{itemize}
        \item arithmetic: \texttt{+ - * / \^{} }
\\
        \item factorial: \texttt{!}
        \item relational: \texttt{= \# $<$ $<$= $>$= $>$}
        \item units: \texttt{`}
\\ Example: \texttt{2`m + 3`m = 5`m}
        \item scalar product for vectors, multiplication for matrices: \texttt{.}
\end{itemize}
        \item[\textmd{\normalsize\textit{Implicit operators}}]

\texttt{*} and \texttt{`} are implicit.

The parser will try to guess which operator is missing whenever possible. The choice between \texttt{*} and \texttt{`} depends on the mode for interpreting equations.

Example: \texttt{2c+3m/s} is understood in unit mode to be \texttt{2*c + 3`(m/s)}. In symbolic mode, it would be interpreted \texttt{2*c + (3*m)/s} (\texttt{m} and \texttt{s} being variables).
        \item[\textmd{\normalsize\textit{Functions}}]

Functions use the syntax \texttt{f(a,b)}.
\begin{itemize}
        \item basic:
\begin{verbatim}
sqrt(x), abs(x), exp(x)=e^x, factorial(x)=x!\end{verbatim}
        \item binomial (displayed like a vector):
\begin{verbatim}
binomial(n,p)=n!/(p!*(n-p)!)\end{verbatim}
        \item sum and product (requiring symbolic mode):
\begin{verbatim}
sum(f(x),x,x1,x2), product(f(x),x,x1,x2)\end{verbatim}
        \item differential, integral, limit:
\begin{verbatim}
diff(expr, x, n), integrate(expr, x, a, b), limit(expr, x, val, plus/minus)\end{verbatim}
\end{itemize}
        \item[\textmd{\normalsize\textit{Vectors and matrices}}]

Vectors and matrices are defined with square brackets. A matrix is made of a list of row vectors.
\begin{itemize}
        \item vectors: \texttt{[1,2,3]}
        \item matrices: \texttt{[[1,2],[3,4]]}
\end{itemize}
        \item[\textmd{\normalsize\textit{Sets}}]

Sets are defined with curly brackets: \texttt{\{1,2,3\}}

Operators:
\begin{itemize}
        \item union: \texttt{union(\{1,2\},\{1,3\}) = \{1,2,3\}}
        \item intersection: \texttt{intersection(\{1,2\},\{1,3\}) = \{1\}}
\end{itemize}
\end{description}

Index: loncom/html/adm/help/tex/Authoring_Daxe_Menus.tex
+++ loncom/html/adm/help/tex/Authoring_Daxe_Menus.tex
\label{Authoring_Daxe_Menus}

\textbf{Access to LON-CAPA menus}

Standard LON-CAPA menus which appear at the top of the paga,e above the Daxe UI, can be 
collapsed or expanded by clicking the icon at the top left of the page.   
By default, when you push the ``Edit with Daxe'' button to open a document in the editor 
the LON-CAPA menu block will be expanded. If you prefer Daxe to open with the menus 
collapsed you can hover over your name at top left, select Preferences, and use the 
``Authoring Space Configuration'' to set your own your own user-specific setting.

\includegraphics[width=0.03\paperwidth]{daxecollapsible}

With menus expanded, the last row of menu items includes (a) (on the left) the directory 
path and name of the file currently being edited, and (b) (on the right), buttons to:
``Save and Edit'', ``Save and View'', ``Discard and View'', and buttons to switch to 
other LON-CAPA editors available in the domain: ``Edit'' (for the standard
editor), and ``Edit XML'' (for the text editor). The two Save buttons will save the
the file contents in the Daxe Editor before either continuing in Daxe
(with an update of the preview panel on the right side of the Daxe window), or 
showing the standard ``Problem Testing'' view of the file.

Index: loncom/html/adm/help/tex/Authoring_Daxe_Radiobuttonresponse.tex
+++ loncom/html/adm/help/tex/Authoring_Daxe_Radiobuttonresponse.tex
\label{Authoring_Daxe_Radiobuttonresponse}

To create a new radio button response, place the cursor directly inside a problem, 
and use the ``One of N statements'' response template. This creates a basic radio button response.

\includegraphics[width=0.03\paperwidth]{daxeradio}

Response elements in general represent a user interface to let students enter a response.  
In the case of a radio button response, it will turn into radio buttons (one for each foil), 
and a single choice is possible.

To remove a foil, move the cursor over it, and click on the red X. 
To move a foil, drag-and-drop the foil's grip icon (to the left of the foil).

This simplified user interface to create radio button responses has many limits: 
for instance, it is not possible to create two true foils and let LON-CAPA choose one of them randomly to display.  
For that, one has to switch to the \textit{advanced} mode with the button on the top of the element block.  
The advanced UI is also necessary to force a foil to be at the top or bottom.  
It is also necessary to display different hints based on the student choice.  
But it could be convenient to start with the simple UI and only switch to advanced to add these options.  
The advanced UI reveals the elements inside the response element, and all the attributes, 
so that all LON-CAPA features are available.

Index: loncom/html/adm/help/tex/Authoring_Daxe_Templates.tex
+++ loncom/html/adm/help/tex/Authoring_Daxe_Templates.tex
\label{Authoring Daxe_Templates}

\textbf{Templates in Daxe}

There are two types of templates: whole problem templates and response templates.

\begin{itemize}

\item \textit{Whole problem templates} are a great way to learn how to create new problems.

Usually the template is chosen when one creates a problem, before editing it, but
if the editor already contains a problem, it will need to be removed first.
This can be done by deleting the root element (for instance with a right-click remove on the problem element).
(for instance with a right-click remove on the problem element).

\item \textit{Response templates} can be convenient to quickly insert new responses in a problem with several responses.

Response templates can only be inserted where responses are allowed (typically, directly under a problem).

\end{itemize}

Index: loncom/html/adm/help/tex/Authoring_Daxe_Toolbar.tex
+++ loncom/html/adm/help/tex/Authoring_Daxe_Toolbar.tex
\label{Authoring_Daxe_Toolbar}

\textbf{Daxe Toolbar}

\includegraphics[width=0.03\paperwidth]{daxetoolbar}

The toolbar provides the following buttons:
\begin{itemize}
  \item \textbf{Save}: saves the document and updates the preview. A shortcut for this action is 
        \texttt{ctrl-S}. The ``Save and Edit'' button in the last LON-CAPA menu row above the Daxe menus performs the same action.
  \item \textbf{Undo/Redo}: Daxe supports multiple undo/redo, which can also be called with 
       \texttt{ctrl-Z} and \texttt{ctrl-Y} or \texttt{ctrl-shift-Z}.
  \item \textbf{Cut/Copy}: These buttons can be used to copy text, elements, or even the 
        whole document into the clipboard. The paste button is not available because of 
        browser security constraints, but the paste action can be done easily with 
        \texttt{ctrl-V} (web browsers want to make sure that a web site cannot read a user's clipboard 
        without an explicit user action such as \texttt{ctrl-V}).
  \item \textbf{Search}: displays a dialog to search and possibly replace text in the document.
  \item \textbf{Insert image}: displays a dialog to choose an already uploaded image. 
        If an image needs to be uploaded first, users currently have to switch to another tab 
        to do that outside of Daxe. Daxe will automatically measure an image's dimensions 
        and insert the width and height in the attributes. An \textit{alt} attribute should also be provided 
        as a text alternative. The image will display directly in the document. Attributes can be modified by clicking on it.
  \item \textbf{Insert symbol}: provides a list of symbols that can be inserted as Unicode characters.  
        Note that, although this is less and less likely to happen, some Unicode characters might not be visible to 
        students who do not have the right fonts.
  \item \textbf{Insert LaTeX math}: displays a dialog to type LaTeX math, with a real-time preview. 
        Note that the \$ signs are necessary for math to be correctly displayed in LON-CAPA.
        \texttt{\$\$...\$\$} can be used instead of \texttt{\$...\$} to display the math as a block, centered.  
        Alternatively, the other LaTeX math delimiters can be used: 
        \texttt{$\backslash$(...$\backslash$)} for inline math and \texttt{$\backslash$[...$\backslash$]} for display math.  
        LaTeX math should always be inside an \texttt{m} element, which is created automatically when the \$ button is used.
  \item \textbf{Insert LON-CAPA math}: use this button to directly type math with the LON-CAPA math syntax in the document.  
        A real-time preview is displayed underneath, and a click outside the text field replaces the text by the preview.  
        There are two options for interpreting the math: \textit{symbols} and \textit{units}.  
        With \textit{symbols}, all letters are interpreted as variables and displayed with an italic font.   
        With \textit{units}, units such as ``m'' are recognized and displayed normally.  
        Internally with an LON-CAPA document, the math expression you type is wrapped within \texttt{$<$lm$>$ $<$/lm$>$} tags.  
        If a resource containing these tags is rendered on a LON-CAPA server running an older (pre-2.12) version of LON-CAPA, 
        the tags will be ignored and the text will be displayed without any special formatting.
  \item \textbf{Insert table}: asks for the table attributes and inserts it with 2 rows and columns.  
        Rows and columns can be changed with the table toolbar.
  \item \textbf{Bulleted list}: turns the current paragraph into a bulleted list, or removes the list.
  \item \textbf{Ordered list}: turns the current paragraph into an ordered list, or removes the list.
  \item \textbf{Rise list level}: turns a first-level list item into a simple paragraph, or moves the list indent left.
  \item \textbf{Lower list level}: moves the list indent right.
  \item \textbf{Add hyperlink}: adds a hyperlink over the selected text. Make sure to fill in the \textit{href} attribute 
         with the link address, which can be relative or absolute.
  \item \textbf{Insert anchor}: inserts an HTML anchor at the cursor position. Make sure to fill the \textit{name} attribute.
  \item \textbf{Styles}: turns selected text into one of these styles: bold, italic, superscript, subscript.
        A CSS stylesheet should be used for more style control. When the style is chosen before typing (with no selection), 
        the style element's tags are visible, which makes it possible to remove empty style elements.
  \item \textbf{Remove styles}: removes all styles from the current selection.
  \item \textbf{Paragraph alignment}: changes the current paragraph alignment.  
        This is only possible if the cursor is within a paragraph.
  \item \textbf{Font type}: changes the font family for the selected text.  
        A CSS stylesheet should be used for more style control.
  \item \textbf{Insert section}: inserts a section with the chosen class at the cursor location.  
        Sections are useful to structure the text with explicit roles for each block, and the icons can be useful 
        for students to recognize each role. Once several sections of a given class are defined, 
        it is easy to change the display for all of them at the same time using CSS.
\end{itemize}

Index: loncom/html/adm/help/tex/Authoring_Daxe_UI.tex
+++ loncom/html/adm/help/tex/Authoring_Daxe_UI.tex
\label{Authoring_Daxe_UI}

\textbf{Organization of the Daxe User Interface} 

A window or tab with the Daxe editor is initially divided into 2 parts: 
the document to be edited to the left, and a preview to the right. 
The preview is updated whenever the document is saved.

At the top, a menubar provides File and Edit menus, 
several hierarchical menus to insert elements, and a menu to insert templates. 
These insert menus are grayed out when it is not possible to insert a given 
element at the cursor position. To display a help bubble about an element, 
move the cursor over the chosen menu, and pause briefly.

Below the top menubar is the toolbar, described afterwards.

The path to the cursor position from the document root is indicated for 
information at the bottom. For instance, \texttt{/Problem[1]/Paragraph[2]/}
means that the cursor is in the second paragraph inside the problem.

Index: loncom/html/adm/help/tex/Authoring_Daxe_Variables.tex
+++ loncom/html/adm/help/tex/Authoring_Daxe_Variables.tex
\label{Authoring_Daxe_Variables}

\textbf{Creating a Problem with Randomized Values}

Some randomization can easily be achieved with a radio button response, 
by setting thei\texttt{randomize} attribute to 'yes', setting the
\texttt{max} attribute to a maximum number of displayed foils, 
and creating more foils than will be displayed.

With a numerical response, it is necessary to create variables with random values.  
This can be done with a Perl script. Such a script is created by inserting a
\texttt{script} element (in the \textit{Block} menu) and setting its
\texttt{type} attribute to '\texttt{loncapa/perl}'.

Here is a little cookbook for randomizing values with a Perl script:
\begin{itemize}
  \item To set variable a to the value 1:

\texttt{\$a = 1;}

  \item To set variable a to the value 'text':

\texttt{\$a = 'text';}

Note that single quotes take the value literally, while double quotes replace variables by their values.

  \item To pick a random number between 1 and 5 (included), with a step of 0.5:

\texttt{\$a = random(1, 5, 0.5);}

(the step can be omitted to use a step of 1)

  \item To chose a value randomly in a list of text entries:

\begin{verbatim}
@list = ('one', 'two', 'three');
$n = random(1, scalar(@list));
$a = choose($n, @list);\end{verbatim}

  \item Math operators:

\texttt{+, -, *, /, **, \%}

  \item Math functions:

\texttt{sin, cos, tan, asin, acos, atan, atan2, log, log10, exp, pow, sqrt, abs, sgn, erf, erfc, ceil, floor, min, max, factorial, sinh, cosh, tanh, asinh, acosh, atanh}

  \item Comments:

\texttt{\# This is a comment.}
\end{itemize}

Once created in a script, variables can be used anywhere afterwards, still prefixed with
\texttt{\$}. In particular, a numerical response answer can be set to a variable.


More information about the LON-CAPA-cvs mailing list