Claiming costs of self-publishing

My co-filer self-published a book and will be receiving some royalties in 2022. What must be done to claim the $7,000 publishing costs as an expense to be sued against income in the future. (That also means capitalizing some of the $7,000).

Thanks.