2

This question is similar to this one, but not the same.

Code

\documentclass{article}
\usepackage{libertinus-otf}
\usepackage{showframe}
\usepackage{amsmath}
\usepackage{enumitem}
\usepackage{enumext}
\usepackage{fixdif}
\setenumext[enumext*]{widest=10,columns=2,label=(\arabic{enumi}-\arabic*),before=\everymath{\displaystyle}}
\newcommand{\myitem}[1]{\item #1 ;}
\begin{document}
\begin{enumerate}[start=3]
    \item \begin{enumext*}
    \item $\int x^2 \d x = \frac{x^3}{3} + C$ ;
    \item $\int x^2 \d x = \frac{x^3}{3} + C$ ;
    \item $\int x^2 \d x = \frac{x^3}{3} + C$ ;
    \item $\int x^2 \d x = \frac{x^3}{3} + C$ ;
    \end{enumext*}
    \item \begin{enumext*}
    \myitem{$\int x^2 \d x = \frac{x^3}{3} + C$}
    \myitem{$\int x^2 \d x = \frac{x^3}{3} + C$}
    \myitem{$\int x^2 \d x = \frac{x^3}{3} + C$}
    \myitem{$\int x^2 \d x = \frac{x^3}{3} + C$}
    \myitem{$\int x^2 \d x = \frac{x^3}{3} + C$}
    \myitem{$\int x^2 \d x = \frac{x^3}{3} + C$}
    \myitem{$\int x^2 \d x = \frac{x^3}{3} + C$}
    \end{enumext*}
\end{enumerate}
\end{document}

result

I want to put ; after each \item inside enumext* and it doesn't affect the outer enumerate.

Exploration

(1)I have tried samcarter's lualatex solution autopunc, but it doesn't work with enumext*;

(2) For Werner's solution with \renewcommand the enumerate, I don't know how to make it only affect only specific enumext*

(3) I have try the Iacobus1983's \myitem case, it worked(shown above), but is that possible to patch the \item but not with\myitem{<content>}, I prefer syntax of the original \item <something> but not \myitem{something}

Question

Is that better or elegant solution to automatically add something after each \item? I have looked through the enumitem and enumext, but only found hook like before,after and first, without which insert something after each \item's content.

Edited: what this originally for:

textbook

5
  • Can you add please, why you want to do this? With math involved, I find this kind of presentation quite puzzling. E.g. as a reader I‘d like to see, how the mathematical Story continues. Rather, I have to decipher and discard in my mind some numerical „weeds“. Thank you Commented Aug 2 at 5:01
  • 1
    @MS-SPO okay, in some advanced mathmatics textbook, the intregral is listed so(edited). And this post, IMHO, is focused on "is there exist user-friendly hook after each \item's content". Commented Aug 2 at 7:14
  • 1
    Algebra is designed to be spoken aloud in a syntactically correct manner. Notice the . at the end of the last one. It is all one sentence. Commented Aug 2 at 8:41
  • @Cicada umm, you are right, but if this be paraphased as a complete sentence, I was still confrant with is how to align, it seemed that enumext-like package is good for something like this. Commented Aug 2 at 9:17
  • 1
    Ask a separate question. Aligning equations can be done different ways, Commented Aug 2 at 12:28

1 Answer 1

1

A tiling pattern x;x;x;x. is possible.

example

(I don't have enumext package.)

General method

If we do

\let\olditem\item

we have the original definition of \item available for later.

Now, the repeating unit is ; \item, and is acting as a delimiter. It first appears after the first entry and last appears before the last entry (x;x;x;x.). We can turn it into a convenient macro command,

\newcommand{\myitem}{;\olditem}

and if we do this

\let\item\myitem

it becomes even more convenient.

The first entry is special: it has no preceding ;, and is just an \olditem (the original definition of \item).

The last entry is also special: it has no following entry to supply it with a ;, and in any case it needs to have a . instead. After the last entry, the environment ends.

So what we can do is this: make the environment-ending process itself be the supplier of the . with:

\AddToHook{env/enumerate/end}{.}

Voilà!

MWE


\documentclass{article}
\usepackage{libertinus-otf}
%\usepackage{showframe}
\usepackage{amsmath}
\usepackage{enumitem}
%\usepackage{enumext}
\usepackage{fixdif}
%\setenumext[enumext*]{widest=10,columns=2,label=(\arabic{enumi}-\arabic*),before=\everymath{\displaystyle}}
\newcommand{\myitem}{;\olditem}
\let\olditem\item
\let\item\myitem

\AddToHook{env/enumerate/end}{.}

\begin{document}
\begin{enumerate}[start=3]
 %   \item \begin{enumext*}
    \olditem $\int x^2 \d x = \frac{x^3}{3} + C$ 
    \item $\int x^2 \d x = \frac{x^3}{3} + C$ 
    \item $\int x^2 \d x = \frac{x^3}{3} + C$ 
    \item $\int x^2 \d x = \frac{x^3}{3} + C$ 
%    \end{enumext*}
%    \item \begin{enumext*}
    \myitem{$\int x^2 \d x = \frac{x^3}{3} + C$}
    \myitem{$\int x^2 \d x = \frac{x^3}{3} + C$}
    \myitem{$\int x^2 \d x = \frac{x^3}{3} + C$}
    \myitem{$\int x^2 \d x = \frac{x^3}{3} + C$}
    \myitem{$\int x^2 \d x = \frac{x^3}{3} + C$}
    \myitem{$\int x^2 \d x = \frac{x^3}{3} + C$}
    \myitem $\int x^2 \d x = \frac{x^3}{3} + C$ 
%    \end{enumext*}
\end{enumerate}
\end{document}

Note: braces after \myitem are not needed now.

1
  • Good idea to achieve this! I thought about it again, and in fact, the purpose of listing environments is to "enumerate," and they don't seem like they should be "sentences"..... Commented Aug 3 at 6:37

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.