1

I want to create an environment for list items. I do not want to have these items as part of an enumerate, because I would like to be able to put anything between these items.

So far I have been fairly successful, but I am struggling to find a way to control when the first line starts, so that the beginning of the text in all the items is aligned.

This has been my attempt so far. enter image description here

Note that for Task 1 the text of each item begins in a different position, whereas the positions are the same for both items in Task 2. How can I achieve the behavior in Task 2 while keeping the syntax of Task 1?

Here is the minimal working example:

\documentclass[12pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}  % Sets language
\usepackage{geometry}  % To establish the properties of the pages
\usepackage{enumitem}
\usepackage{lipsum}


%% General properties of the pages
\geometry{
 a4paper,
 left = 23mm,
 right = 23mm,
 top = 23mm,
 bottom = 23mm
}
\setlength{\parskip}{0.65em}  % Sets paragraph skip
\setlength{\parindent}{0em}  % No paragraph indentation
\setlist[enumerate]{itemsep=0em,
                    topsep=0.10em,
                    leftmargin=*,
                    label=\textbf{\alph*)}, wide}  % Sets default for enumerate
\frenchspacing  % Just ONE SPACE after the period, not two spaces

% To get letters from numbers
\makeatletter
\newcommand{\makealph}[1]{\@alph{#1}}
\makeatother

% Environment for the rubric of a task.
\newcounter{outercounter}
\newcounter{innercounter}
\newenvironment{rubric}[1]{
    \stepcounter{outercounter}%
    \setcounter{innercounter}{0}%
    \par%
    \begin{sffamily}%
    \textbf{Task \theoutercounter} (#1)\textbf{.}%
}{
    \end{sffamily}%
    \par%
}
% Environment for a rubric item.
\newenvironment{rubricitem}{
    \par%
    \begin{sffamily}%
    \stepcounter{innercounter}%
    \textbf{\makealph{\theinnercounter})}%
}{
    \end{sffamily}%
    \par%
}

\begin{document}
\begin{rubric}{With custom items}
\lipsum[1][1]
\end{rubric}
\begin{rubricitem}
\lipsum[1][2-5]
\end{rubricitem}
\lipsum[1][7-10]
\begin{rubricitem}
\lipsum[1][6]
\end{rubricitem}

\bigskip

\begin{rubric}{With enumerate items}
\lipsum[1][1]
\begin{enumerate}
    \item \lipsum[1][2-5]
    \item \lipsum[1][6]
\end{enumerate}
\end{rubric}
\end{document}

2 Answers 2

2

UPDATE after follow-up question. In the rubricitem environment, the counter is encapsulated in a parbox that allows alignment of the BODY(s) (package environ)

d

\documentclass[12pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}  % Sets language
\usepackage{geometry}  % To establish the properties of the pages
\usepackage{enumitem}
\usepackage{lipsum}

\usepackage{xcolor}

%% General properties of the pages
\geometry{
    a4paper,
    left = 23mm,
    right = 23mm,
    top = 23mm,
    bottom = 23mm
}
\setlength{\parskip}{0.65em}  % Sets paragraph skip
\setlength{\parindent}{0em}  % No paragraph indentation
\setlist[enumerate]{itemsep=0em,
    topsep=0.10em,
    leftmargin=*,
    label=\textbf{\alph*)}, wide}  % Sets default for enumerate
\frenchspacing  % Just ONE SPACE after the period, not two spaces

    % To get letters from numbers NOT needed 
%   \makeatletter
%   \newcommand{\makealph}[1]{\@alph{#1}}
%   \makeatother

% Environment for the rubric of a task.
\newcounter{outercounter}
\newcounter{innercounter}
\newenvironment{rubric}[1]{
    \stepcounter{outercounter}%
    \setcounter{innercounter}{1}% changed  alph counter <<<<<<<<<<<<<<<<<<<<<<
    \par%
    \begin{sffamily}%
        \textbf{Task \theoutercounter} (#1)\textbf{.}%
    }{
    \end{sffamily}%
    \par%
}
% Environment for a rubric item.  changed <<<<<<<<<<<<<<<<<<<<<<<<<<<<
\usepackage{environ} % added <<<<<<<<<<<<

\NewEnviron{rubricitem}{% changed <<<<<<<<<<
\sffamily\parbox{3.3ex}{\bfseries\alph{innercounter})}\BODY%
    \addtocounter{innercounter}{1}
}
%*********************************************************************

\begin{document}

    \begin{rubric}{With custom items}
        \lipsum[1][1]
    \end{rubric}

    \begin{rubricitem}
     \lipsum[1][2-5]
    \end{rubricitem}

        \lipsum[1][7-10]
        
    \begin{rubricitem}
        \lipsum[1][6-8]
    \end{rubricitem}

    \setcounter{innercounter}{9} % test a narrow label  <<<<<<<<<<<<
    \begin{rubricitem}
        \lipsum[1][6-8] 
    \end{rubricitem}

    \bigskip
    
    \begin{rubric}{With enumerate items}
        \lipsum[1][1]
        \begin{enumerate}
            \item \lipsum[1][2-5]
            \item \lipsum[1][6]
        \end{enumerate}
    \end{rubric}

\bigskip

\begin{rubric}{REPEAT With custom items}
    \lipsum[1][1]
\end{rubric}
\begin{rubricitem}
    \lipsum[1][2-5]
\end{rubricitem}

\lipsum[1][7-10]

\begin{rubricitem}
    \lipsum[1][6-8]
\end{rubricitem}

\setcounter{innercounter}{9} % test a narrow label  <<<<<<<<<<<<
\begin{rubricitem}
    \lipsum[1][6-8] 
\end{rubricitem}

\end{document}
4
  • This is very close to what I am looking for, but it still requires using \item, which I would like to avoid. Also, I would prefer if a rubricitem were only able to contain one item. On the other hand, using newlist makes me worry that I will be limited in what I can place inside the environment, although I am not sure whether in fact I would be limited. Commented Aug 11, 2022 at 4:45
  • I also forgot to mention that I only want to indent the first line of the item. The rest of the lines should have no indentation. Commented Aug 11, 2022 at 5:09
  • @Just_a_newbie Thank you for your feedback! Please see the updated answer. Commented Aug 11, 2022 at 16:31
  • Thank you for your reply! I had been stuck on this for so long. I also posted an alternative answer, maybe you are interested in it. Commented Aug 14, 2022 at 8:09
0

I have used the idea in Simon Dispa's answer to obtain a result that might look better than what I originally looked for, and is closer to my original attempt in that it uses \newenvironment.

The key part was using a \parbox.

enter image description here

I have also decided that it would also look nice to align the ), so I have combined a \parbox with an additional \hspace. This is not something that I asked for in the question, but I think it looks nicer, especially for thin letters like i or j.

\documentclass[12pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}  % Sets language
\usepackage{geometry}  % To establish the properties of the pages
\usepackage{enumitem}
\usepackage{lipsum}


%% General properties of the pages
\geometry{
 a4paper,
 left = 23mm,
 right = 23mm,
 top = 23mm,
 bottom = 23mm
}
\setlength{\parskip}{0.65em}  % Sets paragraph skip
\setlength{\parindent}{0em}  % No paragraph indentation
\setlist[enumerate]{itemsep=0em,
                    topsep=0.10em,
                    leftmargin=*,
                    label=\textbf{\alph*)},
                    wide}  % Sets default for enumerate
\frenchspacing  % Just ONE SPACE after the period, not two spaces

% To get letters from numbers
\makeatletter
\newcommand{\makealph}[1]{\@alph{#1}}
\makeatother

% Environment for the rubric of a task.
\newcounter{outercounter}
\newcounter{innercounter}
\newenvironment{rubric}[1]{
    \stepcounter{outercounter}%
    \setcounter{innercounter}{0}%
    \par%
    \begin{sffamily}%
    \textbf{Task \theoutercounter} (#1)\textbf{.}%
}{
    \end{sffamily}%
    \par%
}
% Environment for a rubric item.
\newenvironment{rubricitem}{
    \par%
    \begin{sffamily}%
    \stepcounter{innercounter}%
    \parbox{1em}{%
        \hfill\textbf{\makealph{\theinnercounter})}%
    }%
    \hspace{0.5em}\ignorespaces%
}{
    \end{sffamily}%
    \par%
}

\begin{document}
\begin{rubric}{With custom items}
\lipsum[1][1]
\end{rubric}
\begin{rubricitem}
\lipsum[1][2-5]
\end{rubricitem}
\lipsum[1][7-10]
\begin{rubricitem}
\lipsum[1][6]
\end{rubricitem}

\bigskip

\begin{rubric}{With enumerate items}
\lipsum[1][1]
\begin{enumerate}
    \item \lipsum[1][2-5]
    \item \lipsum[1][6]
\end{enumerate}
\end{rubric}
\end{document}

You must log in to answer this question.

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