4

Consider the following MWE:

\documentclass[letterpaper]{article}
\usepackage{xcolor}
\usepackage{enumext}

\setenumext[enumext, 1]{%
    label={\arabic*}, 
    font={\bfseries}
    }
\setenumext[enumext, 2]{
    label={\Alph*}, 
    font={\bfseries}
    }
\setenumext[keyans]{
    label={\Alph*}, 
    font={\bfseries}
    }

\begin{document}
    \begin{enumext}[save-ans=test2024,show-ans=true]
        \item*[\color{red}8.5a, KSC] sample         
            \begin{keyans}
                \item* answer
                \item sample
                \item sample
                \item sample
            \end{keyans}
        \item sample
    \end{enumext}

\printkeyans{test2024}
\end{document}

tmp

In the MWE above, I correctly place a label consisting the objective and level of the question in the form 8.6a, KSC respectively. I tried making it red in color using the item-sym* = { } but I cannot make it work. Also I would like to have control over the font settings. As is, the item label settings seems to be running into the symbol label. My current solution is to apply the color directly into the input of the item margin label namely in the form \color{red}8.5a, KSC.

If possible, also, I would like assistance if instead of adding an asterisk to the answer item, that the entire answer and or the label is changed to red color so that when you use show-ans=true it shows red and when use false it shows black.

1 Answer 1

3

There is no key at the moment that allows you to do what you want and I think that abusing \item* is not the right thing to do here, the best thing is to use wrap-label and then play with list-offset.

\documentclass[letterpaper]{article}
\usepackage{xcolor}
\usepackage{enumext}
\newlength{\ratingwd}
\settowidth{\ratingwd}{\bfseries\footnotesize 8.5a, KSC }
\NewDocumentCommand \rating { }{8.5a, KSC}
\NewDocumentCommand \mywrapp { m }
  {
    \textcolor{red}{\bfseries\footnotesize\rating} \textbf{#1}
  }
\setenumext[enumext, 1]{%
    label={\arabic*},
    labelwidth=2.15cm,
    }
\setenumext[enumext, 2]{
    label={\Alph*}, 
    font={\bfseries}
    }
\setenumext[keyans]{
    label={\Alph*}, 
    font={\bfseries},
    }
\begin{document}
\begin{enumext}[list-offset={-\ratingwd},wrap-label={\mywrapp{#1}}, save-ans=test2024,show-ans=true,wrap-opt={},save-sep={ }]
  \item sample         
    \begin{keyans}
      \item sample
      \item*[(8.5a, KSC)] answer
      \item sample
      \item sample
    \end{keyans}
  % Renew \rating here
  \RenewDocumentCommand \rating { }{9.5a, KSC}
  \item sample
      \begin{keyans}
      \item sample
      \item sample
      \item sample
      \item*[(9.5a, KSC)] answer
    \end{keyans}
\end{enumext}

\printkeyans{test2024}
\end{document}

output

In the next release it will be possible to colorize the label for \item* in keyans and keyans* environments and \anspic* in the keyanspic environment.

2
  • Is it possible to hide the wrap label component? I attempted it by commenting list-offset={-\ratingwd} and wrap-label={\mywrapp{#1}} and renewing the command mywrap like this: \RenewDocumentCommand \mywrapp { m } { \textbf{#1} } Is there a better way of doing it? Commented Nov 3, 2024 at 17:00
  • I will post it as a new question: tex.stackexchange.com/q/730083/10898 Commented Nov 3, 2024 at 17:08

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.