An implantable cardiac rhythm management device is configured to remove
pacing artifacts from recorded electrograms by a subtraction method. A
template waveform representing a recorded pace without accompanying
cardiac electrical activity is generated. Such a pacing pulse template is
then aligned with the instant at which a pace is delivered and subtracted
from the recorded electrogram in order to remove the pacing artifact.