diff --git a/cms/templates/widgets/source-edit.html b/cms/templates/widgets/source-edit.html
index e5fc5a2969..f0922831e1 100644
--- a/cms/templates/widgets/source-edit.html
+++ b/cms/templates/widgets/source-edit.html
@@ -45,6 +45,9 @@
refresh_hls(el);
$(this).dequeue();
});
+ // resize the codemirror box
+ h = el.height();
+ el.find('.CodeMirror-scroll').height(h-100);
}
// compile & save button
diff --git a/common/lib/capa/capa/responsetypes.py b/common/lib/capa/capa/responsetypes.py
index 61f91893a7..d97741613c 100644
--- a/common/lib/capa/capa/responsetypes.py
+++ b/common/lib/capa/capa/responsetypes.py
@@ -63,7 +63,7 @@ class StudentInputError(Exception):
class LoncapaResponse(object):
- '''
+ """
Base class for CAPA responsetypes. Each response type (ie a capa question,
which is part of a capa problem) is represented as a subclass,
which should provide the following methods:
@@ -89,7 +89,7 @@ class LoncapaResponse(object):
- required_attributes : list of required attributes (each a string) on the main response XML stanza
- hint_tag : xhtml tag identifying hint associated with this response inside hintgroup
- '''
+ """
__metaclass__ = abc.ABCMeta # abc = Abstract Base Class
response_tag = None
@@ -164,6 +164,8 @@ class LoncapaResponse(object):
- renderer : procedure which produces HTML given an ElementTree
'''
tree = etree.Element('span') # render ourself as a + our content
+ if self.xml.get('inline',''): # problem author can make this span display:inline
+ tree.set('class','inline')
for item in self.xml:
item_xhtml = renderer(item) # call provided procedure to do the rendering
if item_xhtml is not None: tree.append(item_xhtml)
diff --git a/common/lib/xmodule/xmodule/templates/problem/latex_problem.yaml b/common/lib/xmodule/xmodule/templates/problem/latex_problem.yaml
index fc9cae254d..59365d0e32 100644
--- a/common/lib/xmodule/xmodule/templates/problem/latex_problem.yaml
+++ b/common/lib/xmodule/xmodule/templates/problem/latex_problem.yaml
@@ -3,25 +3,146 @@ metadata:
display_name: Problem Written in LaTeX
source_processor_url: https://qisx.mit.edu:5443/latex2edx
source_code: |
- \subsection{Example: Option Response Problem in Latex}
-
+ % Nearly any kind of edX problem can be authored using Latex as
+ % the source language. Write latex as usual, including equations. The
+ % key new feature is the \edXabox{} macro, which specifies an "Answer
+ % Box" that queries students for a response, and specifies what the
+ % epxected (correct) answer is.
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \subsection{Example "option" problem}
+
Where is the earth?
-
+
\edXabox{options='up','down' expect='down'}
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \subsection{Example "symbolic" problem}
+
+ What is Einstein's equation for the energy equivalent of a mass $m$?
+
+ \edXabox{type='symbolic' size='90' expect='m*c^2' }
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \subsection{Example "numerical" problem}
+
+ Estimate the energy savings (in J/y) if all the people
+ ($3\times 10^8$) in the U.~S. switched from U.~S. code to low flow
+ shower heads.
+
+ \edXinline{Energy saved = }\edXabox{expect="0.52" type="numerical" tolerance='0.02' inline='1' } %
+ \edXinline{~EJ/year}
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \subsection{Example "multiple choice" problem}
+
+ What color is a bannana?
+
+ \edXabox{ type="multichoice" expect="Yellow" options="Red","Green","Yellow","Blue" }
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \subsection{Example "string response" problem}
+
+ In what U.S. state is Detroit located?
+
+ \edXabox{ type="string" expect="Michigan" options="ci" }
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \subsection{Example "custom response" problem}
+
+ This problem demonstrates the use of a custom python script used for
+ checking the answer.
+
+ \begin{edXscript}
+ def sumtest(expect,ans):
+ (a1,a2) = map(float,eval(ans))
+ return (a1+a2)==10
+ \end{edXscript}
+
+ Enter a python list of two numbers which sum to 10, eg [9,1]:
+
+ \edXabox{expect="[1,9]" type="custom" cfn="sumtest"}
data: |
-
- An option response problem presents option boxes for students to select from. Correctness of input is evaluated based
- on which option is defined as correct in the optioninput statement.
- Select the correct options:
+ Example: Option Response Problem
- Example "option" problem
+
+ Where is the earth?
+
+
+
+ What is Einstein's equation for the energy equivalent of a mass [mathjaxinline]m[/mathjaxinline]?
+
+
+
+ Estimate the energy savings (in J/y) if all the people ([mathjaxinline]3\times 10^8[/mathjaxinline]) in the U. S. switched from U. S. code to low flow shower heads.
++
Energy saved =
+EJ/year
+ ++
+ What color is a bannana?
+
+
+
+ In what U.S. state is Detroit located?
+
+
+
+ This problem demonstrates the use of a custom python script used for checking the answer.
+ ++ Enter a python list of two numbers which sum to 10, eg [9,1]:
+
+