3

I'm having difficulty removing the contents heading from my Latex document, possibly because I'm using a title page.

I've tried the standard ways I found online such as:

Option 1

\tableofcontents*

Option 2

\makeatletter
\renewcommand\tableofcontents{%\@starttoc{toc}%}
\makeatother

Option 3

  \makeatletter
  \@starttoc{toc}
  \makeatother

Option 4

\begin{KeepFromToc}
  \tableofcontents
\end{KeepFromToc}    

The code I'm using is here:

\documentclass{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage[margin=0.9in]{geometry}
\renewcommand*\familydefault{\sfdefault} 
\usepackage{titling}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathmorphing}

\usepackage{titlesec}
\titleformat{\section}[frame]
{\normalfont} {} {5pt} {\Large\bfseries\thesection.\quad}

\begin{document}

\begin{titlepage}
  \begin{tikzpicture}[overlay,remember picture]
    \draw [line width=0.5mm,decorate]
    ($ (current page.north west) + (0.5cm,-0.5cm) $)
    rectangle
    ($ (current page.south east) + (-0.5cm,0.5cm) $);
  \end{tikzpicture}

  \centering
  \vfill
  {\huge Title} 
  \vfill
  \tableofcontents     
  \vfill
   \end{titlepage} 
\end{document}

Does anybody have any ideas?

Thanks,

Chris.

2
  • Welcome to TeX.SX! Please use CTRL-K to mark up your code, not block quotes.
    – user31729
    Commented Dec 23, 2015 at 10:16
  • \tableofcontents* does not work for article, that's available for memoir (only, as far I know)
    – user31729
    Commented Dec 23, 2015 at 10:17

1 Answer 1

2

This worked for me:

\documentclass{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage[margin=0.9in]{geometry}
\renewcommand*\familydefault{\sfdefault} 
\usepackage{titling}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathmorphing}


\makeatletter
\renewcommand{\tableofcontents}{%
  \@starttoc{toc}%
}
\makeatother

\usepackage{titlesec}
\titleformat{\section}[frame]
{\normalfont} {} {5pt} {\Large\bfseries\thesection.\quad}


\begin{document}

\begin{titlepage}
  \begin{tikzpicture}[overlay,remember picture]
    \draw [line width=0.5mm,decorate]
    ($ (current page.north west) + (0.5cm,-0.5cm) $)
    rectangle
    ($ (current page.south east) + (-0.5cm,0.5cm) $);
  \end{tikzpicture}

  \centering
  \vfill
  {\huge Title} 
  \vfill
  \tableofcontents     
  \vfill
   \end{titlepage} 
\section{Some content}
\end{document}
3
  • Okay, so that worked on my test document, but when I move to the real document it is failing to compile. Differences are I have a header and footer, boxes drawn around all headings and title page. Ending up with the error (which doesn't appear to help too much): ./main.toc:2: LaTeX Error: Something's wrong--perhaps a missing \item. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.2 ...tsline {section}{\numberline {1}Purpose}{1} Commented Dec 30, 2015 at 12:22
  • @ChrisCorbett: What do you expect me to do now? I don't have your 'document' at hand.
    – user31729
    Commented Dec 30, 2015 at 14:47
  • Apologies, I was wondering if it was a common error, I think I managed to figure out the issue now anyway through a process of elimination. Turns out it was due to the image on the title page. Thank you very much for your help. Commented Jan 1, 2016 at 13:34

You must log in to answer this question.

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