Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Please consider the following MWE. By default some lists (list of figures, list of tables) are numbered with arabic numbers in scrbook and some not (bibliography, index). How can I make LaTeX to use for these lists roman numbers instead of arabic numbers and arabic numbering only for the divisions chapter, section etc.

Example

I List of figures

II List of tables

1.Chapter

1.1 Section

2.Chapter

2.1 Section

III Bibliography

IV Index

EIDT

I know that for the numbering of pages you can switch from \pagenumbering{roman} to \pagenumbering{arabic}. Maybe there is a similar approach to my problem.

MWE

\documentclass[liststotocnumbered]{scrbook}

\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{makeidx}
\makeindex

\begin{document}

\tableofcontents
\listoffigures
\listoftables

\chapter{First chapter}

\section{Section}

    \begin{figure}[htbp]
       \centering
       \includegraphics{example.png} 
       \caption{example caption}
       \label{fig:example1}
    \end{figure}
    \index{Figure!Example1}

\subsection{Subsection}

    \begin{table}[htbp]
       \centering
       \begin{tabular}{@{} lcr @{}} 
          \toprule
          \multicolumn{2}{c}{Item} \\
          \cmidrule(r){1-2} 
          Animal    & Description & Price (\$)\\
          \midrule
          Gnat      & per gram & 13.65 \\
                    & each     &  0.01 \\
          Gnu       & stuffed  & 92.50 \\
          Emu       & stuffed  & 33.33 \\
          Armadillo & frozen   &  8.99 \\
          \bottomrule
       \end{tabular}
       \caption{Tab. 1}
       \label{tab:booktabs1}
    \end{table}
    \index{Table!Example1}

\chapter{Second chapter}
\section{Section}

    \begin{figure}[htbp]
       \centering
       \includegraphics{example.png} 
       \caption{example caption}
       \label{fig:example2}
    \end{figure}
    \index{Figure!Example2}

\subsection{Subsection}

    \begin{table}[htbp]
       \centering
       \begin{tabular}{@{} lcr @{}} 
          \toprule
          \multicolumn{2}{c}{Item} \\
          \cmidrule(r){1-2} 
          Animal    & Description & Price (\$)\\
          \midrule
          Gnat      & per gram & 13.65 \\
                    & each     &  0.01 \\
          Gnu       & stuffed  & 92.50 \\
          Emu       & stuffed  & 33.33 \\
          Armadillo & frozen   &  8.99 \\
          \bottomrule
       \end{tabular}
       \caption{Tab. 2}
       \label{tab:booktabs2}
    \end{table}
    \index{Table!Example2}

\addcontentsline{toc}{chapter}{Bibliography}
\bibliography{BibliographyFile}

\renewcommand{\indexname}{Index}
\addcontentsline{toc}{chapter}{Index}
\printindex

\end{document}
share|improve this question
    
Your example is a little odd. It looks like the chapters are part of the List of Tables –  StrongBad Nov 21 '12 at 14:17
    
@DanielE.Shub Sorry, my fault. All lists and chapters are of the same level. I took away the spacings. Hope it's clearer now. –  John Nov 21 '12 at 14:23
    
It is not the spacing, it is the idea that the things between item B and item C belong to item B. –  StrongBad Nov 21 '12 at 14:29
    
@DanielE.Shub Please see edit. I know, this makes hardly any difference but that's how it must be. My school told me so. –  John Nov 21 '12 at 14:53
1  
@John Another case of odd requirements by people who apparently know nothing about typography (and logic, in this case). :( –  egreg Nov 21 '12 at 16:53

1 Answer 1

up vote 6 down vote accepted

You can change the meaning of \chapter* that's issued for the special chapter:

\documentclass{scrbook}

\usepackage[demo]{graphicx}
\usepackage{booktabs}
\usepackage{imakeidx}
\makeindex

\makeatletter
\newif\ifintoc
\def\@schapter#1{%
  \if@twocolumn
    \if@at@twocolumn
      \@makeschapterhead{#1}%
    \else
      \@topnewpage[\@makeschapterhead{#1}]%
    \fi
  \else
    \@makeschapterhead{#1}\@afterheading
  \fi
  \ifintoc
    \stepcounter{specialchapter}%
    \addcontentsline{toc}{chapter}{\protect\numberline{\thespecialchapter}#1}%
  \fi
}
\makeatother
\newcounter{specialchapter}
\renewcommand{\thespecialchapter}{\Roman{specialchapter}}

\begin{document}

\intocfalse
\tableofcontents
\intoctrue

\listoffigures
\listoftables

\chapter{First chapter}

\section{Section}

    \begin{figure}[htbp]
       \centering
       \includegraphics{example.png} 
       \caption{example caption}
       \label{fig:example1}
    \end{figure}
    \index{Figure!Example1}

\subsection{Subsection}

    \begin{table}[htbp]
       \centering
       \begin{tabular}{@{} lcr @{}} 
          \toprule
          \multicolumn{2}{c}{Item} \\
          \cmidrule(r){1-2} 
          Animal    & Description & Price (\$)\\
          \midrule
          Gnat      & per gram & 13.65 \\
                    & each     &  0.01 \\
          Gnu       & stuffed  & 92.50 \\
          Emu       & stuffed  & 33.33 \\
          Armadillo & frozen   &  8.99 \\
          \bottomrule
       \end{tabular}
       \caption{Tab. 1}
       \label{tab:booktabs1}
    \end{table}
    \index{Table!Example1}

\chapter{Second chapter}
\section{Section}

    \begin{figure}[htbp]
       \centering
       \includegraphics{example.png} 
       \caption{example caption}
       \label{fig:example2}
    \end{figure}
    \index{Figure!Example2}

\subsection{Subsection}

    \begin{table}[htbp]
       \centering
       \begin{tabular}{@{} lcr @{}} 
          \toprule
          \multicolumn{2}{c}{Item} \\
          \cmidrule(r){1-2} 
          Animal    & Description & Price (\$)\\
          \midrule
          Gnat      & per gram & 13.65 \\
                    & each     &  0.01 \\
          Gnu       & stuffed  & 92.50 \\
          Emu       & stuffed  & 33.33 \\
          Armadillo & frozen   &  8.99 \\
          \bottomrule
       \end{tabular}
       \caption{Tab. 2}
       \label{tab:booktabs2}
    \end{table}
    \index{Table!Example2}

\bibliography{BibliographyFile}

\begin{thebibliography}{1}
\bibitem x
\end{thebibliography}

\renewcommand{\indexname}{Index}
\printindex

\end{document}

I've added a mock bibliography just to show the result.

enter image description here


The \listof... commands and the bibliography/index environments issue \chapter* for their working and this command is defined not to add an entry in the table of contents. So I redefine it (more precisely the \@schapter command) to add one and in the form

<Roman numeral> <Title> .... <page>

where the numeral is obtained from a new counter that is stepped. However, since we don't want that the table of contents does the same, this part of the code is executed only if a conditional (\ifintoc) is true. The conditional is set to false before \tableofcontents and to true just after it. This last part might be made automatic, but I believe that it will be a "just once" application, so it shouldn't be a problem.

If you find that something you need to be crazy numbered isn't, just add a line

\addcontentsline{toc}{chapter}{\protect\numberline{\thespecialchapter}Foo}

in a suitable place as you did for the bibliography.


In order to get the number also in the headers (the usefulness of which I'm even less convinced than of putting the numbers in the table of contents), you can modify the definitions as follows (just the needed part):

\makeatletter
\newif\ifintoc
\def\@schapter#1{%
  \if@twocolumn
    \if@at@twocolumn
      \@makeschapterhead{#1}%
    \else
      \@topnewpage[\@makeschapterhead{#1}]%
    \fi
  \else
    \@makeschapterhead{#1}\@afterheading
  \fi
  \ifintoc
    \let\@mkboth\@gobbletwo
    \stepcounter{specialchapter}%
    \addcontentsline{toc}{chapter}{\protect\numberline{\thespecialchapter}#1}%
    \markboth{\MakeMarkcase{\thespecialchapter\ #1}}{\MakeMarkcase{\thespecialchapter\ #1}}
  \fi}
\makeatother
\newcounter{specialchapter}
\renewcommand{\thespecialchapter}{\Roman{specialchapter}}

If you want also that the titles bear the number, then something like the following should do.

\makeatletter
\newif\ifintoc
\def\@schapter#1{%
  \ifintoc
    \stepcounter{specialchapter}%
  \fi
  \if@twocolumn
    \if@at@twocolumn
      \@makeschapterhead{\ifintoc\thespecialchapter\ \fi#1}%
    \else
      \@topnewpage[\@makeschapterhead{\ifintoc\thespecialchapter\ \fi#1}]%
    \fi
  \else
    \@makeschapterhead{\ifintoc\thespecialchapter\ \fi#1}\@afterheading
  \fi
  \ifintoc
    \let\@mkboth\@gobbletwo
    \addcontentsline{toc}{chapter}{\protect\numberline{\thespecialchapter}#1}%
    \markboth{\MakeMarkcase{\thespecialchapter\ #1}}{\MakeMarkcase{\thespecialchapter\ #1}}
  \fi}
\makeatother
\newcounter{specialchapter}
\renewcommand{\thespecialchapter}{\Roman{specialchapter}}
share|improve this answer
1  
One important note: one can write \documentclass[liststotocnumbered,bibtotocnumbered]{scrbook} to make lists as listoffigures, listoftables and bibliography appear in the toc numbered. As egreg mentioned all these lists are embedded in the \chapter*-environment. With liststotocnumbered,bibtotocnumbered LaTeX seems to change the environments of these list to \chapter. Therefor, to make egreg's approach feasible one must delete liststotocnumbered,bibtotocnumbered. –  John Nov 26 '12 at 19:09
    
In the toc everything is numbered as I wanted it to be but the headings of \listof... remain unnumbered. I guess one must change the \chapter*-environment, so that these are numbered with roman numbers. How would it be possible to implement this in your code? –  John Nov 26 '12 at 19:16
    
@John It's possible, see edit. –  egreg Nov 26 '12 at 21:04
    
I suppose that the distance between the number and the chapter's title is one space (\thespecialchapter\ \fi#1). Do know the exact spacing between the number and the title for the chapter-environment? –  John Nov 26 '12 at 22:31
    
@John It should be \enspace; use \ifintoc\thespecialchapter\autodot\enspace\fi –  egreg Nov 26 '12 at 22:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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