5

I am doing a problem set for students and I would like to itemise horizontally a list of them. However when I try to do that one of the items appears a little bit above the rest of items and the content of the item a bit below.

I am attaching MWE and the corresponding result. Any help would be much appreciated.

KR

\documentclass[12pt]{article}

\newenvironment{problem}[2][Problem]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}

\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{multicol} % to insert columns
    \setlength{\columnsep}{5pt}
\usepackage{hyperref}
    \hypersetup{
        colorlinks=true,
        linkcolor=cyan,
        filecolor=magenta,      
        urlcolor=blue,
        }
\usepackage{parskip} % For no indentation and a bit of space in paragraphs

% to format enumerate to letters
\usepackage{enumitem}


\begin{document}

\title{Problem Set 2}
\author{Ruben Perez Sanz}
\date{7 September, 2020}
\maketitle


\begin{problem}{7}
    Calculate the following determinants
    \begin{multicols}{4}
        \begin{enumerate}[label=(\alph*)]
            \item $\left|\begin{matrix} 3 & 0 \\  2 & 6 \end{matrix}\right|$
            \item $\left|\begin{matrix} a & a \\  b & b \end{matrix}\right|$
            \item $\left|\begin{matrix} a+b & a-b \\  a-b & a+b \end{matrix}\right|$
            \item $\left|\begin{matrix} 3^t & 2^t \\  3^{t-1} & 2^{t-1} \end{matrix}\right|$
        \end{enumerate}
    \end{multicols}
\end{problem}


\end{document}

enter image description here

1
  • 1
    Take a look at the tasks package.
    – leandriis
    Commented Sep 7, 2020 at 18:23

3 Answers 3

5

Here's a solution that doesn't use a multicols environment. Instead, it loads the enumitem package with the option inline and uses an enumerate* environment. The solution also employs the machinery of the amsthm package to streamline the definition of the problem environment.

enter image description here

\documentclass[12pt]{article}
%% (I've simplified the preamble code to the bare minimum)
\usepackage{amsmath,amssymb,amsthm}
\theoremstyle{definition} % upright-lettering style
\newtheorem{problem}{Problem}

\usepackage[inline]{enumitem} % <-- note the option 'inline'

\begin{document}

\setcounter{problem}{6} % adjust as needed
\begin{problem}
Calculate the following determinants.

\begin{enumerate*}[label=(\alph*)]
\item $\begin{vmatrix} 3 & 0 \\ 2 & 6 \end{vmatrix}$ 
\hspace*{1cm} %  choose a suitable amount of horizontal whitespace
\item $\begin{vmatrix} a & a \\ b & b \end{vmatrix}$ 
\hspace*{1cm}
\item $\begin{vmatrix} a+b & a-b \\ a-b & a+b \end{vmatrix}$ 
\hspace*{1cm}
\item $\begin{vmatrix} 3^t & 2^t \\ 3^{t-1} & 2^{t-1} \end{vmatrix}$
\end{enumerate*}
\end{problem}

\end{document}
3
  • 1
    Thanks for you answer, it worked perfectly for the purpose at hand. There is one little issue derived and it's that I have an 'underful \hbox'. Would you know how to fix it? don't worry otherwise Commented Sep 9, 2020 at 17:43
  • Please provide more information about the circumstances under which you get this message. (The answer I provided does not generate the issue.)
    – Mico
    Commented Sep 9, 2020 at 20:09
  • 1
    Since it happens to me over the whole document, I will open a new thead. Thanks!!! Commented Sep 13, 2020 at 7:29
4

Another fast solution could be:

  1. to use \usepackage[margin=1in]{geometry};
  2. enumitem inline \usepackage[inline]{enumitem};
  3. To write correctly the matrices \begin{vmatrix}....\end{vmatrix};

\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\newenvironment{problem}[2][Problem]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{multicol} % to insert columns
    \setlength{\columnsep}{5pt}
\usepackage{hyperref}
    \hypersetup{
        colorlinks=true,
        linkcolor=cyan,
        filecolor=magenta,      
        urlcolor=blue,
        }
\usepackage{parskip} % For no indentation and a bit of space in paragraphs

% to format enumerate to letters in line
\usepackage[inline]{enumitem}
\begin{document}

\title{Problem Set 2}
\author{Ruben Perez Sanz}
\date{7 September, 2020}
\maketitle


\begin{problem}{7}
    Calculate the following determinants:
    \begin{multicols}{4}
        \begin{enumerate}[label=(\alph*)]
            \item $\begin{vmatrix} 3 & 0 \\  2 & 6 \end{vmatrix}$
            \item $\begin{vmatrix} a & a \\  b & b \end{vmatrix}$
            \item $\begin{vmatrix} a+b & a-b \\  a-b & a+b \end{vmatrix}$
            \item $\begin{vmatrix} 3^t & 2^t \\  3^{t-1} & 2^{t-1} \end{vmatrix}$
        \end{enumerate}
    \end{multicols}
\end{problem}


\end{document}

enter image description here

0

You could also use adjustbox package.

\documentclass{article}
\usepackage{amsmath,amssymb,amsthm,adjustbox}
\usepackage{multicol}
\begin{document}
With top alignment
\begin{multicols}{3}
    \begin{enumerate}
        \item\adjustbox{valign=t}{$\begin{vmatrix}a & b \\c & d\end{vmatrix}$}
        \item\adjustbox{valign=t}{$\begin{vmatrix}a & b \\c & d\end{vmatrix}$}
        \item\adjustbox{valign=t}{$\begin{vmatrix}a & b \\c & d\end{vmatrix}$}
    \end{enumerate}
\end{multicols}
With middle alignment
\begin{multicols}{3}
\begin{enumerate}
        \item\adjustbox{valign=m}{$\begin{vmatrix}a & b \\c & d\end{vmatrix}$}
        \item\adjustbox{valign=m}{$\begin{vmatrix}a & b \\c & d\end{vmatrix}$}
        \item\adjustbox{valign=m}{$\begin{vmatrix}a & b \\c & d\end{vmatrix}$}
    \end{enumerate}
\end{multicols}
\end{document}

You must log in to answer this question.

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