  Layered materials (LMs), such as graphite, hexagonal boron nitride, and
transition-metal dichalcogenides, are at the centre of an ever increasing
research effort, due to their scientific and technological relevance. Raman and
infrared spectroscopies are accurate, non-destructive, approaches to determine
a wide range of properties, including the number of layers and the strength of
the interlayer interactions. Here, we present a general approach to predict the
complete spectroscopic fan diagrams, i.e., the relations between frequencies
and number of layers, $N$, for the optically-active shear and layer-breathing
modes of any multilayer comprising $N \geq 2$ identical layers. In order to
achieve this, we combine a description of the normal modes in terms of a
one-dimensional mechanical model, with symmetry arguments that describe the
evolution of the point group as a function of $N$. Group theory is then used to
identify which modes are Raman and/or infrared active, and to provide diagrams
of the optically-active modes for any stack composed of identical layers. We
implement the method and algorithms in an open-source tool directly available
on the Materials Cloud portal, to assist any researcher in the prediction and
interpretation of such diagrams. Our work will underpin all future efforts on
Raman and Infrared characterization of known, and yet not investigated, LMs.
