2

I have to set a test for my students and I was given a template to work with. I want to underline the word Question together with the number so that it may be applied to the document globally. Here's my MWE:

\documentclass[a4paper,14pt]{extarticle}
\usepackage[utf8]{inputenc}
\usepackage[left=3.0cm, right=3.0cm, top=3.0cm, bottom=3.0cm]{geometry}
\usepackage{tasks}
\usepackage{braket}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\lhead{MATH130W2: Test 1, University of KwaZulu-Natal, 2019 }
\rhead{\thepage}
\newenvironment{Question}[2][{Question}]{\doublespacing \begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2:}]}{\end{trivlist}}
\let\oldemptyset\emptyset
\let\emptyset\varnothing
\begin{document}
\begin{Question}1
Simplify the following:
\end{Question}
\begin{tasks}(2)
\task some text
\task some text
\end{tasks}
\end{document}

1 Answer 1

3

Although I'd recommend to not mix underlined and bold text, here is a suggestion. I have also added an automatic counter so there is no need to manually number the questions. The optional argument to change the default word "Question" nevertheless still works:

enter image description here

\documentclass[a4paper,14pt]{extarticle}
\usepackage[utf8]{inputenc}
\usepackage[left=3.0cm, right=3.0cm, top=3.0cm, bottom=3.0cm]{geometry}
\usepackage{tasks}
\usepackage{braket}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\lhead{MATH130W2: Test 1, University of KwaZulu-Natal, 2019 }
\rhead{\thepage}
\setlength{\headheight}{17pt}

\newcounter{question}
\setcounter{question}{0}
\newenvironment{Question}[1][{Question}]{\refstepcounter{question}\noindent \bfseries \underline{#1 \thequestion:} \normalfont}{}

\begin{document}
\begin{Question}
Simplify the following:
\end{Question}
\begin{tasks}(2)
\task some text
\task some text
\end{tasks}

\begin{Question}[Optional Task]
Simplify the following:
\end{Question}
\begin{tasks}(2)
\task some text
\task some text
\end{tasks}
\end{document}

You must log in to answer this question.

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