% This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04
% Example 54 Appending, Prepending and Inserting List Elements
% Label: "ex:listinsert"
% arara: pdflatex
% arara: pdfcrop
\documentclass[12pt]{article}
\pagestyle{empty}
\usepackage{datatool-base} 
\begin{document}
\newcommand{\mylist}{ant,bee}
Original list: \DTLformatlist{\mylist}. 

\appto\mylist{,zebra}
Item appended: \DTLformatlist{\mylist}. 

\preto\mylist{aardvark,}
Item prepended: \DTLformatlist{\mylist}. 

\dtlinsertinto{duck}{\mylist}{\dtlcompare}
Item inserted: \DTLformatlist{\mylist}. 
\end{document}
