To evaluate the safety of the combination of trimetrexate glucuronate (TMTX) and dapsone with leucovorin protection versus trimethoprim/sulfamethoxazole (TMP/SMX) in patients with AIDS and moderately severe Pneumocystis carinii pneumonia (PCP). To determine the pharmacokinetic parameters of TMTX, leucovorin, and dapsone and of TMP/SMX when given to patients with AIDS and moderately severe PCP.