LaTeX forum ⇒ Page LayoutIndent contents line of table of content Topic is solved

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Jack1234567
Posts: 3
Joined: Fri Feb 08, 2019 10:33 am

Indent contents line of table of content

Postby Jack1234567 » Fri Feb 08, 2019 10:43 am

Hi there,

I used the following formatting to include apa references in my report, importing it from Mendeley.

% REFERENCES
\bibliographystyle{apacite}
\bibliography{Library.bib}

It automatically included a line in my table of content, as you can see below. However, I want to tab (indent) the reference line, in order to align it with the rest of the sections (summery, acknowledgement, etc.). Does anyone know how I can fix this problem?

TOC.PNG
TOC.PNG (35.94 KiB) Viewed 374 times



ps. when I add another section line to my table of content, I get two references lines.
\addcontentsline{toc}{section}{\numberline{}References}

TOC 2.PNG
TOC 2.PNG (36.58 KiB) Viewed 374 times



Thank you!!

User avatar
Stefan Kottwitz
Site Admin
Posts: 9406
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Feb 08, 2019 2:04 pm

Hi Jack,

welcome to the forum!

It seems you have somewhere else in your code such an \addcontentsline already, but without that \numberline{}. That happens for example if you simply use the tocbibind package.

Quick patch, at the end of your document preamble, so right before \begin{document}:

  1. \let\origaddcontentsline\addcontentsline
  2. \renewcommand{\addcontentsline}[3]{\origaddcontentsline{#1}{#2}{\numberline{}#3}}


Stefan
Site admin

Jack1234567
Posts: 3
Joined: Fri Feb 08, 2019 10:33 am

Postby Jack1234567 » Fri Feb 08, 2019 3:11 pm

Hi Stefan,

Thank you so much, this was very much of a help. Fixed the 'reference' problem.
However, next problem the appendix's have indented now. Do you also know how to get them aligned with the numbers?

Excuse me, just started working with Latex, so it's all a bit new to me.

TOC 3.PNG
TOC 3.PNG (53.23 KiB) Viewed 365 times


Thank you!

User avatar
Stefan Kottwitz
Site Admin
Posts: 9406
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Feb 08, 2019 3:34 pm

You could revert that change after \bibliography and before the appendix:

  1. \let\addcontentsline\origaddcontentsline


Stefan
Site admin

Jack1234567
Posts: 3
Joined: Fri Feb 08, 2019 10:33 am

Postby Jack1234567 » Fri Feb 08, 2019 4:11 pm

Perfect, thank you!


Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 4 guests