1

I am using the book class. In the preamble I have:

\usepackage{sectsty}
\allsectionsfont{\sffamily}

to change the font of chapters and sections. I would also like the title page where it shows the title, author, and date to be that font also. How what do I need to add to do this?

Also, I was looking the documentation for the book class and it seems to have the capability to make an index. I tried

\begin{theindex}
\item{Number, Prime}
\end{theindex}

but I am not sure how the page numbering for the index works. Do I have to manually put it in or is it like other packages where I can denote it next to the word as it appears in my boo?

Johannes_B
  • 24,235
  • 10
  • 93
  • 248
  • Welcome to TeX SX! For the first point, \usepackage{etoolbox}\AtBeginEnvironment{titlepage}{\sffamily} should do the trick. For the index, I do not quite understand: do you want to make an index by hand? – Bernard May 08 '17 at 00:10
  • Those ae two very different question, i suggest to divide them into separate questions. – Johannes_B May 08 '17 at 05:01
  • For the titlepage, you can do what Bernard already wrote. You can also have a look at Ho to customize my titlepage or Title Creation if you need something non-standard. – Johannes_B May 08 '17 at 05:02
  • You have two compeltely different questions put in one. That would be fine for a discussion forum, but here, it isn't good at all. The question (and answer) will be confusing for other users searching for a solution. If i wouldn't just having my coffee, i would vote to close the question as too broad. Why? It is too broad. – Johannes_B May 09 '17 at 04:53

1 Answers1

1

A standard automatic index with in LaTeX need this minimal structure:

\documentclass{book} 
\usepackage{makeidx} 
\makeindex 
\begin{document}
Hello world\index{World}  
\printindex{}
\end{document}

Note that pdflatex will not make the index, but a auxiliary file .idx that then must be processed by makeindex, that not surprisingly, make the index with, but in another auxiliary file with .ind extension with content like \indexentry{Word}{3}. Then run pdflatex again at least two times to include that entries in the PDF.

Search in https://www.ctan.org/topic/index for several alternatives to makeidx packages.

For the font of title, author, and date, the simplest is:

1) Switch to scrbook class. The default for title and sections is nearly of what you want, except for author and date, but this can be changed with \setkomafont without messing up their arguments:.

\documentclass{scrbook}
\setkomafont{author}{\sffamily}
\setkomafont{date}{\sffamily}
\begin{document}
\title{The title}
\author{You}
\date{today}
\maketitle
\chapter{Test}
\section{Test}
\end{document}

2) include the desired format in the argument, i.e., \title{\sffamily\Huge\bfseries ...} and so on. People (me too) hate this because is against principle of the separation of formats and contents in LaTeX, but any other solution add enough code in the preamble to see this not too bad. See however titling and titlepages packages if you want custom title pages.

Fran
  • 80,769
  • Another question that holds to questions, each of which probably a duplicate, and an answer. Tagging around here is almost useless. – Johannes_B May 09 '17 at 04:41
  • I wonder what another user is thinking when searching for a solution on this site. But this probably is one for meta. – Johannes_B May 09 '17 at 04:49