<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% This file is embedded in datatool-user.pdf version 3.4 2025-04-03
% 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}
</pre></body></html>