A printer comprising: a printer mechanism unit including a frame and a print head; a platen unit including a platen roller; a detection switch configured to detect connecting of the platen unit to the printer mechanism unit; and a switch holder having the detection switch attached thereto and covering part of the detection switch, wherein: the switch holder is mounted to one of the frame and the platen unit; characterised in that a first internal face of the switch holder has a rib projecting from the first internal face with an arc-shaped cross-section, and the detection switch is fastened inside the switch holder between the rib on the first internal face and a second internal face of the switch holder opposite to the first internal face, wherein the rib is in line contact or point contact with the detection switch; the detection switch is connected to a flexible substrate, and the switch holder has one or more holder projections; and the flexible substrate has one or more securing holes corresponding in position to the one or more holder projections, and the one or more holder projections are configured to enter the one or more securing holes, respectively, of the flexible substrate when the detection switch is attached to the switch holder. a printer mechanism unit including a frame and a print head; a platen unit including a platen roller; a detection switch configured to detect connecting of the platen unit to the printer mechanism unit; and a switch holder having the detection switch attached thereto and covering part of the detection switch, wherein: the switch holder is mounted to one of the frame and the platen unit; characterised in that a first internal face of the switch holder has a rib projecting from the first internal face with an arc-shaped cross-section, and the detection switch is fastened inside the switch holder between the rib on the first internal face and a second internal face of the switch holder opposite to the first internal face, wherein the rib is in line contact or point contact with the detection switch; the detection switch is connected to a flexible substrate, and the switch holder has one or more holder projections; and the flexible substrate has one or more securing holes corresponding in position to the one or more holder projections, and the one or more holder projections are configured to enter the one or more securing holes, respectively, of the flexible substrate when the detection switch is attached to the switch holder. the switch holder is mounted to one of the frame and the platen unit; characterised in that a first internal face of the switch holder has a rib projecting from the first internal face with an arc-shaped cross-section, and the detection switch is fastened inside the switch holder between the rib on the first internal face and a second internal face of the switch holder opposite to the first internal face, wherein the rib is in line contact or point contact with the detection switch; the detection switch is connected to a flexible substrate, and the switch holder has one or more holder projections; and the flexible substrate has one or more securing holes corresponding in position to the one or more holder projections, and the one or more holder projections are configured to enter the one or more securing holes, respectively, of the flexible substrate when the detection switch is attached to the switch holder.