In one of the answers here: How to make only cited bibitems appear?
user @UlrikeFischer gives a short solution to provide automation when not using bibtex, I copy her code here and it works for citing individual items. However it does not work for me when citing multiple items. I have added "\cite{a,b}" to her code snippet here, and this does not work for me, i.e. there is a question mark where I put b and reference b is not listed
Can Ulrike or anyone else help me out by adapting the code snippet so that also \cite{a,b} e.g. works? I don't really understand the latex code well enough to try and adapt it myself
Thanks a lot for your help, Hercule Poirot
ps: I know that I should use Bibtex or another automated package in future, so telling me that will not be helpful.
\documentclass{article}
\usepackage{xpatch}
\makeatletter
\xpretocmd\@citex{\csgdef{used@cite@#2}{x}}{}{\failed}
\newcommand\checkbibentry[2]{\ifcsdef{used@cite@#1}{\bibitem{#1}{#2}}{}}
\makeatletter
\begin{document}
\cite{a} \cite{c} \cite{a,b}
\begin{thebibliography}{99}
\checkbibentry{a}{some text to a}
\checkbibentry{b}{some text to b}
\checkbibentry{c}{some text to c}
\end{thebibliography}
\end{document}