  It is shown that the structure of thermodynamics is "form invariant", when it
is derived using maximum entropy principle for various choices of entropy and
even beyond equilibrium. By the form invariance of thermodynamics, it is meant
that the form of the free energy (internal energy minus the temperature times
entropy) remains unaltered when all the entities entering this relation are
suitably defined. The useful ingredients for this are the equilibrium entropy
associated with thermal density matrix and the relative entropy between an
arbitrary density matrix and the thermal density matrix. To delineate the form
invariance, we consider the quantum R\'enyi entropic versions (indexed by a
parameter $\alpha$), i.e., R\'enyi entropy with appropriate internal energy and
equilibrium state defined for all $\alpha$. These results reduce to the
well-known Gibbs-von Neumann results when $\alpha \rightarrow 1$. Moreover, we
show that the \textit{universality} of the Carnot statement of the second law
is the consequence of the form invariance of the free energy. Further, the
Clausius inequality, which is the precursor to the Carnot cycle, is also shown
to hold based on the known data processing inequalities for the traditional and
the sandwiched R\'enyi relative entropies. Thus, we find the thermodynamics of
nonequilibrium state and its deviation from equilibrium together determine the
thermodynamic laws.
