I've been using Latex for some time now but I'm nothing but a beginner.
I would like to change the style of the heading created for my own list called "ListofZ" below. In particular I would like it to be smaller but other ways of formatting might look even better. The post How to change the style of "Contents" heading? didnt help me of course.
Now to my second problem, the list itself.
In Formatting new list of definitions with tocloft I've stumbled upon a way of defining my own list, however the code somehow doesn't work for me. When I use the code below without the "%" I always get the error
! Undefined control sequence. ...}{\protect \numberline {\thechapter .\theZ }Your text}{\thepag... l.477 \Z{Your text} The control sequence at the end of the top line of your error message was never \def'ed.
However when I comment out the two lines like below it at least prints the heading. Doesnt create a list though. I've actually just copy pasted the code so I'm not quite sure what causes the problem.
\documentclass[9pt]{article}
\usepackage{tocloft}
\newcommand{\listZname}{ListofZ}
\newlistof{Z}{Zapala}{\listZname}
\newcommand{\Z}[1]{%
\refstepcounter{Z}
\par\noindent\textbf{Zapala \theZ. #1}
% \addcontentsline{Zapala}{Z}
% {\protect\numberline{\thechapter.\theZ}#1}
\par}
\begin{document}
\listofZ
\Z{Your text}
\Z{Your text2}
\end{document}
I've gone through the package description but unless I've missed something I haven't found an answer to my questions. Its been the first time I've explicitly looked through a description though.
If there is anything wrong with my question don't hesitate to help me correct it, this is my first post here.
I also use the packages geometry, babel, biblatex, hyperref, mathtools, amsfonts, amssymb, amsthm, enumitem, multirow if thats of any interest.

article? That class does not have a chapter level, so\thechapteris undefined. If I change your example to\documentclass{report}and run it two times then the list appears. – Marijn Dec 23 '20 at 21:28\thechapterwith\thesection. – Marijn Dec 23 '20 at 21:33\newcommand{\listZname}{\large ListofZ}(change\largeinto the size that you like). There are probably better ways to do this though, this would likely give problems if you add the list in your table of contents for example. – Marijn Dec 23 '20 at 22:30