Batteries are electrochemical[1], and the amount of energy in them depends on the amount of active ingredients (for a given composition).
I guess the distance between the electrodes affect the internal resistance which can affect the effective energy output somewhat, but primarily it's the number of molecules that can undergo redox that affects the energy stored.
I guess the distance between the electrodes affect the internal resistance which can affect the effective energy output somewhat, but primarily it's the number of molecules that can undergo redox that affects the energy stored.
[1]: https://en.wikipedia.org/wiki/Galvanic_cell