0

I'm having problems compiling a file that I can't make sense of. So far, I think the problem has to do with changing the headers using \renewcommand{\chaptermark} and \renewcommand{\sectionmark}. When I comment out those lines (lines 35-38), the file compiles correctly.

Moreover, if I only include only enough text to cover two pages, there's no problem. But if the text covers 3 pages (and then I assume the \renewcommand{\sectionmark} applies, as the subsection mark in the header would appear in the 3rd page), the file crashes.

I include the code below. It doesn't compile as it is, but it does if you either comment out lines 35-38 or the last paragraph (line 89).

Edit: commenting out the titlesec section because of potential problems with memoir class doesn't seem to solve the issue.

\documentclass[12pt, a4paper, extrafontsizes]{memoir}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}

\usepackage{graphicx, xcolor}
\definecolor{light-gray}{gray}{0.7}

\usepackage[colorlinks = TRUE,%
  citecolor = magenta,%
  linkcolor = cyan,%
  linktocpage = TRUE]{hyperref}

\renewcommand*\rmdefault{ppl}

\setsecnumdepth{subsection}
\settocdepth{subsection}

\usepackage[natbibapa]{apacite}
\renewcommand{\bibliographytypesize}{\small}
\setlength{\bibsep}{5pt}

\OnehalfSpacing

\clubpenalty=10000
\widowpenalty=10000
\raggedbottom

\usepackage{titlesec}
  \titleformat{\chapter}[display]{\large\bfseries}
    {\color{light-gray}{\HUGE \thechapter}}{0pt}{\Large}
  \titleformat*{\section}{\normalsize\bfseries}
  \titleformat*{\subsection}{\normalsize\itseries}

\renewcommand{\chaptermark}[1]{\markboth{%
  \textnormal{\small{\color{light-gray}{#1}{}}}}}
\renewcommand{\sectionmark}[1]{\markright{%
  \textnormal{\small{\color{light-gray}{#1}{}}}}}

% https://github.com/katyhuff/dissertation/blob/master/report/frontmatter/frontmatter.tex
\renewcommand{\printtoctitle}[1]{\chapter*{#1}}
\renewcommand{\printloftitle}[1]{\chapter*{#1}}
\renewcommand{\printlottitle}[1]{\chapter*{#1}}

\renewcommand{\tocmark}{}
\renewcommand{\lofmark}{}
\renewcommand{\lotmark}{}

\renewcommand{\tocheadstart}{}
\renewcommand{\lofheadstart}{}
\renewcommand{\lotheadstart}{}

\renewcommand{\aftertoctitle}{}
\renewcommand{\afterloftitle}{}
\renewcommand{\afterlottitle}{}

\title{TITLE}
\author{AUTHOR}
\date{\today}

\begin{document}

% ========================================================================

\frontmatter

\maketitle

\newpage
\tableofcontents*

% ========================================================================
\mainmatter

\chapter{Introduction}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec maximus, dui sit amet mollis dapibus, elit dui mattis metus, id ornare sapien tellus finibus ipsum. Quisque convallis lorem eget venenatis sollicitudin. Nam sit amet egestas nisi. Suspendisse quis mauris nulla. Cras ex turpis, facilisis vitae nibh ut, bibendum ultrices lacus. Cras dignissim in enim semper egestas. Donec tempor nisi neque. Aliquam sodales sit amet urna nec ornare. Fusce a lorem at ligula tincidunt hendrerit id laoreet dui. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla ullamcorper varius congue. Fusce tellus nunc, fringilla quis risus ac, volutpat varius leo. Phasellus ut maximus mi. Pellentesque tincidunt non sapien sit amet consectetur.

Suspendisse in pellentesque purus. Nulla sed lacinia orci. Nulla luctus magna ut dui placerat, sed pellentesque diam fringilla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Vivamus mollis auctor turpis quis mollis. Etiam consequat velit id feugiat sollicitudin. Praesent non mauris non magna interdum volutpat ac at enim. In id ex eget dui auctor porta in sed lorem.

Proin iaculis vulputate nunc, ac fermentum est blandit ac. In pulvinar, ante a consequat aliquet, arcu ex congue risus, sit amet consequat sem urna at tellus. Sed consequat elit nec eleifend accumsan. Nunc porttitor ligula sed libero tristique malesuada. Vivamus ac semper ante, ac faucibus augue. Mauris molestie malesuada cursus. Nunc malesuada justo sit amet vehicula lobortis.

Donec vulputate metus sit amet justo malesuada, in luctus justo sodales. Aenean vitae commodo nisl. Sed faucibus consectetur velit a egestas. Maecenas maximus nunc tincidunt lacus fringilla, ut euismod tellus facilisis. Vivamus sed sapien purus. Pellentesque turpis leo, sagittis vitae ultrices vitae, sagittis eu arcu. Nunc rutrum diam sodales mi congue, in ultrices odio ultrices. Vivamus non leo ut velit aliquet fermentum. Suspendisse tincidunt vehicula orci quis pulvinar. Aliquam at ultricies urna. Nulla scelerisque ipsum nibh, suscipit tincidunt neque posuere in. Aenean ex dolor, aliquam vel auctor non, rhoncus sit amet sem. Nulla gravida blandit mauris, non eleifend ante fringilla id. Nulla facilisi. Cras molestie nisl eu odio congue bibendum. Fusce eleifend dui magna, id ultricies tellus maximus sed.

Nullam lorem nibh, maximus fermentum viverra eu, tincidunt vel enim. Aenean et ligula nec sem mollis pretium. Nulla sed nisi vel erat gravida aliquam. Phasellus volutpat consequat felis sed interdum. Aliquam eu arcu et quam blandit sagittis ac quis felis. In consequat ipsum eget lacus luctus aliquam. Curabitur ac rhoncus leo. Ut at malesuada felis. Nulla facilisi. Mauris libero ante, consequat nec lobortis a, porta in tortor. Vestibulum eleifend sit amet magna et lobortis. Nunc quis porttitor mi, sit amet pulvinar lorem. Donec nisl enim, pharetra ut dolor commodo, feugiat varius mi. Nunc id volutpat enim. Donec quis egestas erat, tempus blandit est.

Cras vel luctus velit. Curabitur venenatis at sapien a tempus. Donec nec maximus mauris. Aenean eu tristique mi. Vestibulum a efficitur eros. Etiam a odio eget enim maximus scelerisque. Suspendisse diam ante, efficitur vel velit vel, tincidunt scelerisque felis.

Donec eu sollicitudin lectus. Nam ultricies diam suscipit porttitor placerat. Duis non scelerisque ligula, sit amet posuere elit. Nulla pharetra sapien vitae aliquet porttitor. Maecenas non dapibus ligula. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec congue nisi ut dolor egestas laoreet. Sed diam velit, pulvinar at nibh ut, sodales tempus libero. Duis mattis magna odio, a lobortis purus tincidunt sed. Maecenas tincidunt bibendum urna vitae pharetra. Sed a vulputate tellus. Sed non metus vitae metus tincidunt suscipit at eu nibh. Curabitur quis finibus velit, vel eleifend ligula. Pellentesque id ipsum vitae tellus maximus ornare.


% ========================================================================
\backmatter

\end{document}
4
  • titlesec has its own ways to set the marks, you shouldn't redefine \chaptermark etc when using it. Feb 1, 2019 at 13:21
  • 1
    Note that titlesec doesn't go along with memoir.
    – egreg
    Feb 1, 2019 at 13:23
  • I'd seen that, but still, that doesn't seem to be the problem. If I comment out the titlesec lines, the file doesn't compile either. Feb 1, 2019 at 13:44
  • You should remember to remove all the titlesec lines. Note that the formatting of the headers for not belong in, say, \chaptermark, it should be added to the page styles being used. besides, you do realise that \markboth takes two arguments? You are only giving it one.
    – daleif
    Feb 1, 2019 at 14:06

1 Answer 1

2

Remember that \markboth takes two arguments not one (\markright takes only one).

That is the complilation issue here.

Besides this, the formatting of the headers rally belong in the headers not inside the marks. See for example http://tug.org/pracjourn/2008-2/madsen/

3
  • Just in case someone has the same problem, I just subtitute the chapter mark lines for: \renewcommand{\chaptermark}[1]{\markboth{% \textnormal{\small{\color{light-gray}{#1}{}}}}{% \textnormal{\small{\color{light-gray}{#1}{}}}}} Leaving all the rest the same. It seems that titlesec does not cause any problems so far. Feb 7, 2019 at 9:25
  • 1
    @FranVillamil I still stand by my comment, formatting does not belong in the chapter mark, only data. The formatting belong in the definition of the headers and footers. Then you also don't have to add size, color etc to every single mark macro.
    – daleif
    Feb 7, 2019 at 9:29
  • Yes, I see, I didn't mean you weren't right, just that it seemed to work that way. I'll take a look at the example you posted to do it right though. Feb 8, 2019 at 10:27

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.