You are not logged in.
Hi,
Here is my document (Minimal Working Example):
\documentclass[11pt,a4paper,oneside]{memoir}
\pagestyle{plain}
\usepackage[explicit]{titlesec}
\usepackage{fontspec}
\usepackage{xltxtra}
\usepackage{polyglossia}
\setmainfont[Mapping=tex-text]{Liberation Serif}
\setsansfont[Mapping=tex-text]{Liberation Sans}
\setmonofont[Mapping=tex-text]{Liberation Mono}
%% Ensure sequential numbering of subsubsections.
\setsecnumdepth{paragraph}
\counterwithout{paragraph}{subsubsection}
\counterwithout{subsubsection}{subsection}
\renewcommand{\thechapter}{\arabic{chapter}}
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\Roman{subsection}}
\renewcommand{\thesubsubsection}{\S\arabic{subsubsection}}
\setcounter{tocdepth}{3} % Must not precede the above
\titleformat{\paragraph}[hang]{\raggedleft\normalfont\small\itshape\bfseries}{}{0pt}{#1 \arabic{paragraph}}
\usepackage{hyperref}
\begin{document}
\tableofcontents
\chapter*{}
\section*{Beauty}
\label{sec:beauty}
\addcontentsline{toc}{section}{\nameref{sec:beauty}}
\section*{Preface}
\label{sec:preface}
\addcontentsline{toc}{section}{\nameref{sec:preface}}
\chapter*{First Grade}
\label{ch:firstgrade}
\addcontentsline{toc}{chapter}{\nameref{ch:firstgrade}}
\section*{Introduction}
\label{sec:intro}
\addcontentsline{toc}{section}{\nameref{sec:intro}}
\section{Outline}
\subsubsection{Charlie}
\paragraph{Exercise}
\paragraph{Exercise}
\subsubsection{Delta}
\section{Start}
\subsubsection{Continue}
\chapter*{Second Grade}
\label{ch:secondgrade}
\addcontentsline{toc}{chapter}{\nameref{ch:secondgrade}}
\setcounter{section}{0}
\setcounter{subsubsection}{0}
\section{Declension}
\subsubsection{Echo}
\paragraph{Exercise}
\paragraph{Exercise}
\end{document}The document structure is a bit unusual (it starts on section level, no first chapter specified, and subsubsection numbers run continuously through a chapter), but it is not for me to modify. There are two troubles:
(1) Echo ToC entry points to Charlie, and Declension to Outline (intuitive, but still wrong);
(2) Beauty, Preface, and Introduction ToC entries appear nameless and linkless, though First Grade and Second Grade chapter entries are OK.
I had to fool with counters due to the document structure forced on me, which is probably the cause of my trouble.
Hope there's a way to put things to rights.
PS stackexchange (the original question) should be the proper place to put a question like this, but they really loose all the interest in less than 24 hours.
Offline
Does this help?
Offline
Thank you, monodromy, for your precious attention!
It helped a bit, certainly. All the ToC entries are present, but still mostly incorrect. Introduction, Declension, and Echo ToC links are wrong. Curiously, all the document labels, as shown in TeXstudio Structure View, are now #2. The second parameter to \app... function calls is always supplied, I can't see why the problem.
\documentclass[11pt,a4paper,oneside]{memoir}
\pagestyle{plain}
\usepackage[explicit]{titlesec}
\usepackage{fontspec}
\usepackage{xltxtra}
\usepackage{polyglossia}
\setmainfont[Mapping=tex-text]{Liberation Serif}
\setsansfont[Mapping=tex-text]{Liberation Sans}
\setmonofont[Mapping=tex-text]{Liberation Mono}
%% Ensure sequential numbering of subsubsections.
\setsecnumdepth{paragraph}
\counterwithout{paragraph}{subsubsection}
\counterwithout{subsubsection}{subsection}
\renewcommand{\thechapter}{\arabic{chapter}}
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\Roman{subsection}}
\renewcommand{\thesubsubsection}{\S\arabic{subsubsection}}
\setcounter{tocdepth}{3} % Must not precede the above
%% Turns 10. Excercise into Exercise 10. Uses titlesec package which causes trouble.
\titleformat{\paragraph}[hang]{\raggedleft\normalfont\small\itshape\bfseries}{}{0pt}{#1 \arabic{paragraph}}
%% Redefines unnamed sections with labels in order to avoid titlesec trouble.
\newcommand{\appchapter}[2]{%
\phantomsection
\refstepcounter{chapter}%
\chapter*{#1}%
\addtocounter{chapter}{-1}%
\def\@currentlabelname{App: #1}%
\def\@currentlabel{\thechapter}%
\label{#2}%
\addcontentsline{toc}{chapter}{#1}%
}
\newcommand{\appsec}[2]{%
\phantomsection
\refstepcounter{section}%
\section*{#1}%
\addtocounter{section}{-1}%
\def\@currentlabelname{App: #1}%
\def\@currentlabel{\thesection}%
\label{#2}%
\addcontentsline{toc}{section}{#1}%
}
\newcommand{\appsubsec}[2]{%
\refstepcounter{subsection}%
\subsection*{#1}%
\addtocounter{subsection}{-1}%
\def\@currentlabelname{App: #1}%
\def\@currentlabel{\thesubsection}%
\label{#2}%
}
\newcommand{\appsubsubsec}[2]{%
\refstepcounter{subsubsection}%
\subsubsection*{#1}%
\addtocounter{subsubsection}{-1}%
\def\@currentlabelname{App: #1}%
\def\@currentlabel{\thesubsubsection}%
\label{#2}%
}
%% End of unnamed sections redefinition
\usepackage{hyperref}
\begin{document}
\tableofcontents
\chapter*{}
\appsec{Beauty}{sec:beauty}
\appsec{Preface}{sec:preface}
\appchapter{First Grade}{ch:firstgrade}
\appsec{Introduction}{sec:intro}
\section{Outline}
\subsubsection{Charlie}
\paragraph{Exercise}
\paragraph{Exercise}
\subsubsection{Delta}
\section{Start}
\subsubsection{Continue}
\appchapter{Second Grade}{ch:secondgrade}
% \setcounter{section}{0}
\setcounter{subsubsection}{0}
\section{Declension}
\subsubsection{Echo}
\paragraph{Exercise}
\paragraph{Exercise}
\end{document}Offline
Things are looking up, at last. A grand master shared his wisdom. A mere nothing remains: how am I supposed to customize my paragraph title without titlesec package?
Offline