This question was suggested to me by How can I sell my text book to my students in e-book format? which asked about the practicalities, but attracted many comments about the ethics. So this question is to ask about the ethics directly.
Suppose I have written and published a textbook, and I want to use it as the text for a course I am teaching. I receive royalties from each copy of my book that is sold, so if my students are required to buy my textbook for the course, I will make some money. Is it ethical to do so?
Well-reasoned opinions would be useful answers, but even more useful would be pointers to institutional policies, professional codes of ethics, etc, that address this issue.
Of course, there are many ways to avoid profiting from the sale of my book to my students. If my contract with my publisher allows it, I could distribute PDFs to my students, or have the university bookstore print out copies and sell them at cost. Another approach I've heard of is to compute how much I earn in royalties on each copy, and refund that amount from my pocket to each student who buys a copy. Or, use my royalty earnings to buy pizza for the class. Certainly these are nice gestures, but I would like opinions on whether they are ethically required.
Edit: To address some questions that have arisen in the comments:
This question is hypothetical. I haven't published any textbooks myself and have no immediate plans to do so. In any case, my personal preference would be to make the book available to students for free, if at all possible. So I've phrased this question in the first person for rhetorical convenience only.
I had intended the question to be only about the potential financial conflict of interest that could arise if I make money by assigning my own book. Some of the answers feel that it is improper for me to assign my own textbook at all, whether I make money or not, but I don't think this point of view is prevalent within the academic community. If it happens that my book (as a pithy but now-deleted comment put it) "blows", I think most would agree that my decision to assign it is pedagogically unfortunate, but not unethical.
I don't literally mean that students would be required to buy the book, only that they'd be expected to have it. I might assign readings or homework problems from the book, so that the student needs access to the book in order to do them, but they could certainly achieve this by getting a used copy or borrowing from a friend. But probably most students would buy new copies anyway, since that is the most convenient way.