I did a lot more experimenting and learning about layout files. I think it's possible to do away with the Question_Lists and Answers "--begin--" and "--end--" separators by using Flex insets for the corresponding environments.
The cool thing I learned is that you can experiment/debug a layout using LyX
Document > Settings > Local Layout. Put the experimental stuff there, and the "Validate" button followed by "Apply" allows you to try things out without having to restart LyX and/or reload the document.
Here are the Flex Insets I have come up with so far (you can paste them in a Local Layout for a file you've set up with your exam.layout).
Code: Select all
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- To find the Insets, they're in the menu Insert > Custom Insets.
- You can nest them, as in LaTeX. E.g.:
- Insert first a "1. Questions" inset, then change the first paragraph in the Inset to Question style (defined in your exam.layout)
- To define a (nested) question part, type return after the Question, and insert a "1.1. Question Parts" block, then change its first paragraph to QuestionPart.
- etc.
- Multiple choice answers are placed using the Multiple Choice Answers inset, with Choice or CorrectChoice styles inside the inset. I did some hacking of the environment to prevent page breaks within the list of choices. I tested this a lot and I think it's pretty robust.
One thing that is broken in LyX (only, LaTeX is fine) is the Multiple Choice Answers are incorrectly numbered, since the "Within" definition of the counter is reset only using the counter defined in the "--begin--" label for MC answers. In theory, the counter needs to be reset for any instance of question (part, subpart, subsubpart, bonus, etc.), but I don't think "Within" supports multiple counters (although I didn't try!)
I'm curious to get your feedback on this approach.
Another thing I tried to improve was how Points are defined (or optionally left out) of the various Question styles. The main difference was that I used
LatexType Command with an argument, rather than the simple
LatexType Paragraph. The following doesn't require the non-breaking space hack. Note: Because I define this as a copy of the Enumerate style, it can't be defined in Local Layout and so has to go into the exam.layout file:
Code: Select all
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
If you don't like the Points on this kind of question, you just delete the label in LyX. You can add it later with a right-click on the question. However, a (bug?) in LyX is such that the Argument will re-appear wherever the cursor is in the paragraph.