10

I basically have the same question as this one Table of contents: section titles ragged right but none of the two solutions there work with memoir. I want to typeset section etc. titles raggedright instead of justified.

tocstyle just breaks when loaded with memoir and patching \@dottedtocline doesn't do anything. I also tried to change \cftKaftersnumb and \cftKfont, either of which should work according to my understanding of section 9.2 of the memoir documentation but neither definition works.

Here my attempt so far, MWE adapted from lockstep's answer to the linked question.

\documentclass{memoir}
\renewcommand{\cftsectionaftersnumb}{\raggedright}
\renewcommand{\cftsectionfont}{\raggedright}
\renewcommand{\cftchapteraftersnumb}{\raggedright}
\renewcommand{\cftchapterfont}{\raggedright}

\newcommand*{\sometext}{%
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
  vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
  mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
  Donec vehicula augue eu neque.%
}

\begin{document}

\tableofcontents

\chapter{\sometext}

\section{\sometext}

\end{document}
9

Simply set an appropriate value for \setrmarg

\documentclass{memoir}

\setrmarg{3.55em plus 1fil}

\newcommand*{\sometext}{%
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
  vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
  mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
  Donec vehicula augue eu neque.%
}

\begin{document}

\tableofcontents

\chapter{\sometext}

\section{\sometext}

\end{document}

enter image description here

  • 3
    11 seconds.. :) – Alan Munn Jul 8 '13 at 20:31

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.