0

I use the exam package for typesetting exam scripts. As a part of integrating Outcome-Based Education (OBE), we are required to show the Course Outcome (CO) and Program Outcome (PO) under the points for each question. A minimal example can be as follows:

A minimal example showing the question format

As shown in the picture, these CO and POs can be set for questions/parts/subparts. Each question has at most 1 CO and 1 PO associated with them. Even if the question fits in 1 or 2 lines, 3 separate lines are added in the points section stating the points, CO, and PO, leaving empty spaces between questions. The points, CO, and PO are right-aligned with boldface.

To accommodate this in the exam class, I have gone through the Package Documentation to find any ideas on how to modify the points section. It contains instructions on how to modify \pointformat{} and \pointpoints{}{} to add static texts like "Points", or "Marks", but I could not figure out how to change it per question.

In my attempts to bypass the issue, I have used a custom \atright command from here to place the COs and POs at the end of the question line, but it does not put them below the points. Example:

Minimal example showing the use of atright command

How can I modify the points section to show additional information that can change per question/part/subparts?

4
  • 1
    Note that \parbox and tabular count as a single line as far as \pointformat is concerned. You can pass the extra information via macros, or preformat the whole thing and pass that as a macro or savebox. Sep 17, 2022 at 21:10
  • Thank you for the comment. I tried using \parbox to create a custom command to add the three lines. It works in most cases. However, if I have a question with multiple lines, it latches on to the first line and adds spacing in between the lines of the same question. The new line (if needed) should be added after each question. And for "tabular count", I am not sure I understand what that is. Can you elaborate? Sep 18, 2022 at 5:21
  • 1
    You can use \begin{tabular}[t]{r}...\end{tabular}. instead of \parbox. You can control whether the points expand upward or downward using [b] or [t]. You can also use \smash or \raisebox to hide the extra lines. Sep 18, 2022 at 14:26
  • Thank you for the suggestions. \parbox combined with \smash seems to have done the trick. I will test it out to see if I can find any other problems and if it works, post the solution soon. Sep 19, 2022 at 1:51

1 Answer 1

1

Read the catch below, before adopting this solution.


With the help of comments from John Kormylo and Philip S. Hirschhorn, I was able to piece together a "hacky" solution.

The \pointformat command expects a single line as input. So, we can trick it into printing multiple lines using the `\parbox' command. It can be called in several ways. We specifically use the following format

\parbox[position][height]{width}{contents}

to write a custom command named \obe{}{}{}:

\newcommand{\obe}[3]{
   \parbox[t][0pt]{0.8cm}{
      #1\\
      (CO#2)\\
      (PO#3)
    }
}

It takes 3 arguments: the point value, the CO value, and the PO value, respectively. It can be called from the square brackets (where the points are given) of \question, \part, or \subpart. For example,

\question[\obe{5}{1}{2}] The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.

will display something like this:

Question with multiple lines showing how \obe works

Other parameters for the \parbox command are as follows:

  • t - is used to set the alignment. The top of the box will be aligned with the top of the question. Alternatives: b and c.
  • 0pt - the height of the box. Ignoring this one will give the box a height, which can result in adding space between the lines of the same question.
  • 0.8cm - the width of the box. It can vary based on the size of the points margin that you use.

However, there's a catch. Whenever the question fits one or two lines, we will have to add spacing between questions manually. If we do not do that, for example:

\question[\obe{5}{1}{2}] The quick brown fox jumps over the lazy dog.
\question[\obe{2}{2}{4}] The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
\question[\obe{4}{3}{2}] The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.

this will result in:

Shows why the manual spacing is required

To avoid that, we can use \vspace{2\baselineskip} for single-line questions, and \vspace{\baselineskip} for multi-line questions. To make things easier, I have defined another custom command:

\newcommand{\qspace}[1]{
   \vspace{#1\baselineskip}
}

that can be used by writing:

\question[\obe{5}{1}{2}] The quick brown fox jumps over the lazy dog.
\qspace{2}
\question[\obe{2}{2}{4}] The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
\qspace{1}
\question[\obe{4}{3}{2}] The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.

which generates:

Shows the benefit of using qspace

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .