6

How to put subsubsection in "moderncv" class? Only upto subsection is working in my script.

3
  • 1
    What \moderncvstyle are you using? In fact, you should at least consider the community by posting what we call a minimal working example (MWE). Something that starts with \documentclass and ends with \end{document}. It'll give us the foundation form which we can provide solutions.
    – Werner
    Nov 25, 2014 at 6:12
  • What does mean working? Is subsubsection known at all?
    – user31729
    Nov 25, 2014 at 6:26
  • An alternative for you could be komacv.
    – Johannes_B
    Nov 25, 2014 at 7:40

2 Answers 2

3

Sectioning commands in moderncv are only defined down to \subsection, so you'll have to define it manually.

Below I've added \subsubsections which mimic \subsection in its layout except for the font (given by the macro \subsubsectionfont). Add the following to your document preamble after loading your \moderncvstyle:

\renewcommand*{\sectionfont}{\Large\mdseries\upshape}
\renewcommand*{\subsectionfont}{\large\mdseries\upshape}
\newcommand*{\subsubsectionfont}{\large\mdseries\itshape}% New subsubsection font
\newcommand*{\subsubsectionstyle}[1]{{\subsubsectionfont\textcolor{color1}{#1}}}
\makeatletter
\NewDocumentCommand{\subsubsection}{sm}{%
  \par\addvspace{1ex}%
  \phantomsection{}% reset the anchor for hyperrefs
  \addcontentsline{toc}{subsubsection}{#2}%
  \begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
    \raggedleft\hintstyle{} &{\strut\subsubsectionstyle{#2}}%
  \end{tabular}%
  \par\nobreak\addvspace{0.5ex}\@afterheading}% to avoid a pagebreak after the heading
\makeatother

Example output using \moderncvstyle{casual} in the blue theme:

enter image description here

...
\section{References}
\subsection{Sub-references}
\subsubsection{Sub-sub-references}
...

The above \subsubsection definition should work under the classic style as well, but not banking.

2
  • How to use it for banking?
    – pratnala
    Sep 11, 2016 at 2:13
  • Looks like a little big, no? Mar 22, 2018 at 20:08
0

To expand on Werner's answer: as well as defining \subsubsection document command (see their answer), you might also want to increment the default bookmark depth set by moderncv.

Otherwise, subsubsections won't show in the PDF bookmarks.

\AtEndPreamble{
  \hypersetup{
    bookmarksdepth = 3
  }}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .