0

I'm working on a template for mock exam questions for my friends, who wants to test their skills in Mathematics. I want to create an enumerate (correct me if I'm wrong) that looks like this:

questions

I managed to make it look like the picture above in LaTeX, but it takes long time to adjust (i.e. 5 points, 10 points etc.)...

Can some one help me to make it more simple?

3
  • Welcome to TeX SX! You want some points with a coloured background and others not?
    – Bernard
    Nov 29, 2019 at 23:12
  • Hi and thank you, yes it should be customizeable, i.e. some start with green and some does not start with any color. It should depend on the subquestions. So for example exercise 3 can be as above and perhaps execise 4 should not not have any coloured background. Nov 29, 2019 at 23:33
  • I've posted an answer with a background for all questions, but it may be a basis.
    – Bernard
    Nov 29, 2019 at 23:40

1 Answer 1

0

I can propose this, with the help of xparse and enumitem:

\documentclass{article}
\usepackage{fourier}
\usepackage[svgnames]{xcolor}

\usepackage{enumitem}
\usepackage{xparse}
\newcounter{descriptcount}

\NewDocumentEnvironment{enumdescript}{O{}}{\setcounter{descriptcount}{0}\renewcommand*\descriptionlabel[1]{\stepcounter{descriptcount}%
                                \normalfont\colorbox{LimeGreen}{\makebox[4em]{##1\ points}}\quad \alph{descriptcount})}\description[leftmargin =7.15em]}{\enddescription}

\begin{document}

\begin{enumdescript}
   \item[5] Some hard questions. Some hard questions. Some hard questions. Some hard questions. Some hard questions. Some hard questions. Some hard questions. Some hard questions.
   \item[10] item two
\end{enumdescript}

\end{document} 

enter image description here

4
  • Wow really good! This is exactly what I looked for! Nov 30, 2019 at 0:16
  • Is is possible to create subquestion without the green boxes as well? Let's say a) and c) is green and b) is not. Because some of the questions are also easy. :) Nov 30, 2019 at 0:19
  • I'll try tomorrow to find a way (it's getting late here…)
    – Bernard
    Nov 30, 2019 at 0:20
  • Arh that's fine! You helped me a lot, so thank you once again! Nov 30, 2019 at 0:21

You must log in to answer this question.

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