Emacs has four pinyin input variants, the names start with
chinese-py. You can set the input method with
C-x enter \ or
M-x set-input-method, and get a description with
I haven't used any of them, and haven't read all the descriptions, so I don't know the exact difference between the variants.
If you just want to input the diacritical marks above the vowels that are used in pinyin to indicate the tone, you can also use an input method. You type two letters for the vowel+mark you want. For example, the method
'a -> á `a -> à ~a -> ă
More details with
list-input-methods and the descriptions, as explained above.
However, as far as I know, there's no pre-defined input method that includes the macron ā, but you can define your own method, as explained in this stackexchange question.