2

I have a chapter table of contents inserted as a margin note.

Is there a way to align the margin note and section header? I have tried inserting the margin note definition in the section header as suggested here, but it seems to interfere with the table of contents and the file doesn't compile.

MWE:

\documentclass[a4paper, 10pt, oneside]{memoir}
% Page layout
\setlrmarginsandblock{1.7cm}{8.5cm}{*}
\setulmarginsandblock{1.7cm}{2.5cm}{*}
\setmarginnotes{0.5cm}{\dimexpr(\stockwidth-\textwidth-4.4cm)}{1em}
\checkandfixthelayout
\chapterstyle{bianchi}

\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{hyperref}
\usepackage{lipsum}
\usepackage{marginnote}

\newcommand{\chaptoc}{
    \startcontents[chapters]
    \marginnote{
        {
            \large
            \bfseries
            \sffamily
            OUTLINE
        }
        \vspace{0.5em}
        \hrule
        \printcontents[chapters]{}{1}[1]{}
        \hrule
}}

\begin{document}

    \chapter{Example Chapter}

    {\chaptoc\section{Example Section}}

    \lipsum
    \section{Example Section II}
    \lipsum
    \subsection{Example Subsection}
    \lipsum

    {\chaptoc\chapter{Example Chapter}}

    \section{Example Section III}
    \lipsum
    \section{Example Section IV}
    \lipsum
    \subsection{Example Subsection}
    \lipsum

\end{document}

enter image description here

Thank you!

2

Here is a way with aligned minipages:

\documentclass[a4paper, 10pt, oneside]{memoir}
% Page layout
\setlrmarginsandblock{1.7cm}{8.5cm}{*}
\setulmarginsandblock{1.7cm}{2.5cm}{*}
\setmarginnotes{0.5cm}{\dimexpr(\stockwidth-\textwidth-4.4cm)}{1em}
\checkandfixthelayout
\chapterstyle{bianchi}

\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{hyperref}
\usepackage{lipsum}
\usepackage{marginnote}

\newcommand{\chaptoc}{
    \startcontents[chapters]
    \marginnote{
    \begin{minipage}[b,inner sep=0,outer sep=0]{\linewidth}
           { \large
            \bfseries
            \sffamily
             OUTLINE
        }
        \vspace{0.5em}
        \hrule
        \printcontents[chapters]{}{1}{}
        \hrule
        \end{minipage}
}}

\begin{document}

    \chapter{Example Chapter}

    {\chaptoc\noindent\begin{minipage}[inner sep=0,outer sep=0]{0.9\linewidth}\section{Example Section}\end{minipage}}

    \lipsum
    \section{Example Section II}
    \lipsum
    \subsection{Example Subsection}
    \lipsum

    {\chaptoc\chapter{Example Chapter}}

    \section{Example Section III}
    \lipsum
    \section{Example Section IV}
    \lipsum
    \subsection{Example Subsection}
    \lipsum

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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