| 1 |
% This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04 |
| 2 |
% Example 54 Appending, Prepending and Inserting List Elements |
| 3 |
% Label: "ex:listinsert" |
| 4 |
% arara: pdflatex |
| 5 |
% arara: pdfcrop |
| 6 |
\documentclass[12pt]{article} |
| 7 |
\pagestyle{empty} |
| 8 |
\usepackage{datatool-base} |
| 9 |
\begin{document} |
| 10 |
\newcommand{\mylist}{ant,bee} |
| 11 |
Original list: \DTLformatlist{\mylist}. |
| 12 |
|
| 13 |
\appto\mylist{,zebra} |
| 14 |
Item appended: \DTLformatlist{\mylist}. |
| 15 |
|
| 16 |
\preto\mylist{aardvark,} |
| 17 |
Item prepended: \DTLformatlist{\mylist}. |
| 18 |
|
| 19 |
\dtlinsertinto{duck}{\mylist}{\dtlcompare} |
| 20 |
Item inserted: \DTLformatlist{\mylist}. |
| 21 |
\end{document} |