By adopting the socio-historical approach to the development of Chinese mathematics in the nineteenth century, historians of mathematics often refer to correspondence and diary by the contemporary scholars aside with historical documents and texts. In this article, I will make use of the diary of Zhang Wenhu (1808-1885) to reconstruct the career of the late Qing Chinese mathematician Li Shanlan (1811-1882) in the period 1864-1868. It is due to this source material that we can better understand how Li Shanlan edited his own mathematical works, the Ze Gu Xi Zhai Suan Xue (lit. Collected Mathematical Works from the Ze Gu Xi Room) and why he treasured this publication so much.