2

I want to create a list where each item has two attributes: a title and an associated description.

Something that looks like this:

example

Code:

\documentclass{article} \begin{document} \begin{enumerate} \item diagonal matrix. \emph{Description.} off-diagonal entries are zero. \item idempotent matrix. \emph{Description.} equal to its square. \item skew-symmetric matrix. \emph{Description.} equal to the negative of its transpose. \end{enumerate} \end{document} 

but the Description.s are all aligned together with appropriate space from the titles.

I had a look at this, but I also want the 1., 2., etc. so that solution does not work.

How do I do this?

5

4 Answers 4

7

You could fake an enumeration with the tabularray package:

\documentclass{article} \usepackage{tabularray} \UseTblrLibrary{counter} \begin{document} \noindent \begin{tblr}{ colspec={@{}llX@{}}, colsep={2pt}, column{1}={preto={\arabic{rownum}.}} } & diagonal matrix. &\emph{Description.} off-diagonal entries are zero.\\ & idempotent matrix. &\emph{Description.} equal to its square. A long line with a line break.\\ & skew-symmetric matrix. &\emph{Description.} equal to the negative of its transpose.\\ \end{tblr} \end{document} 

enter image description here

4
  • The a line break appears under its Description. I thought the OP didn't want that to happen. Commented yesterday
  • @CroCo They said, it should be aligned with the second column, which by their count should be "Description". Commented yesterday
  • This situation can be interpreted in two ways; however, upon reviewing the link posted by the original poster, I thought no text should appear under the description. Apparently, because the OP accepted your answer, it seems this is what the OP was looking for, though it wasn't really obvious from the question. Commented yesterday
  • 1
    @CroCo If they want the line break to be after "Description", it is just a matter of adding one more column to the table. Commented yesterday
10

You can use a tabular.

\documentclass{article} \usepackage{tabularx} \usepackage{lipsum}% filler text \newcounter{enumdesc} \newenvironment{enumdesc}{% \par\addvspace{\topsep} \setcounter{enumdesc}{0}% \noindent\tabularx{\textwidth}{@{}r@{ }ll@{ }X@{}} }{\endtabularx\par\addvspace{\topsep}} \newcommand{\itemdesc}[2]{% #1 = text, #2 = description \stepcounter{enumdesc}\theenumdesc. & #1 & \textit{Description.} & #2. \\[\itemsep] } \begin{document} \section{Are you really sure?} \lipsum[1][1-4] \begin{enumdesc} \itemdesc{diagonal matrix}{off-diagonal entries are zero} \itemdesc{idempotent matrix}{equal to its square} \itemdesc{skew-symmetric matrix}{equal to the negative of its transpose} \itemdesc{symmetric matrix}{equal to its transpose and some other text to ensure two lines} \end{enumdesc} \lipsum[2][1-4] \section{How I'd do it} A square matrix is called \begin{itemize} \item \emph{diagonal} if its off-diagonal entries are zero; \item \emph{idempotent} if it equals its square; \item \emph{skew-symmetric} if it equals the negative of its transpose \item \emph{symmetric} if it equals its transpose and some other text to ensure two lines \end{itemize} Very useful types of matrices. \end{document} 

Since I find your method too heavy and repetitive, I added a different layout. As the list has no inherent order, I'd prefer itemize over enumerate.

output

1

While trying to work a fix myself, I figured out one way:

\begin{enumerate} \item \begin{tabular}{p{5cm}l}diagonal matrix. &\emph{Description.} off-diagonal entries are zero.\end{tabular} \item \begin{tabular}{p{5cm}l}idempotent matrix. &\emph{Description.} equal to its square.\end{tabular} \item \begin{tabular}{p{5cm}l}skew-symmetric matrix.&\emph{Description.} equal to the negative of its transpose.\end{tabular} \end{enumerate} 

output

3
  • 2
    tabular adjusts the column width between rows, but you have only one row in each of your tabulars. Use simply a box: \makebox[5cm]{diagonal matrix}. Commented 2 days ago
  • 1
    @jlab - You forgot the [l] (defalult is [c]}. Commented 2 days ago
  • @JohnKormylo That's right, thank you. So: \makebox[5cm][l]{diagonal matrix}. Commented 2 days ago
0

I prefer straightforward solutions, so this does exactly what you're looking for.

\documentclass{article} \usepackage{blindtext} \usepackage{tabularx} \begin{document} \begin{tabularx}{\textwidth}{llX} diagonal matrix. & \emph{Description.} & off-diagonal entries are zero \\ idempotent matrix. & \emph{Description.} & equal to its square \\ skew-symmetric matrix. & \emph{Description.} & equal to the negative of its transpose. \\ item. & \emph{Description.} & Long bullshit. \blindtext[1] \end{tabularx} \end{document} 

The X parameter automatically adjusts column X to match the text width. However, it is not a list itself, as you must manually input their list numbers.

enter image description here

1
  • The OP asked for a list. Could you please add the item labels, like numbering? Commented yesterday

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.