Patients entered in the study are randomly assigned to trimetrexate / leucovorin (TMTX / LCV) or to sulfamethoxazole/trimethoprim (SMX/TMP) for a 21-day trial. For the first 10 days, the trial is double-blind (neither patient nor physician knows which drugs the patient is receiving), and drugs are given by intravenous infusion. TMTX is given once every 24 hours and LCV every 6 hours; SMX/TMP is given every 6 hours. Doses are determined by body size. After the first 10 days, LCV and SMX/TMP may be given orally. Doses are adjusted or treatment is changed to intravenous pentamidine if side effects are too severe. During the 21-day trial, zidovudine (AZT) may not be used because of possible increased bone marrow toxicity. AZT may be resumed as soon as the patient's white cell count is acceptable. Drug therapy aimed at preventing recurrence of PCP is not allowed for a minimum of 4 weeks after the completion of study therapy.