1

I am typesetting a book with Sections. Using TeXShop. Using imakeidx. I'd like to have the index in the toc without a section number. Right now everything is fine except that instead of the heading "Index" at the top of the index I get

Section IV

Index

also in printing out the index, the header is Index on even-numbered pages, and INDEX on odd.

Here's my main file (I left out what I believe is irrelevant. This should run and show the first problem)

\documentclass[12pt]{book}

\renewcommand{\thechapter}{\Roman{chapter}}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancypagestyle{MyStyle}{%
    \fancyhead{} %Clean headers
    \fancyhead[RO]{\slshape\nouppercase{\rightmark}}
    \fancyhead[LE]{\leftmark}
    \renewcommand{\chaptermark}[1]{\markboth{\thechapter. {\slshape{##1}}}{}}
}

\usepackage[explicit]{titlesec}
\let\subsection\section
\let\section\chapter
\usepackage{graphicx}
\usepackage{caption}\usepackage{endnotes}
\usepackage{subcaption}
\usepackage{imakeidx}
\usepackage{url} 
\usepackage{booktabs}
\usepackage{hyperref} 
\usepackage[table]{xcolor}
%...
\newcommand{\vs}{\vspace{.1in}}
\newcommand{\ds}{\displaystyle}

\newcommand\mychap{%
  \titleformat{\chapter}[display]
{\normalfont \Huge \bfseries}{}{0pt}
{ Section \thechapter\\  ##1}%
}
\newcommand{\figc}[1]{Fig. I.~\ref{#1}}
\newcommand{\figca}[1]{I.~\ref{#1}}
\newcommand{\figcb}[1]{II.~\ref{#1}}
\newcommand{\figcc}[1]{III.~\ref{#1}}
\newcommand{\figcd}[1]{IV.~\ref{#1}}
%...
\addcontentsline{toc}{chapter}{\protect\numberline{Introduction}}
%...
\makeatother
\makeindex[columns=2, title=Index, intoc]

\begin{document}

\pagestyle{plain}
\frontmatter

\mainmatter

\newpage
$~$
\pagestyle{MyStyle}
\mychap

\renewcommand{\figc}[1]{Fig.\ IV.~\ref{#1}}
\renewcommand{\figurename}{Fig.\ IV.}
\renewcommand\thefigure{\arabic{figure}}
\setcounter{figure}{0}
\input{Stack-Part-IV}

\printindex
\end{document}

and here's Stack-Part-IV.tex:

\fontfamily{ppl}\selectfont{
\mychap 
\section{Verrocchio's non-figural sculptures}

Sample text with endnote\endnote{This would be an endnote} and an index entry\index{Entry, index}.

}
\newpage  
\subsection{Picture credits  for Section IV}
\fontfamily{cmr}\selectfont{

Stand-in for picture credit.
}
\theendnotes
2
  • \endmatter?12
    – cfr
    Commented Sep 1, 2023 at 3:27
  • @cfr Do you mean \backmatter? Where would you add it? Commented Sep 1, 2023 at 9:44

1 Answer 1

1

To correct the first problem, you could add one more \titleformat before \printindex as you've already done with \mychap, e.g.:

\titleformat{\chapter}[display]{\normalfont\Huge\bfseries}{0}{0pt}{##1}

The second problem is because of the \nouppercase in your definition of page style MyStyle. So IMHO you would need to change this too, e.g., for INDEX on odd an even pages:

\fancypagestyle{MyBackStyle}{%
    \fancyhead{} %Clean headers
    \fancyhead[RO]{\slshape\rightmark}%
    \fancyhead[LE]{\leftmark}%
    \renewcommand{\chaptermark}%[1]{\markboth{\thechapter. {\slshape{##1}}}{}}
}

All together:

\begin{filecontents*}{Stack-Part-IV.tex}
\fontfamily{ppl}\selectfont{
\mychap 
\section{Verrocchio's non-figural sculptures}

Sample text with endnote\endnote{This would be an endnote} and an index entry\index{Entry, index}.

}
\newpage  
\subsection{Picture credits  for Section IV}
\fontfamily{cmr}\selectfont{

Stand-in for picture credit.
}
\theendnotes
\end{filecontents*}
\documentclass[12pt]{book}

\renewcommand{\thechapter}{\Roman{chapter}}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancypagestyle{MyStyle}{%
    \fancyhead{} %Clean headers
    \fancyhead[RO]{\slshape\nouppercase{\rightmark}}%
    \fancyhead[LE]{\leftmark}%
    \renewcommand{\chaptermark}[1]{\markboth{\thechapter. {\slshape{##1}}}{}}%
}
\fancypagestyle{MyBackStyle}{%
    \fancyhead{} %Clean headers
    \fancyhead[RO]{\slshape\rightmark}%
    \fancyhead[LE]{\leftmark}%
    \renewcommand{\chaptermark}[1]{\markboth{\thechapter. {\slshape{##1}}}{}}%
}

\usepackage[explicit]{titlesec}
\let\subsection\section
\let\section\chapter
\usepackage{graphicx}
\usepackage{caption}\usepackage{endnotes}
\usepackage{subcaption}
\usepackage{imakeidx}
\usepackage{url} 
\usepackage{booktabs}
\usepackage{hyperref} 
\usepackage[table]{xcolor}
%...
\newcommand{\vs}{\vspace{.1in}}
\newcommand{\ds}{\displaystyle}

\newcommand\mychap{%
  \titleformat{\chapter}[display]
{\normalfont \Huge \bfseries}{}{0pt}
{ Section \thechapter\\  ##1}%
}
\newcommand\backchap{%
  \titleformat{\chapter}[display]{\normalfont\Huge\bfseries}{0}{0pt}{##1}}
\newcommand{\figc}[1]{Fig. I.~\ref{#1}}
\newcommand{\figca}[1]{I.~\ref{#1}}
\newcommand{\figcb}[1]{II.~\ref{#1}}
\newcommand{\figcc}[1]{III.~\ref{#1}}
\newcommand{\figcd}[1]{IV.~\ref{#1}}
%...
\addcontentsline{toc}{chapter}{\protect\numberline{Introduction}}
%...
\makeatother
\makeindex[columns=2, title=Index, intoc]

\begin{document}

\pagestyle{plain}
\frontmatter

\mainmatter

\newpage
$~$
\pagestyle{MyStyle}
\mychap

\renewcommand{\figc}[1]{Fig.\ IV.~\ref{#1}}
\renewcommand{\figurename}{Fig.\ IV.}
\renewcommand\thefigure{\arabic{figure}}
\setcounter{figure}{0}
\input{Stack-Part-IV}

\clearpage
\backchap
\pagestyle{MyBackStyle}
\printindex
\clearpage
one more index fake page
\clearpage
one more index fake page
\end{document}
2
  • Welcome back! I haven't seen you since a long time, what happened?
    – Keks Dose
    Commented Sep 1, 2023 at 14:02
  • Schweinebacke: Vielen dank! Commented Sep 2, 2023 at 2:02

You must log in to answer this question.

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