0

The answer referred to above involves Koma and deals with a single chapter. I have not been able to make any use of the answer in my case where the document class is book and where I want to deal with all chapters.

I would like to define a titletoc command which, like \chapter* suppresses the word Chapter and the chapter number in the title of the chapter but produces both a table of content entry and a running head, both without the word Chapter and the chapter number.

As it turned out, though, the question had indeed been asked and, as @Johannes_B finally pointed out in a comment, an answer given at Creating unnumbered chapters/sections (plus adding them to the ToC and/or header) To wit, \chapter* need not be redefined but two lines need to be added. Seems a bit clunky but a macro to insert chapter* along with the two lines can do the job.

Correction: The two lines were given in the question referred to above, by @egreg, but hidden in a comment. :-(

Here is a MWE with the additional two necessary lines indented:

\documentclass[11pt]{book}
\usepackage{titletoc}
\usepackage{hyperref}
\begin{document}
\tableofcontents
\chapter*{One}
    \addcontentsline{toc}{chapter}{One}
    \markboth{\MakeUppercase{One}}{\MakeUppercase{One}} 
Text  
\newpage
Text  Text 
\newpage
Text  Text  Text
\end{document}
schremmer
  • 2,107
  • Search for unnumberedtotoc – Johannes_B Mar 23 '18 at 01:31
  • By the way, what has titletoc to do with that? – Johannes_B Mar 23 '18 at 06:16
  • @Johannes_B 1. With MWEs, you are damned if you do and damned if you don't. :-)) I am using titletoc for the book so it has to work for titletoc 2. I saw the suggested question but a) it involves KOMA and b) was for only one chapter, namely the Introduction. That was not my question which was how to redefine \chapter*, that is it should work for all chapters---and with hyperref. 3. I tried your unnumberedtotoc.sty but got "Illegal parameter number in definition of \addchap" And, as a LaTeX illiterate, I have no idea what to do. – schremmer Mar 23 '18 at 17:23
  • Probably update, or something, as the package works for most folks. ... – Johannes_B Mar 23 '18 at 19:57
  • @Johannes_B Re. update: I downloaded it a couple of hours ago. Re. something: any suggestion? (I am really stuck.) – schremmer Mar 23 '18 at 20:15
  • Update your tex distribution. – Johannes_B Mar 24 '18 at 03:28
  • Without a clear question, it is hard to help. titletoc is the wrong tool, it is a screwdriver, but you need a hammer. titletoc has nothing to do with what you want. Anyway, unnumberedtotoc can help you, but you state that there is an error, but don't give a clear indication what the error is. Please edit your question and incorporate an up to date minimal working example. Also, have a look at https://tex.stackexchange.com/questions/35433/creating-unnumbered-chapters-sections-plus-adding-them-to-the-toc-and-or-header I also think the answer below is very bad, one wouldn't do that. – Johannes_B Mar 24 '18 at 06:32
  • You could just as well be looking for frontmatter, who know? – Johannes_B Mar 24 '18 at 06:38

1 Answers1

1

"If you want to get something done well, do it yourself."

\phantomsection %% hyperref thingy
\addcontentsline{toc}{chapter}{Introduction} %% add to toc
\chapter*[Introduction]{Introduction} %% actual chapter invocation
\let\backupthefigure\thefigure  %% dark voodoo magic to get figure numbers go like
\renewcommand{\thefigure}{0.\arabic{figure}} %% Fig. 0.2 instead of Fig. 2

I used memoir style here, apparently the running head declaration is memoir-specific.


Update. The book style works based in MWE, however you need to adapt the style of the running heads yourself. Notice the order of \chapter and addtotoc. (It was different in my initial code, but worked there somehow, probably because of further things omitted here.)

\documentclass[11pt,twoside]{book}
\usepackage{hyperref}
\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage{lipsum}
\begin{document}
\tableofcontents
\cleardoublepage

\phantomsection %% hyperref thingy
\chapter*{One} %% actual chapter invocation
\addcontentsline{toc}{chapter}{One} %% add to toc

%% see https://tex.stackexchange.com/questions/68308/how-to-add-running-title-and-author
\fancyhead[RE]{One}
%\fancyhead[LO]{2013 Firstauthor and Secondauthor}

\lipsum[1-3]

\chapter{Real One}

\lipsum[4-10]

\end{document}

The memoir class (which I used and which I regard superior to book) works this around the way I initially posted, here is the full code and a screenshot:

\documentclass[11pt,twoside]{memoir}
\usepackage{hyperref}

\usepackage{lipsum}
\begin{document}
\tableofcontents
\cleardoublepage

\phantomsection %% hyperref thingy
\chapter*[One]{One} %% actual chapter invocation
\addcontentsline{toc}{chapter}{One} %% add to toc

\lipsum[1-5]

\chapter{Real One}

\lipsum[4-10]

\end{document}

the optional parameter for chapter works for memoir

By the way, you might consider using microtype and natbib/biblatex. These increase writer's productivity (when writing scientific texts) and optics of the result greatly.

  • I have added a MWE using your code which does produce a TOC entry but not a running head. The MWE does not include [One] in the\Chapter* command because that prints a large [ in place of the title and One]One Text Text Text instead of text text text – schremmer Mar 22 '18 at 23:06
  • Okay, then the \chapter*[foo]{bar} syntax is memoir-specific. – Oleg Lobachev Mar 22 '18 at 23:59
  • Here is something on modifying running heads: https://tex.stackexchange.com/questions/68308/how-to-add-running-title-and-author – Oleg Lobachev Mar 23 '18 at 00:10
  • Why are you redefining the figure counter representation? – Johannes_B Mar 23 '18 at 06:21
  • It was copied out of my document. There, I had the introduction as an unnumbered chapter, followed by numbered chapters. In the latter the figures were numbered like 2.12, but in the first unnumbered chapter they were numbered like 12. The redefinition fixes that. It should be canceled after the unnumbered chapter ends. – Oleg Lobachev Mar 23 '18 at 10:20
  • @OlegLobachev Also, the toc entries link to the chapters only when the toc is just before the end of the document. As for the question on how to modify running heads, it involves fancyhdr and the code is already "a fragile construction". Or so some say. :-)) – schremmer Mar 23 '18 at 17:46
  • I don't understand your toc comment, sorry. Yeah, by no means stable, but worked well for me. – Oleg Lobachev Mar 23 '18 at 18:24
  • @OlegLobachev I copied the MWE which has \tableofcontents at the end. I compiled it. When I click on the toc entry in the pdf, I get to the chapter. But: if I move \tableofcontents to any other place in the source, when I click on the toc entry, I do not get to the chapter. I had not thought the question was such a hard one. But it sure seems to be. – schremmer Mar 23 '18 at 19:59
  • Swap the \chapter and addtotoc. I am updating my answer. – Oleg Lobachev Mar 23 '18 at 20:49
  • @OlegLobachev 1. I should have thought about the swap. :-( Anyway, I have updated the MWE accordingly but, see the question, the running head now runs throughout the book. 2. I am really inept at LaTeX but have produced several books over the years during which I have evolved a fairly complicated structure---which I don't really understand---but which does what I want and which I do not want to change because I am old and running out of time. But, as I am often reminded, it is an increasingly fragile construction. – schremmer Mar 23 '18 at 22:42