How to make table of contents in google docs with dots

Jan Rovny

unread,

May 20, 2011, 10:14:38 PM5/20/11

to

Hello,

I am trying to get a leader of dots going from my chapter titles to my
page number in the table of contents. (LaTeX normally produces these
leaders only for lower level headings like sections and subsections.)

I have tried the 'tocloft' package, but the commands for doing this do
not produce any results.

I would be grateful for a clearer suggestions of commands.

Many thanks,
Jan

Lars Madsen

unread,

May 20, 2011, 10:20:11 PM5/20/11

to

it would be helpful with a minimal example (compilable) example of what
you have tried

--
/daleif

DK-TUG president
memoir and mh bundle maintainer

GL

unread,

May 20, 2011, 10:47:15 PM5/20/11

to

With tocloft you have the \cftZleader command that puts the leaders
and \cftdotsep is the space between dots (\def\cftdotsep{\cftnodots}
removes the leaders by giving to \cftdotsep a huge value)

You then have to check the \cftsubsecleader (without /s/ weirdly)
command (for subsection):

\def\cftsubsecleaders{\cftdotfill\cftdotsep} normally

and check the value of \cftdotsep expressed in "mu" units without
the unit: for example \def\cftdotsep{5}

This should work... With interfaces:

\tocsetup{subsection/dotsep=5} does the job (the leader is automatically
set if dotsep is not \cftnodots) - at least for the next version...

Regards.

Peter Flynn

unread,

May 20, 2011, 11:19:11 PM5/20/11

to

Copy the definition of \l@chapter from your document class file, make it
a \renewcommand, and then substitute the definition of \dottedtocline
for the \hfil (adding a \normalfont to negate the bold):


\documentclass{report}
\makeatletter
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\leaders\hbox{\normalfont$\m@th
\mkern \@dotsep mu\hbox{.}\mkern \@dotsep
mu$}\hfill \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}
\makeatother
\begin{document}
\tableofcontents
\chapter{foo}
Stuff
\section{bar}
More stuff
\end{document}

///Peter

unread,

Nov 24, 2014, 11:01:45 PM11/24/14

to

在 2011年5月20日星期五UTC-5下午4时19分11秒,peter写道:

I works well in my dissertation! Thanks for the sharing!

Shihai

  • You can create a table of contents in a Google Doc with a computer, iPhone, or iPad.
  • Google Docs' table of contents feature gives readers an organized outline of the entire document.
  • Your table of contents' sections will be automatically generated based on the headings in your Google Doc.

Google Docs quickly became one of the web's most accessible, easy-to-use document editing and sharing platforms.

Although Google Docs is a platform beloved for its simplicity, there are sophisticated touches users can integrate into their Google Docs. One of the most useful: a table of contents.

Here's how you can add a table of contents to a Google Doc, allowing you to organize a lengthy research paper or any other ambitious literary endeavors. 

How to create a table of contents in Google Docs 

Using a computer

1. Navigate to docs.google.com and open the document that you want to add a table of contents to. Select a document with multiple sections, each set apart by header text.

2. In the top options menu, beneath the title of the document, select "Insert."

3. Scroll to the bottom to select "Table of contents" and select if you prefer page numbers, which is best for aa document that will be printed, or blue links, ideal for an online-based piece.

You can format the table of contents in two ways. Emma Witman/Insider

Your table of contents will appear on the page.

The table of contents will let you move between sections quickly. Emma Witman/Insider

Using an iPhone or iPad

1. Open Google Docs and create a new document or open an existing document with multiple sections, each set apart by header text.

2. Tap the ellipsis icon, or three dots, in the top-right corner, and make sure that "Print layout" is enabled.

"Print layout" lets you see what the document will look like on sheets of paper. William Antonelli/Insider

3. Tap the edit button — the blue pen icon in the lower right — to open editing options at the top of your iPhone or iPad screen.

5. Tap the "Insert" button, or plus sign icon, and scroll to the bottom of the options menu to select "Table of contents." The page numbers option suits documents you intend to print, while the blue links option is great for online-only docs.

Select "Table of contents," the last option. William Antonelli/Insider

Your table of contents will appear at the top of the page.

The table of contents' options will depend on your document's headings. William Antonelli/Insider

How to format a Google Doc to make a table of contents appear

If you try to insert a table of contents and nothing appears, that means you likely need to reformat your document using headers. Then, your table of contents will automatically populate using the text of your headers. Here's how to do it on desktop and mobile.

Using a web browser 

1. Highlight the text you want to add as a table of contents section.

2. From the styles menu, included by default in the main toolbar, the default style will be "Normal text." Select one of the numeric "Heading" options to add the text as a table of contents section.

Selecting any heading option will add the highlighted text to the table of contents. Emma Witman/Insider

Using an iPad or iPhone

1. Select the text that you want to become the name of your future table of contents section. 

2. Tap the blue pen icon in the bottom-right corner to begin editing, then select the underlined "A" icon from the top menu.

3. Under text options, change the "Style" to "Heading," followed by a number between one and six, depending on how you want the sections and subsections structured.

While here, you can also adjust the font type, size, color, and more. Emma Witman/Insider

Emma Witman is an Asheville, NC-based freelance journalist with a keen interest in writing about hardware, PC gaming, politics, and personal finance. She is a former crime reporter for a daily newspaper, and has also written extensively about bartending for Insider. She may or may not judge your drink order when behind the bar. Follow her on Twitter at @emwity.

Read more Read less

How do you put dot leaders in Google Docs?

Go to View > Ruler and make sure there's a check mark next to Ruler so the ruler is visible. 4. Click in the ruler where you want the numbers to align and select "Add right-tab stop."

How do you customize a table of contents in Google Docs?

Add, change, or delete a table of contents.
On your computer, open a document in Google Docs..
Click where you want the table of contents..
Click Insert. Table of contents..
Choose how you want the table of contents to look..