TransWikia.com

Redefining chapter for indices

TeX - LaTeX Asked by Seabody on August 10, 2021

I am redefining chapter in my tufte-book document to add a minitoc in the margin for every chapter like this:

letochapchapter
setlength{mtcindent}{0pt}
renewcommand{mtctitle}{Chapter Contents}
renewcommand{chapter}[1]{ochap{#1}%
    marginnote{%
        begin{minipage}{marginparwidth}%
        minitoc%
        end{minipage}%
    }
}

This works (albeit hackily), except for the index. The index renders like this:

The broken index page

Ideally, it should render like this:

A correctly rendered index page

As I understand it, I think this requires me to redefine the chapter* starred command? As I am redefining chapter. But any attempt at redefining the starred command fails for me.

Full MWE

documentclass{tufte-book}

usepackage{imakeidx}
usepackage{minitoc}
usepackage{lipsum}

makeindex

% insert minitoc
letochapchapter
setlength{mtcindent}{0pt}
renewcommand{mtctitle}{Chapter Contents}
renewcommand{chapter}[1]{ochap{#1}%
    marginnote{%
        begin{minipage}{marginparwidth}%
        minitoc%
        end{minipage}%
    }
}

begin{document}
    dominitoc
    chapter{A chapter}
    
    section{Stuff to be indexed}
    I will put this in the index as long as it is coherentindex{coherent}.
    
    section{Other stuff}
    
    lipsum[1-3]
    
    printindex
end{document}

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP