Page Layoutmemoir | Left Alignment of ToC Title

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
CharlieMAC
Posts: 19
Joined: Wed May 04, 2011 5:50 pm

memoir | Left Alignment of ToC Title

Post by CharlieMAC »

Hello guys!

I'm writing my thesis using the memoir document class and I have a very customized chapter style, which I got from a paper I saw sometime ago.

It turns out this chapter style customization affects the alignment of the title of the ToC and friends. Currently, both ToC and chapter titles are right aligned. So, I'd like to have the chapter titles right aligned and ToC title left aligned. Is that possible?

I provide MWE attached below.

Many thanks
CharlieMAC
Attachments
MWE.pdf
(27.04 KiB) Downloaded 301 times
MWE.tex
(5.78 KiB) Downloaded 292 times
Last edited by CharlieMAC on Wed Dec 21, 2011 5:37 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

CharlieMAC
Posts: 19
Joined: Wed May 04, 2011 5:50 pm

memoir | Left Alignment of ToC Title

Post by CharlieMAC »

I'm thinking that I could also place the chapter box (the red box that cointains the chapter number) to the left and using raggedright I can move the chapter title to the left as well.

The thing is I don't understand the code related to the customized chapter style

Code: Select all

\definecolor{nicered}{rgb}{.647,.129,.149}
\makeatletter
\newlength\dlf@normtxtw
\setlength\dlf@normtxtw{\textwidth}
\def\myhelvetfont{\def\sfdefault{mdput}}
\newsavebox{\feline@chapter}
\newcommand\feline@chapter@marker[1][4cm]{%
\sbox\feline@chapter{%
\resizebox{!}{#1}{\fboxsep=1pt%
\colorbox{nicered}{\color{white}\bfseries\sffamily\thechapter}%
}}%
\rotatebox{90}{%
\resizebox{%
\heightof{\usebox{\feline@chapter}}+\depthof{\usebox{\feline@chapter}}}%
{!}{\scshape\so\@chapapp}}\quad%
\raisebox{\depthof{\usebox{\feline@chapter}}}{\usebox{\feline@chapter}}%
}
\newcommand\feline@chm[1][4cm]{%
\sbox\feline@chapter{\feline@chapter@marker[#1]}%
\makebox[0pt][l]{% aka \rlap
\makebox[0cm][r]{\usebox\feline@chapter}%
}}
\makechapterstyle{daleif1}{
\renewcommand\chapnamefont{\normalfont\Large\scshape\raggedleft\so}
\renewcommand\chaptitlefont{\normalfont\huge\bfseries\scshape\color{nicered}}
\renewcommand\chapternamenum{}
\renewcommand\printchaptername{}
\renewcommand\printchapternum{\null\hfill\feline@chm[2.5cm]\par}
\renewcommand\afterchapternum{\par\vskip\midchapskip}
\renewcommand\printchaptertitle[1]{\chaptitlefont\raggedleft ##1\par}
}
\makeatother
\chapterstyle{daleif1}
Any help will be really apreciated.
Thanks in advance
CharlieMAC
CharlieMAC
Posts: 19
Joined: Wed May 04, 2011 5:50 pm

memoir | Left Alignment of ToC Title

Post by CharlieMAC »

I just found a solution. I defined a new chapter style with the chapter title located in the left (using raggedright) and I called it before calling TOC and friends. It worked perfect. The chapter titles are in the right and TOC and friends are in the left.

I post the code I used:

Code: Select all

\makechapterstyle{daleif12}{
\renewcommand\chapnamefont{\normalfont\Large\scshape\raggedleft\so}
\renewcommand\chaptitlefont{\normalfont\huge\bfseries\scshape\color{nicered}}
\renewcommand\chapternamenum{}
\renewcommand\printchaptername{}
\renewcommand\printchapternum{\null\hfill\feline@chm[2.5cm]\par}
\renewcommand\afterchapternum{\par\vskip\midchapskip}
\renewcommand\printchaptertitle[1]{\chaptitlefont\raggedright ##1\par}
}
Then, just before calling TOC and friends I just changed the chapter style for this new one and then reverted the style back by using:

Code: Select all

\chapterstyle{daleif12}

\tableofcontents
\chapterstyle{daleif1}
Post Reply