Quantcast
Channel: Customizing item label style of a nested enumerated list - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 2

Customizing item label style of a nested enumerated list

$
0
0

I'm working on a project that requires a nested, enumerated list, the outer most items styled as shown below: a background color on the label, shading over the rest of the line containing the item label, and a line break following.

I seem to get as far as to develop the outer list with styling by making use of the inparaenum and tabularx packages, however when the nested list is an enumerate environment, I receive a 'missing item' error. I would continue using another inparaenum environment for the nested list, however I can't seem to force linebreaks for each item. This also seems to be poor semantically speaking since the environment should be used inline.

Anyone able to point me the right direction? I would love a solution that doesn't feel like a hack (like my attempted solution described above), but any solution at this point is welcomed. Thanks!

custom enumerated list

Minimal Working Example

\documentclass{article}\usepackage{paralist,enumitem,tabularx, xcolor, colortbl}\makeatletter\def\myitem{%   \@ifnextchar[ \@myitem{\@noitemargtrue\@myitem[\@itemlabel]}}\def\@myitem[#1]{\renewcommand{\arraystretch}{1.5}\begin{tabularx}{\textwidth}{>{\columncolor{black}}l>{\columncolor{black!50}}X}\item[\color{white}#1]&\end{tabularx}\\}\makeatother\begin{document}\begin{inparaenum}[1]\myitem\end{inparaenum}\begin{enumerate}[label=\Alph*)]\item NO CHANGE\item were added to the bell.\item were late additions to the bell.\item were late additions to the bell, added after many years\end{enumerate}\end{document}

which produces

custom enumerated list

but will require that each top level item to be instantiated separately and the counter will need to be set every time.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images