Document ClassesMemoir, remove TOC from TOC

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
3stack
Posts: 3
Joined: Tue Mar 22, 2011 1:23 am

Memoir, remove TOC from TOC

Post by 3stack »

I'm new to LyX, and therefore new to Latex, and I'm using LyX with the memoir class for my thesis. My current problem, well for the past few days now, is that I can't seem to remove "Contents" from being listed in the TOC. Here is what I hope to be a MWE of where I am:

Code: Select all

%% LyX 1.6.8 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[oneside,english,oldfontcommands]{memoir}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
% Roman Page Numbering
\pagenumbering{roman}
\let\myTOC\tableofcontents
\renewcommand\tableofcontents{%
\myTOC
\clearpage
\pagenumbering{arabic}
}

% Remove Page Numbers from Top
\makeevenfoot{headings}{}{\thepage}{} 
\makeoddfoot{headings}{}{\thepage}{} 
\makeevenhead{headings}{}{}{} 
\makeoddhead{headings}{}{}{}

\makeatother

\usepackage{babel}

\begin{document}

\title{Blah}


\author{Blah}


\date{Blah}

\maketitle
\pagebreak{}


\section{Abstract}

\pagebreak{}

\tableofcontents{}\pagebreak{}


\section{Introduction}

Blah Bhah
\end{document}
My school requires that I relabel "Contents" as "Table of..." and center it on the page. I can't have the TOC list itself. Here is my last attempt to fix the problem by adding to my preamble:

Code: Select all

%Please remove TOC from TOC
\DisemulatePackage{tocbibind}
\let\bibsection\relax 
\usepackage[nottoc]{tocbibind}
%\PassOptionsToPackage[nottoc]{tocbibind}
The code above started with just the \usepackage [nottoc]{tocbibind} which caused LyX to tell me that the package had already been defined with "[]" no options. Then I added the \PassOptionsToPackage line which caused an error saying something about missing \begin{Document}. Then, after reading that memoir already loads tocbibind, I found the \Disemulate line, added the \usepackage afterward, and got an error about command \bibsection already defined. Then I added the \let\bibsection\relax line I found somewhere else. Which got rid of the error but the TOC is still in the TOC! I tried "\tableofcontents*" before all of this, which simply put a * on the next page. A couple of days ago, I think I was able to change "Contents" to "Table of Contents" fairly easily, but the change got lost. I would be extremely grateful if anyone could help me with this. Sorry in advance if this message is posted inappropriately, let me know if I'm not explaining, asking my question, or giving an MWE correctly and I'll adjust it accordingly.
Last edited by 3stack on Tue Mar 22, 2011 5:18 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

Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Memoir, remove TOC from TOC

Post by Stefan Kottwitz »

Hi,

you could try the memoir feature \KeepFromToc:

Code: Select all

\begin{KeepFromToc}
  \tableofcontents
\end{KeepFromToc}
Stefan
LaTeX.org admin
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Memoir, remove TOC from TOC

Post by localghost »

A solution is already present in the forum [1]. No idea how to insert that in LyX.

[1] View topic: "Contents line" in ToC. Memoir


Best regards and welcome to the board
Thorsten
3stack
Posts: 3
Joined: Tue Mar 22, 2011 1:23 am

Memoir, remove TOC from TOC

Post by 3stack »

Stefan_K wrote:Hi,

you could try the memoir feature \KeepFromToc:

Code: Select all

\begin{KeepFromToc}
  \tableofcontents
\end{KeepFromToc}
Stefan
Thank you very much Stefan. I actually tried this in my actual thesis document before and had it commented out with % symbols because it didn't work. I think I may have still had another \tableofcontents somewhere else and when combined it wasn't working. Worked perfectly this time, thanks again for the quick response.
3stack
Posts: 3
Joined: Tue Mar 22, 2011 1:23 am

Memoir, remove TOC from TOC

Post by 3stack »

localghost wrote:A solution is already present in the forum [1]. No idea how to insert that in LyX.

[1] View topic: "Contents line" in ToC. Memoir


Best regards and welcome to the board
Thorsten
Thorsten,

I know that I tried using \tableofcontents* before, but not with the \blinddocument afterward. Stefan's suggestion worked for me. In either case though, for anyone who needs to know, inserting code into your LyX document is done by clicking on the "TeX" box in the toolbar above your main window. This will give you a red box where ever your cursor was on the document and you can insert your ERT (Evil Red Text) in the location that makes sense on the document. To verify that it's in the correct place, you can go click VIEW-->VIEW SOURCE in the top menu and your documents current code will appear in a window at the bottom. On the right of that window, there is a box to check for "complete source" that once checked will allow you to view the source code for your entire document in LyX. Thanks again for the quick replies guys.

Wade
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Memoir, remove TOC from TOC

Post by localghost »

3stack wrote:[…] I know that I tried using \tableofcontents* before, but not with the \blinddocument afterward. […]
The command works independently of how the document is created.
Post Reply