1

I am trying to adapt Thorsten Donig's answer for classicthesis and arsclassica. Consider this MWE.

\documentclass[12pt,b5paper,twoside]{book}
\usepackage{classicthesis}
\usepackage{arsclassica}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[inner=2.2cm,outer=1.8cm,bottom=2.7cm,top=2.5cm]{geometry}
\usepackage{lipsum}

\newcommand{\secmark}{}
\newcommand{\marktotoc}[1]{\renewcommand{\secmark}{#1}}
\newenvironment{advanced}{
  \renewcommand{\secmark}{$\star$}%
  \addtocontents{toc}{\protect\marktotoc{$\star$}}
}
{\addtocontents{toc}{\protect\marktotoc{}}}

\titleformat{\section}{\raggedright}{\makebox[1.5em][l]{\llap{\secmark}\thesection}}{0.5em}{\spacedlowsmallcaps}

\makeatletter\renewcommand{\@tocrmarg}{2.55em plus1fil}\makeatother

\begin{document}
\frontmatter
\tableofcontents
\cleardoublepage

\mainmatter
\chapter{First Chapter}
\lipsum[2]
\section{Easy Section}
\lipsum[2]
\begin{advanced}
\section{Hard Section}
\lipsum[2]
\end{advanced}
\end{document}

So far, I can make it works for the section title but I have no idea to make the mark appears in ToC. How can we do this?

1 Answer 1

2

classicthesis uses package tocloft. So you \marktotoc has to redefine \cftsecpresnum:

\documentclass[12pt,b5paper,twoside]{book}
\usepackage{classicthesis}
\usepackage{arsclassica}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[inner=2.2cm,outer=1.8cm,bottom=2.7cm,top=2.5cm]{geometry}
\usepackage{lipsum}

\newcommand{\secmark}{}
\newcommand{\marktotoc}[1]{\renewcommand{\cftsecpresnum}{\llap{#1}}}% <- changed
\newenvironment{advanced}{
  \renewcommand{\secmark}{$\star$}%
  \addtocontents{toc}{\protect\marktotoc{$\star$}}
}
{\addtocontents{toc}{\protect\marktotoc{}}}

\titleformat{\section}{\raggedright}{\makebox[1.5em][l]{\llap{\secmark}\thesection}}{0.5em}{\spacedlowsmallcaps}

\makeatletter\renewcommand{\@tocrmarg}{2.55em plus1fil}\makeatother

\begin{document}
\frontmatter
\tableofcontents
\cleardoublepage

\mainmatter
\chapter{First Chapter}
\lipsum[2]
\section{Easy Section}
\lipsum[2]
\begin{advanced}
\section{Hard Section}
\lipsum[2]
\end{advanced}
\section{Another Easy Section}
\lipsum[2]
\end{document}

Result:

enter image description here

You must log in to answer this question.

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