Patients entered in the study are randomly assigned to aerosolized PEN or to intravenous SMX/TMP, for a 21-day trial. SMX/TMP is given 4 times a day and aerosolized PEN once a day. Doses are determined by body size. Patients who receive aerosolized PEN also receive a placebo intravenous injection and patients who receive SMX/TMP also receive a placebo aerosol. Patients are hospitalized at least 5 days. Patients who improve may be discharged after 5 days at the discretion of the attending physician. Discharged patients continue the study with oral SMX/TMP and aerosolized placebo or aerosolized PEN and oral placebo. Patients who fail to respond or who develop severe adverse effects are switched to intravenous PEN or other standard therapy. During the 21-day trial, zidovudine (AZT) may not be used. AZT may be resumed after therapy for the acute PCP episode is completed.