A mercury barometer has a glass tube closed at one end with an open mercury - filled reservoir at the base. The weight of the mercury creates a vacuum in the top of the tube known as Torricellian vacuum. Mercury in the tube adjusts until the weight of the mercury column balances the atmospheric force exerted on the reservoir. High atmospheric pressure places more force on the reservoir, forcing mercury higher in the column. Low pressure allows the mercury to drop to a lower level in the column by lowering the force placed on the reservoir. Since higher temperature levels around the instrument will reduce the density of the mercury, the scale for reading the height of the mercury is adjusted to compensate for this effect. The tube has to be at least as long as the amount dipping in the mercury + head space + the maximum length of the column.
what keeps mercury inside the tube in a mercury barometer
weight of the mercury column balances the atmospheric force exerted on the reservoir