0

Memoir class has worked very nicely for me so far, but it still has a few quirks that puzzle me. As can be seen in the attached image, the title is placed in one of the two columns for the table of contents (TOC) instead of being centered above both columns. Furthermore, despite the page style being explicitly set for the "bookstart" style, defined very simply as having only the page number at the bottom (in the footer), it persists in adding the TOC title to the header, both right and left, and the page number at the top as well.

It is true that I'm doing some complicated things with the rest of the document (included in the code below), but I shouldn't think these would affect the TOC.

TOC with out-of-place headers and title

Here is most of the code that produced this:

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass[smallroyalvopaper,11pt]{memoir}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%     SET UP PAGE DIMENSIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\stockheight = 9.5in %795pt
\stockwidth = 6.25in %614pt
\headsep = 8pt
\headheight = 18pt
\footskip = 28pt

    \addtolength{\oddsidemargin}{-.875in}
    \addtolength{\evensidemargin}{-.875in}
    \addtolength{\textwidth}{1.75in}
    \addtolength{\topmargin}{-.875in}
    \addtolength{\textheight}{1.75in}

\setlrmarginsandblock{2.0cm}{2.0cm}{*}
\setulmarginsandblock{1.0cm}{1.5cm}{*}
\checkandfixthelayout[fixed]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\setlength{\parskip}{0pt} %MEMOIR CLASS ALREADY DEFINES PARSKIP

\usepackage{xparse}     
\usepackage{microtype}  
\usepackage{lettrine}   
\usepackage{eso-pic}    
\usepackage{multicol}   
\usepackage{fontspec}   
\usepackage[margin=0.8in]{geometry}
\usepackage{marginnote}
\usepackage{newunicodechar}
\newunicodechar{^^^^200b}{^^^^200b\allowbreak}

\setromanfont[Mapping=tex-text]{Saysettha OT}   
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Saysettha OT}
\setmonofont[Scale=MatchLowercase]{Saysettha OT}
\setmainfont{Saysettha OT}[WordSpace={0.6,0.8,0.6}] %Nominal, stretch, shrink

\makeatletter

% plan b make multicol add two rules
\setlength\columnseprule{0.5pt}
\def\LR@column@boxes{%
     \process@cols\mult@gfirstbox{%
       \ifdim\dp\count@>\dimen\tw@
         \global\dimen\tw@\dp\count@ \fi
       \mc@col@status@write
       \box\count@
       \kern3pt %
       {\columnseprulecolor\vrule\@width\columnseprule}%
       \hss
       {\columnseprulecolor\vrule \@width\columnseprule}%
       \kern3pt}%
     \ifdim\dp\mult@rightbox>\dimen\tw@
       \global\dimen\tw@\dp\mult@rightbox \fi
     \mc@lastcol@status@write
     \box\mult@rightbox
}
\LRmulticolcolumns

\makeatother

%\thispagestyle{bookstart}
\makepagestyle{bookstart}% Create bookstart page style
\makeevenfoot{bookstart}% Adjust even footer for bookstart page style
  {}% Left even footer
  {\thepage}% Center even footer
  {}% Right even footer
\makeoddfoot{bookstart}% Adjust odd footer for bookstart page style
  {}% Left odd footer
  {\thepage}% Center odd footer
  {}% Right odd footer
\makefootrule{bookstart}{\textwidth}{.4pt}{\footruleskip}% Footer rule width/thickness/skip for bookstart page style


\copypagestyle{chapter}{plain}% Copy plain page syle to chapter page style
\makeoddhead{chapter}% Adjust odd header for chapter page style
  {\leftmark}% Left odd header
  {\thepage}% Center odd header
  {\rightmark}% Right odd header
\makeevenhead{chapter}% Adjust odd header for chapter page style
  {\leftmark}% Left odd header
  {\thepage}% Center odd header
  {\rightmark}% Right odd header
\makepagestyle{ptkpage}% Create ptkpage page style
\makeevenhead{ptkpage}% Adjust even header for ptkpage page style
  {\rightmark}% Left even header
  {\thepage}% Center even header
  {\leftmark}% Right even header
\makeoddhead{ptkpage}% Adjust odd header for ptkpage page style
  {\rightmark}% Left odd header
  {\thepage}% Center odd header
  {\leftmark}% Right odd header
\makeheadrule{ptkpage}{\textwidth}{.4pt}% Header rule width/thickness for ptkpage page style
%\makefootrule{ptkpage}{\textwidth}{.4pt}{\footruleskip}% Footer rule width/thickness/skip for ptkpage page style

\pagestyle{ptkpage}% Set page style to ptkpage

\usepackage{wrapfig,graphicx,lipsum}    
\setlength{\parindent}{0em}
\renewcommand{\contentsname}{ເນື້ອໃນ}
\raggedbottom


% code to create chapters, verses, and cross references
\ExplSyntaxOn

\int_new:N \crossref_int
\int_new:N \vs_int
\int_new:N \ch_int 
\tl_new:N \crossref_tl
\seq_new:N \l_ptk_my_seq

% insert a cross reference
\NewDocumentCommand {\crossref} {m}
  {
% BEGIN BOOK TITLE MODIFICATION
    \int_compare:nNnT { \ch_int } = { 1 }
        {
        \int_compare:nNnT { \vs_int } = { 1 }
            {
                \sidebar  { \rule[30pt]{0pt}{-0.3\baselineskip} }
            }
        }  
% END BOOK TITLE MODIFICATION

%   \int_compare:nNnT { \crossref_int } > { 25 }    %25 for letters of alphabet
%      {
%        \int_set:Nn \crossref_int { 0 }
%      }
%    \int_incr:N \crossref_int

% ADD Chapter Number to sidebar
    \int_compare:nNnT { \vs_int } = { 1 }
        {
            \sidebar  { \hrule }
            \sidebar  { {\centering ບົດທີ \,\, \int_use:N \ch_int \par} } 
            \sidebar  { \hrule }
            \tl_if_empty:NF \crossref_tl
              {
                \sidebar
                  {
                    (\textbf { 1 }) \, \tl_use:N \crossref_tl
                  }
              }
            \tl_gclear:N \crossref_tl
        }   
    
% PROVIDES SUPERSCRIPTS FOR REFERENCES
%    \textsuperscript{ \emph { \int_to_alph:n { \crossref_int } } }

    \tl_if_empty:NF \crossref_tl
      {
        \tl_gput_right:Nn \emph { \crossref_tl { ~ } }
      }
    \tl_gput_right:Nx \crossref_tl
      {
% PROVIDES SUPERSCRIPTS FOR REFERENCES
%        \exp_not:N \textsuperscript
%          {
%            \exp_not:N \emph { \int_to_alph:n { \crossref_int } }
%          }
        \, #1
      }
    
    \tl_if_empty:NF \crossref_tl
              {
                \sidebar
                  {
                    (\textbf { \int_use:N \vs_int }) \, \tl_use:N \crossref_tl
                  }
              }
            \tl_gclear:N \crossref_tl  
  }

%Sample output
% insert chapter marker
\NewDocumentCommand {\ch} {m}
  {
    \int_gset:Nn \ch_int { #1 }
    \int_gset:Nn \vs_int {1}
    \par\textbf{\huge \int_use:N \ch_int \, }
  }

% output cross references from previous verse and insert verse marker
\NewDocumentCommand {\vs} {m}
  {
    \tl_if_empty:NF \crossref_tl
      {
        \sidebar
          {
            (\textbf { \int_use:N \vs_int }) \, \tl_use:N \crossref_tl
          }
      }
    \int_gset:Nn \vs_int { #1 }
    \tl_gclear:N \crossref_tl
    \par\textbf{#1 \, }
  }

% output any remaining cross references
\AtEndDocument
  {
    \tl_if_empty:NF \crossref_tl
      {
        \sidebar
          {
            \textbf { \int_use:N \vs_int } \, \tl_use:N \crossref_tl
          }
      }
  }

\ExplSyntaxOff


% set up centre column location and size
\setlength\columnsep{2.2cm}     %ORIGINAL: {2.5cm}
\setlength{\sidebarhsep}{\dimexpr -0.5\textwidth - 0.5\columnsep + 2mm}
\setlength{\sidebarwidth}{\dimexpr \columnsep - 4mm}
\sidebarmargin{left}        % ADDED THIS LINE
\renewcommand{\sidebarfont}{\footnotesize\normalfont}
\renewcommand*{\sidebarform}{\raggedright\hangindent 1mm}
\setlength{\sidebarvsep}{0.5ex}
\setsidebarheight{\dimexpr \textheight - 1ex}

\newcommand{\chapterhead}[1]{ % THIS IS A SIMPLIFIED VERSION
   \clearforchapter        % move to correct page
   \thispagestyle{chapter} % set the page style
   \insertchapterspace     % Inserts space into LoF and LoT
   \chapterheadstart       % \beforechapskip space before heading
   \printchaptername\chapternamenum\printchapternum
   \afterchapternum        % \midchapskip space between number and title
   \printchaptertitle{#1}  % title
   \afterchaptertitle}     % \afterchapskip space after title

%\RequirePackage{multicol}
%\renewcommand\cfttocprehook{\begin{multicols}{2}}
%\renewcommand\cfttocposthook{\end{multicols}}


\begin{document}

\frontmatter


%----------------------------------------------------------------------------------------
%   TITLE PAGE
%----------------------------------------------------------------------------------------

\pagestyle{empty}

% TITLE PAGE CONTENTS SNIPPED

\pagestyle{bookstart}
\cleardoublepage

\renewcommand*{\contentsname}{ເນື້ອໃນ}
\twocoltocetc 
\tocheadstart
% \printtoctitle{\contentsname}
% \tocmark
% \thispagestyle{bookstart}
%\aftertoctitle

\thispagestyle{bookstart}
\tableofcontents*   %ASTERISK PREVENTS TOC ENTERING TOC ITSELF

\cleardoublepage

\mainmatter
\pagestyle{ptkpage}


\clearforchapter

{\centering{\Large {\fontsize{26}{26}\selectfont \textbf{ປະຖົມມະການ}}} \par}
\markboth{ປະຖົມມະການ 1}{ປະຖົມມະການ 1}
\addcontentsline{toc}{chapter}{ປະຖົມມະການ}
\begin{multicols}{2}

\thispagestyle{bookstart}
\lettrine[findent=0pt,nindent=0.5em]{\selectfont \textbf{\ch{1}} }{ }\markboth{ປະຖົມມະການ 1}{ປະຖົມມະການ 1}
\crossref{ຢຮ 1:1-2; ຮຣ 1:10; ພສສ 8:3; ອຊຢ 44:24; ກຈກ 17:24; ພນມ 4:11}
\rule[10pt]{0pt}{-0.3\baselineskip}ໃນ \rule[10pt]{0pt}{-0.3\baselineskip}ເລີ່ມຕົ້ນ \rule[10pt]{0pt}{-0.3\baselineskip}ນັ້ນ \rule[10pt]{0pt}{-0.3\baselineskip}ພຣະເຈົ້າ \rule[10pt]{0pt}{-0.3\baselineskip}ຊົງ \rule[10pt]{0pt}{-0.3\baselineskip}ນິລະມິດ \rule[10pt]{0pt}{-0.3\baselineskip}ສ້າງ \rule[10pt]{0pt}{-0.3\baselineskip}ຟ້າສະຫວັນ \rule[10pt]{0pt}{-0.3\baselineskip}ແລະ \rule[10pt]{0pt}{-0.3\baselineskip}ແຜ່ນດິນໂລກ.
\vs{2}
\crossref{ຢມຢ 4:23; ພສສ 33:6; ອຊຢ 40:13-14}
\rule[10pt]{0pt}{-0.3\baselineskip}ແລະ \rule[10pt]{0pt}{-0.3\baselineskip}ແຜ່ນດິນໂລກ \rule[10pt]{0pt}{-0.3\baselineskip}ນັ້ນ \rule[10pt]{0pt}{-0.3\baselineskip}ກໍ \rule[10pt]{0pt}{-0.3\baselineskip}ປາສະຈາກ \rule[10pt]{0pt}{-0.3\baselineskip}ຮູບຮ່າງ \rule[10pt]{0pt}{-0.3\baselineskip}ແລະ \rule[10pt]{0pt}{-0.3\baselineskip}ຫວ່າງເປົ່າ; \rule[10pt]{0pt}{-0.3\baselineskip}ຄວາມມືດ \rule[10pt]{0pt}{-0.3\baselineskip}ຢູ່ \rule[10pt]{0pt}{-0.3\baselineskip}ເທິງ \rule[10pt]{0pt}{-0.3\baselineskip}ໜ້າ \rule[10pt]{0pt}{-0.3\baselineskip}ຄວາມເລິກ \rule[10pt]{0pt}{-0.3\baselineskip}ແລະ \rule[10pt]{0pt}{-0.3\baselineskip}ພຣະວິນຍານ \rule[10pt]{0pt}{-0.3\baselineskip}ຂອງ \rule[10pt]{0pt}{-0.3\baselineskip}ພຣະເຈົ້າ \rule[10pt]{0pt}{-0.3\baselineskip}ເຄື່ອນໄຫວ \rule[10pt]{0pt}{-0.3\baselineskip}ເທິງ \rule[10pt]{0pt}{-0.3\baselineskip}ໜ້ານໍ້າ \rule[10pt]{0pt}{-0.3\baselineskip}ທັງຫຼາຍ.

% TRUNCATED

1 Answer 1

1

Not an answer but, yes, you do seem to be doing some complicated things. Your MWE was truncated so could not be processed. No idea why you were using multicols instead of twocolumn (you can have a vertical rule in the gutter between the two columns, but it sometimes looks odd). The ToC title is set according to the document's chapterstyle.

The following is a sort of minimal MWE showing the default memoir twocolumn ToC.

% memtocprob.tex  SE 600491
\documentclass[smallroyalvopaper,11pt,twocolumn,openany]{memoir}
\usepackage{lipsum}
\setcolsepandrule{1em}{0.4pt}

\setlength{\textheight}{0.5\textheight}
\begin{document}
\frontmatter
\twocoltocetc
\tableofcontents
\mainmatter
\chapter{One}
\lipsum[1-3]
\section{I}
\section{II}
\section{III}
\section{IV}
\section{V}
\chapter{Two}
\section{I}
\section{II}
\section{III}
\section{IV}
\section{V}
\chapter{Three}
\section{I}
\section{II}
\section{III}
\section{IV}
\section{V}
\chapter{Four}
\section{I}
\section{II}
\section{III}
\section{IV}
\section{V}
\chapter{Five}
\section{I}
\section{II}
\section{III}
\section{IV}
\section{V}
\chapter{Six}
\section{I}
\section{II}
\section{III}
\section{IV}
\section{V}
\chapter{Seven}
\section{I}
\section{II}
\section{III}
\section{IV}
\section{V}
\end{document}

enter image description here

I suspect you might have to re-examine your chapterstyle code or make a redefinition of the ToC, etc code.

5
  • For some odd reason, when I used \clearpage instead of \cleardoublepage right before \tableofcontents*, it seemed to clear up the headers problem. But I still ended up with the ToC appearing in the style you show, with "Contents" not centered on the page, but over the left column only. Who would ever really want it like this? Is that the only way that memoir allows? Is there a way to add the ToC to a page where one has already setup the title across the full width, and without adding the title again?
    – Polyhat
    Jun 9, 2021 at 23:39
  • memoir can't do everything everyone wants. I can't run your MWE so I don't know how your combination of multicols and setting chapter titles across the full width works. If you are lucky the memoir maintainer may take up your problem but if it was me I wouldn't given the incomplete information you have provided. Jun 10, 2021 at 18:11
  • My .tex file is in the double digits of megabytes from which the ToC gets generated. It makes no sense to require it in this case when memoir appears only to place the title for the ToC to the left side--exactly as your own MWE demonstrated. Can you center the word "Contents" over the two columns on the ToC page? I have found no way to do so. Even invoking \chapterstyle{culver} prior to \tableofcontents* does not center the title over the whole page--it still sits over the left column. Can this only be fixed by the package maintainer?
    – Polyhat
    Jun 10, 2021 at 20:21
  • I provided a non-"double digits of megabytes" (actually less than 12kb) MWE which showed the problem. We don't need, and will not use a multi-megabytes MWE. You are perfectly at liberty to define your own \tableofcontents code (\renewcommand{\tableofcontents{...}) but do not change any of the memoir code.. Jun 11, 2021 at 17:46
  • Is there a way, such as by using the \renewcommand{\tableofcontents{...}} method, of centering the ToC on the page above the two columns (i.e. before the start of the columns) without altering the memoir code?
    – Polyhat
    Jun 14, 2021 at 2:49

You must log in to answer this question.

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