add tag
samcarter
Let's assume I have an itemization. How can I automatically add forgotten punctuation marks (`,` or `.` at the end)?


```
\documentclass{article}

\begin{document}

\begin{itemize}
\item test,
\item test,
\item test.
\end{itemize}

\end{document}
```
Top Answer
samcarter
Inspired by a recent [package of the day](https://github.com/samcarter/PackageOfTheDay), here an approach using the `getitems` package:

```
\documentclass{article}

\usepackage{getitems}

% borrowing code for punctuation marks from biblatex
\usepackage{biblatex}

\makeatletter
\def\doitem#1{\item #1\ifnum\thecurrentitemnumber=\thenumgathereditems\blx@addpunct{period}\else\blx@addpunct{comma}\fi}%
\makeatother

\let\origitemize\itemize
\let\origenditemize\enditemize

\usepackage{environ}

\RenewEnviron{itemize}{%
  \expandafter\gatheritems\expandafter{\BODY}%
  \gathereditem{0}%
  \origitemize%
   \loopthroughitemswithcommand{\doitem}%
  \origenditemize%
}  

\begin{document}

\begin{itemize}
\item test
\item test,
\item test
\end{itemize}

\end{document}
```
![Screenshot 2022-04-20 at 10.00.20.png](/image?hash=655cb2e0f9a12267cf37620237886d3bf41f3d36371915518a61589062d4fa89)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.