3

here a not-so MWE:

\documentclass{book}
\usepackage{graphicx}
\usepackage{polyglossia}
\setmainlanguage[spelling=new,babelshorthands=true]{german}
\usepackage[autostyle]{csquotes}
\usepackage{lipsum}
\usepackage[style=authortitle-icomp,backref=true,backrefstyle=two+,hyperref=true,isbn=false,backend=biber,citereset=chapter,bibencoding=utf8]{biblatex}
\usepackage[bookmarks]{hyperref}

\usepackage{titletoc}
\titlecontents{section}
[3.8em] % ie, 1.5em (chapter) + 2.3em
{}
{\contentslabel{2.3em}}
{\hspace*{-2.3em}}
{\titlerule*[1pc]{.}\contentspage}


\renewcommand\thechapter{\Alph{chapter}}

\begin{document}
\frontmatter
\tableofcontents
\chapter{First Chapter}
\label{one}
\section{First Section}
In section \ref{two} (this should be (A.1))

\mainmatter
\chapter{Second Chapter}
\section{Second Section}
\label{two}
\ref{one} haha

\end{document}

In the \tableofcontents I want the chapter not to appear for the sections. However, if I reference something, I want the chapter to appear in the reference.

How can I set the \titlecontents using the titletoc package so that it doesn't display the chapterlabel?

Thanks for the help.

1

Use \p@section, the prefix that's used for cross references, but not when generating the counter's representation:

\renewcommand{\thesection}{\arabic{section}}
\makeatletter
\renewcommand{\p@section}{\thechapter.}
\makeatother
\renewcommand\thechapter{\Alph{chapter}}

enter image description here

enter image description here

  • Hi, this works perfectly in the MWE I provided, however not in the PhD thesis I'm writing. What in hell is causing it, no idea. So I want to use titletoc now to do this. I updated the question. – Philipp Sep 21 '15 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.