Need tips on using 401(k) loans for investing

I’m looking for financial advisors and experts on retirement financing and taxes with tips on whether it ever makes sense to use a 401(k) loan for investing, like a margin account. Have you ever recommended this, or warned a client off? What were the circumstances? What are the pros and cons? Seems to me it would be tempting if one saw an investing opportunity with returns beating the 401(k)s. I’d like to be walked through an example that would include accounting for tax issues if the loan were for an investment in a taxable account. What factors need to be considered? Projected returns foregone in the 401(k)? Expected returns on the new investment? Tax costs? Interest on the loan? Generally, what are appropriate reasons to take out a 401(k) loan? Inappropriate ones? If one were desperate to raise money for a new investment, what other ways should one consider? A margin account?Home equity loan? Personal loan? What else should I be asking? Requirements: I prefer responses by email containing usable content and quotes, and because I usually get plenty I rarely respond to ones merely offering a source for interview. Please include the source’s contact info, full name, title, firm and location.