This issue is related to the following post: Align enumerate to text and items to numbering for exercises and answers - but it deals with a different aspect of the package tasks, namely how to get tasks to adapt in width.

Minimal Working Example (MWE):

% --------------------------------------------------------------
% Exercise and answer options
% --------------------------------------------------------------
\renewcommand{\ExerciseHeader}{\noindent{\textbf{\ExerciseHeaderNB}} \ExerciseTitle}
\renewcommand{\AnswerHeader}{\noindent{\textbf{\ExerciseHeaderNB}} \ExerciseTitle}
\renewcommand{\QuestionNB}{\textbf{\alph{Question})\ }}


% --------------------------------------------------------------
% Exercise 1
% --------------------------------------------------------------
 Some text here
 \Question Question 1 here

% --------------------------------------------------------------
% Answer 1
% --------------------------------------------------------------
    \vspace*{-\dimexpr\baselineskip + \topsep}
        \task $x<-2$
        \task $x>2$
        \task $(x \leq 1) \vee (x>2)$
        \task $0<x<3$

% --------------------------------------------------------------
% Prints out exercises and answers
% --------------------------------------------------------------


Current output:

enter image description here

Desired output:

Adapt width of all options so that option c) may fit in one row.

  • The simplest would be to have smaller margins, if you don't want to use marginal note. Just loading geometry does that by default. Other than that, set the number of columns to $3$. – Bernard Jul 16 at 8:49
  • I can't use geometry because it will create a ripple of undesired changes in the document. Setting the column number to $3$ generates a lot of errors. Is there any other way to solve the width of each task? – kexxcream Jul 16 at 10:27
  • Changing the number of columns shouldn't generate an error by itself. Could you show the relevant lines in the .log file? Another possibility is to force answer c) spreading over the last two columns, using \task*. In this case, d) will go to a second row, under a). – Bernard Jul 16 at 10:37
  • For some reason, column c) does not seem to get wide enough. Is there an option to decide how wide each column can be? – kexxcream Jul 16 at 15:03

The columns of tasks cannot adapt to the items. The available width always is split evenly.

Either use less columns, e.g., \begin{tasks}(2) or \begin{tasks}(3), or let the third item span two columns:

  \task $x<-2$
  \task $x>2$
  \task*(2) $(x \leq 1) \vee (x>2)$
  \task $0<x<3$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.