8

Goals: I would like to have the title, author, date, and the table of content on the same page. I also want the capability of being able to have a footnote to the author.

What I have done so far: I came up with the following hack. It works except for the footnote. (This is my first ever hack and therefore, it is probably pretty amateurish, may be something I should not be doing in the first place.)

I am open to any other method as long as I can achieve the stated goals with hyperref working. (It would be also nice if I can have control over the fonts used.)

\documentclass[12pt]{report}
\usepackage{lipsum}
\usepackage[T1]{fontenc}
\usepackage[ocgcolorlinks, hypertexnames]{hyperref}


\makeatletter
\renewcommand{\tableofcontents}[1]{%
\begin{center}%
    \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
    \let \footnote \thanks
    {\huge\bfseries \@title \par}%
    \vskip 2em%
    {\large
     \lineskip .75em%
      \begin{tabular}[t]{c}%
        {\bfseries \@author}
      \end{tabular}\par}%
      \vskip 1em%
    {\large \@date \par}%     
  \section*{\center{#1}}
  \end{center}\par
    \@starttoc{toc}%
      }
\makeatother

\renewcommand{\thechapter}{}
\renewcommand{\chaptername}{}

\title{This is a test}
\author{John Doe\footnote{where is the foot note?}}

\begin{document}
\tableofcontents{Table of Contents}
\chapter{Preface}
 \lipsum[1]
\chapter{First Thing}
  \lipsum[2]
  \chapter{Second Thing}
  \lipsum[3]
   \chapter{Third Thing}
  \lipsum[4]
\end{document}

The first page of the output is given below. enter image description here

lockstep
  • 250,273
Sony
  • 3,920

5 Answers5

7

This is very common; that a \foonote is swallowed. A similar situation happens when using \footnote within a table. One way around this is to typeset a \footnotemark inside \author, and then typeset a \footnotetext outside. Here's a little hack to do this:

![enter image description here][1]

\documentclass[12pt]{report}
\usepackage{lipsum}
\usepackage[T1]{fontenc}
\usepackage[ocgcolorlinks, hypertexnames]{hyperref}

\makeatletter \renewcommand{\tableofcontents}[1]{% \begin{center}% \renewcommand\thefootnote{@fnsymbol\c@footnote}% \let \footnote \thanks {\huge\bfseries @title \par}% \vskip 2em% {\large \lineskip .75em% \begin{tabular}[t]{c}% {\bfseries @author} \end{tabular}\par}% \vskip 1em% {\large @date \par}%
\section*{\center{#1}} \end{center}\par @starttoc{toc}% } \makeatother

\renewcommand{\thechapter}{} \renewcommand{\chaptername}{}

\title{This is a test} \author{John Doe\footnotemark}

\begin{document} \tableofcontents{Table of Contents} \makeatletter {\renewcommand{\thefootnote}{}% Print for counter value \footnotetext{where is the foot note?}} \makeatother \chapter{Preface} \lipsum[1] \chapter{First Thing} \lipsum[2] \chapter{Second Thing} \lipsum[3] \chapter{Third Thing} \lipsum[4] \end{document}​

In order to maintain consistency in footnote referencing (and since I'm not sure how extensive you want to use the footnote symbol numbering), I've temporarily renewed how the footnote counter is displayed:

{\renewcommand{\thefootnote}{*}% Print * for counter value
\footnotetext{where is the foot note?}}

The temporary change just affects the display of the counter within the group. [1]: https://i.stack.imgur.com/W1cfL.png

David Carlisle
  • 757,742
Werner
  • 603,163
  • Ok, your answer was 42 (!) seconds faster! (And it does not need footmisc). +1 for that. – Stephen Jan 04 '12 at 20:38
  • @Stephen: Yours is perhaps more general. However, as mentioned in my answer, I'm not sure how extensive the OP's use of \footnote would be within \author. Mine would be just a quick-fix for this situation. – Werner Jan 04 '12 at 20:40
  • @Werner: Thank you very much. It will take me some time to analyze all the wonderful solutions. – Sony Jan 05 '12 at 01:44
  • @Werner: Thanks for the link. After reading it and reading Lamport's 6th chapter, I think I know what is happening. Why do you need /makeatletter and \makeatother wrapping of the \renewcommand{\thefootnote}? – Sony Jan 05 '12 at 16:04
  • @Sony: For one, if you don't use \makeatletter, you will be greeted with a bunch of errors! The reason is that @ is a reserved symbol and should be treated "with care", which \makeatletter does. \makeatother reverts this action to its regular form. See What do \makeatletter and \makeatother do? – Werner Jan 05 '12 at 16:50
  • @werner: I compiled your code successfully without the wrapping. Are you talking about error messages in log file? – Sony Jan 05 '12 at 17:03
  • @Sony: You should have received some error messages in your .log file, yes. It could be that your compiler is set to ignore (or adapt to) those kind of messages through a command-line option. I'm not very familiar with that, since I try to avoid errors/warnings. :) – Werner Jan 05 '12 at 17:46
3
\usepackage[symbol]{footmisc}

(http://ctan.org/pkg/footmisc) for the symbol (before hyperref!) and then just use \footnotemark where you want the footnotemark and \footnotetext{...} after the TOC:

\author{John Doe\footnotemark}

\begin{document}
\tableofcontents{Table of Contents}
\footnotetext{Here is the foot note!}

Edit: without footmisc package and applying little change to your code:

\documentclass[12pt]{report}
\usepackage{lipsum}
\usepackage[T1]{fontenc}
\usepackage[ocgcolorlinks, hypertexnames]{hyperref}

\makeatletter
\renewcommand{\tableofcontents}[1]{%
\begin{center}%
%    \renewcommand\thefootnote{\@fnsymbol\c@footnote}% DELETED
    \let \footnote \thanks
    {\huge\bfseries \@title \par}%
    \vskip 2em%
    {\large
     \lineskip .75em%
      \begin{tabular}[t]{c}%
        {\bfseries \@author}
      \end{tabular}\par}%
      \vskip 1em%
    {\large \@date \par}%     
  \section*{\center{#1}}
  \end{center}\par
    \@starttoc{toc}%
      }
\makeatother

\renewcommand{\thechapter}{}
\renewcommand{\chaptername}{}

\title{This is a test}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}% INSERTED    
\author{John Doe\footnotemark}% INSTEAD OF \footnotetext{...}

\begin{document}

\tableofcontents{Table of Contents}
\footnotetext{Here is the foot note!}% INSERTED
\renewcommand{\thefootnote}{\arabic{footnote}}% INSERTED
% \chapter{...} resets the footnote number to one
\chapter{Preface}
 \lipsum[1]
 This is a test.\footnote{This is a footnote.}
\chapter{First Thing}
  \lipsum[2]
  \chapter{Second Thing}
  \lipsum[3]
   \chapter{Third Thing}
  \lipsum[4]
\end{document}
Stephen
  • 14,890
  • Does this affect all footnotes within the remainder of the document as well? – Werner Jan 04 '12 at 20:40
  • Yes, which is well when wished by the OP but bad otherwise. – Stephen Jan 04 '12 at 20:44
  • @Stephen: Thank you. I will have to wait till tomorrow to analyze your suggestion. I do not mind experimenting. So, you are good. – Sony Jan 05 '12 at 01:51
  • @Stephen: I read the `footmisc' manual and it says that "This option resets footnote numbering for each page of the document." So, I checked by adding few statements with footnotes to subsequent chapters. The results are not good for the project I am working in, as I need numbered footnotes in the chapters. But it is always nice to learn something new. – Sony Jan 05 '12 at 16:18
  • OK, I added a solution without footmisc. That solution will use a star for the first footnote only and normal (Arabic numbers) afterwards. I tried to change only little of your code. – Stephen Jan 05 '12 at 18:56
1

Do you need report?

If you could switch to article you could do it with 'standard'. But you must change chapter to section, section to subsection...

\documentclass[12pt]{article}
\usepackage{lipsum}

%some additional requested format changes
\usepackage{sectsty}
\setcounter{secnumdepth}{0}
\sectionfont{\huge\bfseries}

\title{This is a test}
\author{John Doe\footnote{where is the foot note?}}

\begin{document}
\maketitle
\tableofcontents
\clearpage

\section{Preface}
 \lipsum[1]
\section{First Thing}
  \lipsum[2]
  \section{Second Thing}
  \lipsum[3]
  \section{Third Thing}
  \lipsum[4]

\end{document}
knut
  • 8,838
  • I also want to use the hyperref package. I mentioned this at the end of my question. (Don't take the +1 off for not including this among the goals.:) I will check and see if your code works with hyperref. If so, then this is pretty clean. – Sony Jan 05 '12 at 01:48
  • @Sony There should be no problem with hyperref. – knut Jan 05 '12 at 09:19
  • After changing \title command to \title{\huge\bfseries This is a test}, after centering the TOC Contents, after adding \pagebreaks between sections, and after adding \renewcommand{\thesection}{} I got the desired output except for one thing. I do not see how to left align titles of sections without a hack. (That does not mean it cannot be done without a hack, but I do not know how to do it.) I really wanted to accept this answer.:) – Sony Jan 05 '12 at 16:42
  • 1
    Instead \renewcommand{\thesection}{} you should \setcounter{secnumdepth}{0}. But I think scrartcl may be another solution - give me some time, I will check. – knut Jan 05 '12 at 19:16
  • I made a test with class scrartcl. It solve some things (e.g. the title), but the font change and there are some more chnages. I think, it would be to much to adapt. – knut Jan 05 '12 at 19:28
  • Thanks. \setcounter{secnumdepth}{0} fixed the left alignment problem. If you use the \secsty package and add \sectionfont{\huge\bfseries}after the tableofcontents then we have a solution without a hack. If you fix your answer accordingly, I will accept your answer. (I do not think Werner would mind.) – Sony Jan 05 '12 at 23:07
  • I added sectsty and the change of sectionfont. – knut Jan 06 '12 at 19:13
1

Would it be ok for you to change \maketitle and not \tableofcontents? Or better, define a new \maketitleWithToc

\documentclass[12pt]{report}
\usepackage{lipsum}
\usepackage[T1]{fontenc}
\usepackage[ocgcolorlinks, hypertexnames]{hyperref}


\makeatletter
  \newcommand\maketitleWithToc{\begin{titlepage}%
  \let\footnotesize\small
  \let\footnoterule\relax
  \let \footnote \thanks
  \null\vfil
  \vskip 60\p@
  \begin{center}%
    {\LARGE \@title \par}%
    \vskip 3em%
    {\large
     \lineskip .75em%
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par}%
      \vskip 1.5em%
    {\large \@date \par}%       % Set date in \large size.
  \end{center}\par
%%%Insertion start
\section*{\center{Table of contents}}
\@starttoc{toc}
%%%Insertion end
  \@thanks
  \vfil\null
  \end{titlepage}%
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@thanks\@empty
  \global\let\@author\@empty
  \global\let\@date\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
}

\makeatother

\renewcommand{\thechapter}{}
\renewcommand{\chaptername}{}

\title{This is a test}
\author{John Doe\footnote{where is the foot note?}}

\begin{document}
\maketitleWithToc

\chapter{Preface}
 \lipsum[1]
\chapter{First Thing}
  \lipsum[2]
  \chapter{Second Thing}
  \lipsum[3]
   \chapter{Third Thing}
  \lipsum[4]
\end{document}
knut
  • 8,838
0

I am submitting this solution only to capture the full conversation below the accepted answer.

\documentclass[12pt]{article}
\usepackage{lipsum}
\usepackage[T1]{fontenc}
\usepackage{sectsty}
\usepackage[ocgcolorlinks, hypertexnames]{hyperref}

\setcounter{secnumdepth}{0}
\title{\huge\bfseries This is a test}
\author{\textbf{John Doe}\footnote{where is the foot note?}}

\begin{document}
\maketitle
\center\tableofcontents
\clearpage
\sectionfont{\huge\bfseries}
\begin{flushleft}
\section{Preface}
\vspace{10pt}
 \lipsum[1]
 \pagebreak
\section{First Thing}
\vspace{10pt}
  \lipsum[2]
  \pagebreak
  \section{Second Thing}
  \vspace{10pt}
  \lipsum[3]
  \pagebreak
  \section{Third Thing}
  \vspace{10pt}
  \lipsum[4]
\end{flushleft}
\end{document}
Sony
  • 3,920