0

so I'm using the memoir documentclass and I'm facing some problems:

I'm getting wrong margins and line spacing (not the desired output) although I set them in the preamble as following:

\usepackage[left=35mm, right=25mm, top=25mm,bottom=25mm,textwidth=209.9mm,textheight=296.7mm]{geometry}

% line spacing of 1.5
\renewcommand{\baselinestretch}{1.241}

I get the header visible in the abstract section and when trying to remove it, the headers in all other pages disappear. I tried \thispagestyle{empty} but it keeps removing it from all pages

Another thing I want is to start page numbering from the table of contents. I tried this but nothing had changed:

\clearpage
\pagenumbering{arabic}

Can you please help me solve this problems. This is my first time using LaTeX and I couldn't find time to practice well.

Here is a bit of code:

\documentclass[12pt,a4paper,oneside]{memoir} % for a long document

\usepackage[document]{ragged2e}
\usepackage[utf8]{inputenc} % set input encoding to utf8
\usepackage[left=35mm, right=25mm, top=25mm, bottom=25mm,textwidth=209.9mm,textheight=296.7mm]{geometry}
\usepackage{biblatex}
\usepackage{tabu}
\usepackage{colortbl}
\usepackage{longtable}
\usepackage{enumitem}
\usepackage{lipsum}
\usepackage{hyperref}
\usepackage{graphicx} % support the \includegraphics command and options
\usepackage{subfig} % make it possible to include more than one captioned figure/table in a single float
\usepackage{fancyhdr} % This should be set AFTER setting up the page geometry
\usepackage{setspace}
\hypersetup{linktocpage}
\setlength{\parskip}{2em}
\setlength{\parindent}{0em}
\renewcommand{\baselinestretch}{1.241}
\pagestyle{fancy}
\setlength{\trimedge}{\stockwidth}
\addtolength{\trimedge}{-\paperwidth}
\settypeblocksize{*}{\lxvchars}{1.618} % we want to the text block to have golden proportionals
\setulmargins{25mm}{*}{*} % 50pt upper margins
\setlrmargins{*}{*}{1.618} % golden ratio again for left/right margins
\setheaderspaces{*}{*}{1.618}
\checkandfixthelayout 
\pretitle{\begin{center}\sffamily\huge\MakeUppercase}
\posttitle{\par\end{center}\vskip 0.5em}
%%% ToC (table of contents) APPEARANCE
\maxtocdepth{subsection} % include subsections
\renewcommand{\cftchapterpagefont}{}
\renewcommand{\cftchapterfont}{}     % no bold!

%%% HEADERS & FOOTERS
\pagestyle{companion} % try also: empty , plain , headings , ruled , Ruled , companion

%%% CHAPTERS
\chapterstyle{companion} % try also: default , section , hangnum , companion , article, demo

\renewcommand{\chaptitlefont}{\Huge\sffamily\raggedright} % set sans serif chapter title font
\renewcommand{\chapnumfont}{\Huge\sffamily\raggedright} % set sans serif chapter number font

%%% SECTIONS
%\hangsecnum % hang the section numbers into the margin to match \chapterstyle{hangnum}
\maxsecnumdepth{subsection} % number subsections
\setsecheadstyle{\Large\sffamily\raggedright} % set sans serif section font
\setsubsecheadstyle{\large\sffamily\raggedright} % set sans serif subsection font
\setsubsubsecheadstyle{\normalsize\sffamily\raggedright\textbf} % set sans serif subsubsection font
%% END Memoir customization

\title{title}
\author{author}
%\date{} % Delete this line to display the current date

%%% BEGIN DOCUMENT

\begin{document}
\maketitle
%\thispagestyle{empty}

\justifying
%\pagestyle{empty}
\section*{abstract}
\lipsum{3}
\section*{résumé}
\lipsum{3}
\newpage

\clearpage
\pagenumbering{arabic}
\tableofcontents* % the asterisk means that the contents itself isn't put into the ToC
\chapter{C1} Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris.

\section{s1}
\subsection{ss1}
\subsubsection{sss1} Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris.
\subsubsection{sss2} Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris.
\subsubsection{sss3} Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris.

\subsection{ss2}
\subsubsection{sss1} Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris.
\subsubsection{sss2} Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris.
\section{s2}

\chapter{c2}
\end{document}
6
  • 2
    As always on this site please provide a full but minimal example that others can copy and test. Note that memoir has its own build in system for setting both the margins and line spacings, though geometry should work with it as well. But as long as you don't provide a full example we have no idea what exactly you are referring to
    – daleif
    Commented Mar 23, 2022 at 10:17
  • 2
    You should no be using fancyhdr and pages style fancy with memoir it has it own much more integrated system. Also do use geometry and memoirs setup. Don't use tabu it is unmaintanied and have several issues.
    – daleif
    Commented Mar 23, 2022 at 10:50
  • 1
    hyperref should be the last package loaded (with a few exceptions)
    – daleif
    Commented Mar 23, 2022 at 10:52
  • 1
    For the abstract you'll need to use the \pagestyle{empty}` and reissue \pagestyle{companion} when it should go back to normal
    – daleif
    Commented Mar 23, 2022 at 10:54
  • 1
    Since \maketitle issues \thispagestyle{title} you might want to alias it to empty via \aliaspagestyle{title}{empty}
    – daleif
    Commented Mar 23, 2022 at 10:56

1 Answer 1

1

Here is an adjusted version of the MWE. I've removed irrelevant packages

\documentclass[12pt,a4paper,oneside]{memoir} % for a long document
\usepackage[T1]{fontenc}
%\usepackage[document]{ragged2e} # then \justifying is not needed
\usepackage[utf8]{inputenc} % set input encoding to utf8
\usepackage{lipsum}
\usepackage{hyperref}
\hypersetup{linktocpage}
\setlength{\parskip}{2em}
\setlength{\parindent}{0em}
\renewcommand{\baselinestretch}{1.241}
\setlength{\trimedge}{\stockwidth}
\addtolength{\trimedge}{-\paperwidth}
\settypeblocksize{*}{\lxvchars}{1.618} % we want to the text block to have golden proportionals
\setulmargins{25mm}{*}{*} % 50pt upper margins
\setlrmargins{*}{*}{1.618} % golden ratio again for left/right margins
\setheaderspaces{*}{*}{1.618}
\checkandfixthelayout 
\pretitle{\begin{center}\sffamily\huge\MakeUppercase}
\posttitle{\par\end{center}\vskip 0.5em}
%%% ToC (table of contents) APPEARANCE
\maxtocdepth{subsection} % include subsections
\renewcommand{\cftchapterpagefont}{}
\renewcommand{\cftchapterfont}{}     % no bold!

%%% HEADERS & FOOTERS
\pagestyle{companion} % try also: empty , plain , headings , ruled , Ruled , companion

%%% CHAPTERS
\chapterstyle{companion} % try also: default , section , hangnum , companion , article, demo
\renewcommand{\chaptitlefont}{\normalfont\Huge\sffamily\raggedright} % set sans serif chapter title font
\renewcommand{\chapnumfont}{\normalfont\Huge\sffamily\raggedright} % set sans serif chapter number font


%%% SECTIONS
%\hangsecnum % hang the section numbers into the margin to match \chapterstyle{hangnum}
\maxsecnumdepth{subsection} % number subsections
\setsecheadstyle{\Large\sffamily\raggedright} % set sans serif section font
\setsubsecheadstyle{\large\sffamily\raggedright} % set sans serif subsection font
\setsubsubsecheadstyle{\normalsize\sffamily\raggedright\bfseries} % set sans serif subsubsection font
%% END Memoir customization

% no page number on page with \maketitle
\aliaspagestyle{title}{empty}


\title{title}
\author{author}

%%% BEGIN DOCUMENT

\begin{document}

% cheating hyperref, then it doesn't warn about preexisting targets
% due to the "blank" pages

\pagenumbering{Alph}

\maketitle


\pagestyle{empty}
\section*{abstract}
\lipsum{3}
\section*{résumé}
\lipsum{3}

\clearpage

\pagestyle{companion}

\pagenumbering{arabic}

\tableofcontents* % the asterisk means that the contents itself isn't put into the ToC

\chapter{C1} Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris.

\section{s1}
\subsection{ss1}
\subsubsection{sss1} Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris.
\subsubsection{sss2} Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris.
\subsubsection{sss3} Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris.

\subsection{ss2}
\subsubsection{sss1} Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris.
\subsubsection{sss2} Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris.
\section{s2}

\chapter{c2}
\end{document}
4
  • That works now! Last question that I forgot to mention in the post: What is the best package to use to set the font family to Times New Roman?
    – redone_lsf
    Commented Mar 23, 2022 at 12:01
  • Don't use Time New Roman. See for example, tug.org/FontCatalogue/texgyretermes (Nimbus is a Times clone). Otherwise you'll probably need to move to lualatex and through it use Time New Roman if it is on you PC.
    – daleif
    Commented Mar 23, 2022 at 12:04
  • 1
    BTW: remember to accept the question if it solved your problem.
    – daleif
    Commented Mar 23, 2022 at 12:05
  • 1
    Answer accepted!
    – redone_lsf
    Commented Mar 23, 2022 at 15:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .