I would like to use Org mode for creating exam questions and including the templates for the corresponding results for each question.
A general template is shown here
#+TITLE: Lecture
#+AUTHOR:
#+EMAIL:
#+DATE: Jan 2020
#+INSTITUTE: UoW
#+DESCRIPTION:
#+KEYWORDS:
* Fire Modeling
:PROPERTIES:
:andere_VL: Fire Modeling
:END:
** Calculation 1
Please add $1$ and $2$ together.
*** Results
#+BEGIN_SRC python :session results: value
res = 1 + 2
res
#+END_SRC
#+RESULTS:
: 3
The results is \(1 + 2 = 3\)
*** Results - Variables
#+BEGIN_SRC python :session results: value
res = variable1 + variable2
res
#+END_SRC
#+RESULTS:
: 3
The results is \(variable1 + variable2 = variableResults\)
** Calculation 2
This looks as a screenshot like:
The above example includes two sections for "results". In the first one the plain numbers are displayed for clarity (I hope). In the second section "Results - Variables" I try to show how the variables need to be accessed.
The idea is now that I am able to set and use variables in the actual text, which is then used for the python calculation. This would be step one.
And the next step would be to include the python result inside the resulting latex equation.
Update
Maybe a macro approach is suitable and convenient; a simple example is shown below:
** Calculation 2 - Macros
#+MACRO: var1 16
#+MACRO: var2 16
Please add {{{var1}}} and ${{{var2}}}$ together.
*** Results - Variables - MACROS
This works without {{{var1}}}, but only without math...!?
#+BEGIN_SRC python :session :results
{{{var1}}}
#+END_SRC
The corresponding screenshot is
This results as final tex in something like:
\subsection{Calculation 2 - Macros}
Please add 16 and \({{{var2}}}\) together.
\subsubsection{Results - Variables - MACROS}
This works without 16, but only without math\ldots{}!?
So this could be a good approach, when I can use it for the latex math enviroment and also within python src region.
Update -end
Does anyone have an idea how to achieve this? Maybe there exists already another add-on for this or similar task!? I would be happy about any kind of suggestion!
With jupyter there seems to be the option for the second part...