Take a weak acid, and add #"HALF AN EQUIV"# of a strong base. And #pH# is governed by the relationship:
#pH=pK_a+log_10{[[A^-]]/[[HA]]}#
In the scenario I proposed, #pH=pK_a# because #[HA]=[A^-]# (and #log_(10)1=0#). If I wanted a solution buffered to a particular #pH# I would choose a weak acid with a #pK_a# CLOSE to the #pH# I wanted to maintain. Of course, I could vary the #pH# of the buffer up or down by jiggering the concentrations of #H_3O^+# and #HO^-# appropriately.
See here for a fuller treatment.