Centred “Contents” in TOC in twocolumn document with custom sections
up vote
3
down vote
favorite
I want to adjust the TOC for my twocolumn
document. I want to have the word "Contents" at the top and centre of the page, and the toc entries following in two columns afterwards.
I found this which shows me how to do this; but
1) it conflicts with my use of the titletoc
and titlesec
packages. This is because the TOC seems itself to be a section.
2) it is overly specific in formatting of the toc entries.
I would like to format the entries themselves with titletoc
as follows
titlecontents{section} [0pt] { } {thecontentslabel.enspace} { } {leadershbox to 1em{hss.hss}hfill thecontentspage}
How can I get my formatting of the sections and toc entries, as well as centering the word "Contents" in the TOC of my doc?
The result so far is this
The MWE is:
documentclass[12pt,oneside,twocolumn]{article}
usepackage[a4paper, bottom=2cm, columnsep=2.0cm,top=2cm, left=1in, right=1cm ] {geometry}
usepackage{titlesec}
usepackage{titletoc}
titlespacing{section}{0pt}{4ex}{-0.5parskip}
titleformat{section}[hang]{raggedrightnormalfontlargebfseries}{thesection.}{1ex}{}
makeatletter
renewcommand*{tableofcontents}{%
if@twocolumn
@restonecolfalse
else
@restonecoltrue
fi
twocolumn[section*{centeringcontentsname}]%
@mkboth{MakeUppercasecontentsname}%
{MakeUppercasecontentsname}%
thispagestyle{plain}%
@starttoc{toc}%
if@restonecol
onecolumn
else
clearpage
fi
}
makeatother
begin{document}
tableofcontents
newpage
section{Section 1}
section{Section 2}
section{Section 3}
section{Section 4}
section{Section 5}
section{Section 6}
section{Section 7}
section{Section 8}
section{Section 9}
section{Section 10}
section{Section 11}
section{Section 12}
section{Section 13}
section{Section 14}
section{Section 15}
section{Section 16}
section{Section 17}
section{Section 18}
section{Section 19}
section{Section 20}
section{Section 21}
section{Section 22}
section{Section 23}
section{Section 24}
section{Section 25}
section{Section 26}
section{Section 27}
section{Section 28}
section{Section 29}
end{document}
table-of-contents two-column titletoc
bumped to the homepage by Community♦ 3 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
up vote
3
down vote
favorite
I want to adjust the TOC for my twocolumn
document. I want to have the word "Contents" at the top and centre of the page, and the toc entries following in two columns afterwards.
I found this which shows me how to do this; but
1) it conflicts with my use of the titletoc
and titlesec
packages. This is because the TOC seems itself to be a section.
2) it is overly specific in formatting of the toc entries.
I would like to format the entries themselves with titletoc
as follows
titlecontents{section} [0pt] { } {thecontentslabel.enspace} { } {leadershbox to 1em{hss.hss}hfill thecontentspage}
How can I get my formatting of the sections and toc entries, as well as centering the word "Contents" in the TOC of my doc?
The result so far is this
The MWE is:
documentclass[12pt,oneside,twocolumn]{article}
usepackage[a4paper, bottom=2cm, columnsep=2.0cm,top=2cm, left=1in, right=1cm ] {geometry}
usepackage{titlesec}
usepackage{titletoc}
titlespacing{section}{0pt}{4ex}{-0.5parskip}
titleformat{section}[hang]{raggedrightnormalfontlargebfseries}{thesection.}{1ex}{}
makeatletter
renewcommand*{tableofcontents}{%
if@twocolumn
@restonecolfalse
else
@restonecoltrue
fi
twocolumn[section*{centeringcontentsname}]%
@mkboth{MakeUppercasecontentsname}%
{MakeUppercasecontentsname}%
thispagestyle{plain}%
@starttoc{toc}%
if@restonecol
onecolumn
else
clearpage
fi
}
makeatother
begin{document}
tableofcontents
newpage
section{Section 1}
section{Section 2}
section{Section 3}
section{Section 4}
section{Section 5}
section{Section 6}
section{Section 7}
section{Section 8}
section{Section 9}
section{Section 10}
section{Section 11}
section{Section 12}
section{Section 13}
section{Section 14}
section{Section 15}
section{Section 16}
section{Section 17}
section{Section 18}
section{Section 19}
section{Section 20}
section{Section 21}
section{Section 22}
section{Section 23}
section{Section 24}
section{Section 25}
section{Section 26}
section{Section 27}
section{Section 28}
section{Section 29}
end{document}
table-of-contents two-column titletoc
bumped to the homepage by Community♦ 3 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I want to adjust the TOC for my twocolumn
document. I want to have the word "Contents" at the top and centre of the page, and the toc entries following in two columns afterwards.
I found this which shows me how to do this; but
1) it conflicts with my use of the titletoc
and titlesec
packages. This is because the TOC seems itself to be a section.
2) it is overly specific in formatting of the toc entries.
I would like to format the entries themselves with titletoc
as follows
titlecontents{section} [0pt] { } {thecontentslabel.enspace} { } {leadershbox to 1em{hss.hss}hfill thecontentspage}
How can I get my formatting of the sections and toc entries, as well as centering the word "Contents" in the TOC of my doc?
The result so far is this
The MWE is:
documentclass[12pt,oneside,twocolumn]{article}
usepackage[a4paper, bottom=2cm, columnsep=2.0cm,top=2cm, left=1in, right=1cm ] {geometry}
usepackage{titlesec}
usepackage{titletoc}
titlespacing{section}{0pt}{4ex}{-0.5parskip}
titleformat{section}[hang]{raggedrightnormalfontlargebfseries}{thesection.}{1ex}{}
makeatletter
renewcommand*{tableofcontents}{%
if@twocolumn
@restonecolfalse
else
@restonecoltrue
fi
twocolumn[section*{centeringcontentsname}]%
@mkboth{MakeUppercasecontentsname}%
{MakeUppercasecontentsname}%
thispagestyle{plain}%
@starttoc{toc}%
if@restonecol
onecolumn
else
clearpage
fi
}
makeatother
begin{document}
tableofcontents
newpage
section{Section 1}
section{Section 2}
section{Section 3}
section{Section 4}
section{Section 5}
section{Section 6}
section{Section 7}
section{Section 8}
section{Section 9}
section{Section 10}
section{Section 11}
section{Section 12}
section{Section 13}
section{Section 14}
section{Section 15}
section{Section 16}
section{Section 17}
section{Section 18}
section{Section 19}
section{Section 20}
section{Section 21}
section{Section 22}
section{Section 23}
section{Section 24}
section{Section 25}
section{Section 26}
section{Section 27}
section{Section 28}
section{Section 29}
end{document}
table-of-contents two-column titletoc
I want to adjust the TOC for my twocolumn
document. I want to have the word "Contents" at the top and centre of the page, and the toc entries following in two columns afterwards.
I found this which shows me how to do this; but
1) it conflicts with my use of the titletoc
and titlesec
packages. This is because the TOC seems itself to be a section.
2) it is overly specific in formatting of the toc entries.
I would like to format the entries themselves with titletoc
as follows
titlecontents{section} [0pt] { } {thecontentslabel.enspace} { } {leadershbox to 1em{hss.hss}hfill thecontentspage}
How can I get my formatting of the sections and toc entries, as well as centering the word "Contents" in the TOC of my doc?
The result so far is this
The MWE is:
documentclass[12pt,oneside,twocolumn]{article}
usepackage[a4paper, bottom=2cm, columnsep=2.0cm,top=2cm, left=1in, right=1cm ] {geometry}
usepackage{titlesec}
usepackage{titletoc}
titlespacing{section}{0pt}{4ex}{-0.5parskip}
titleformat{section}[hang]{raggedrightnormalfontlargebfseries}{thesection.}{1ex}{}
makeatletter
renewcommand*{tableofcontents}{%
if@twocolumn
@restonecolfalse
else
@restonecoltrue
fi
twocolumn[section*{centeringcontentsname}]%
@mkboth{MakeUppercasecontentsname}%
{MakeUppercasecontentsname}%
thispagestyle{plain}%
@starttoc{toc}%
if@restonecol
onecolumn
else
clearpage
fi
}
makeatother
begin{document}
tableofcontents
newpage
section{Section 1}
section{Section 2}
section{Section 3}
section{Section 4}
section{Section 5}
section{Section 6}
section{Section 7}
section{Section 8}
section{Section 9}
section{Section 10}
section{Section 11}
section{Section 12}
section{Section 13}
section{Section 14}
section{Section 15}
section{Section 16}
section{Section 17}
section{Section 18}
section{Section 19}
section{Section 20}
section{Section 21}
section{Section 22}
section{Section 23}
section{Section 24}
section{Section 25}
section{Section 26}
section{Section 27}
section{Section 28}
section{Section 29}
end{document}
table-of-contents two-column titletoc
table-of-contents two-column titletoc
edited Apr 13 '17 at 12:35
Community♦
1
1
asked Dec 22 '15 at 17:04
Tim
732513
732513
bumped to the homepage by Community♦ 3 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 3 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Perhaps not as elegant as what you are trying, but:
Since the table of contents is only going to appear once, it's easy enough to remove the header and add a new one back in 'by hand'. Also, if you are mixing one-column and two-column elements, the multicol
package is a little more flexible than setting the entire document to twocolumn
.
EDIT: My original solution didn't work with titlesec
, I think I was using the section*
macro in a way that was incompatible with that package. This seems to work now, with a manually formatted toc heading.
documentclass{article}
usepackage{multicol}
usepackage{titlesec}
titlespacing{section}{0pt}{4ex}{-0.5parskip}
titleformat{section}[hang]{raggedrightnormalfontlargebfseries}{thesection.}{1ex}{}
usepackage{titletoc}
titlecontents{section} [0pt] { } {thecontentslabel.enspace} { } {leadershbox to 1em{hss.hss}hfill thecontentspage}
makeatletter
renewcommandtableofcontents{%
@starttoc{toc}%
}
makeatother
makeatletter
renewcommandtableofcontents{%
@starttoc{toc}%
}
makeatother
begin{document}
begin{center}
Large
textbf{Contents}
end{center}
begin{multicols}{2}
tableofcontents
newpage
section{Section 1}
section{Section 2}
section{Section 3}
section{Section 4}
section{Section 5}
section{Section 6}
section{Section 7}
section{Section 8}
section{Section 9}
section{Section 10}
section{Section 11}
section{Section 12}
section{Section 13}
section{Section 14}
section{Section 15}
section{Section 16}
section{Section 17}
section{Section 18}
section{Section 19}
section{Section 20}
section{Section 21}
section{Section 22}
section{Section 23}
section{Section 24}
section{Section 25}
section{Section 26}
section{Section 27}
section{Section 28}
section{Section 29}
end{multicols}
end{document}
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Perhaps not as elegant as what you are trying, but:
Since the table of contents is only going to appear once, it's easy enough to remove the header and add a new one back in 'by hand'. Also, if you are mixing one-column and two-column elements, the multicol
package is a little more flexible than setting the entire document to twocolumn
.
EDIT: My original solution didn't work with titlesec
, I think I was using the section*
macro in a way that was incompatible with that package. This seems to work now, with a manually formatted toc heading.
documentclass{article}
usepackage{multicol}
usepackage{titlesec}
titlespacing{section}{0pt}{4ex}{-0.5parskip}
titleformat{section}[hang]{raggedrightnormalfontlargebfseries}{thesection.}{1ex}{}
usepackage{titletoc}
titlecontents{section} [0pt] { } {thecontentslabel.enspace} { } {leadershbox to 1em{hss.hss}hfill thecontentspage}
makeatletter
renewcommandtableofcontents{%
@starttoc{toc}%
}
makeatother
makeatletter
renewcommandtableofcontents{%
@starttoc{toc}%
}
makeatother
begin{document}
begin{center}
Large
textbf{Contents}
end{center}
begin{multicols}{2}
tableofcontents
newpage
section{Section 1}
section{Section 2}
section{Section 3}
section{Section 4}
section{Section 5}
section{Section 6}
section{Section 7}
section{Section 8}
section{Section 9}
section{Section 10}
section{Section 11}
section{Section 12}
section{Section 13}
section{Section 14}
section{Section 15}
section{Section 16}
section{Section 17}
section{Section 18}
section{Section 19}
section{Section 20}
section{Section 21}
section{Section 22}
section{Section 23}
section{Section 24}
section{Section 25}
section{Section 26}
section{Section 27}
section{Section 28}
section{Section 29}
end{multicols}
end{document}
add a comment |
up vote
0
down vote
Perhaps not as elegant as what you are trying, but:
Since the table of contents is only going to appear once, it's easy enough to remove the header and add a new one back in 'by hand'. Also, if you are mixing one-column and two-column elements, the multicol
package is a little more flexible than setting the entire document to twocolumn
.
EDIT: My original solution didn't work with titlesec
, I think I was using the section*
macro in a way that was incompatible with that package. This seems to work now, with a manually formatted toc heading.
documentclass{article}
usepackage{multicol}
usepackage{titlesec}
titlespacing{section}{0pt}{4ex}{-0.5parskip}
titleformat{section}[hang]{raggedrightnormalfontlargebfseries}{thesection.}{1ex}{}
usepackage{titletoc}
titlecontents{section} [0pt] { } {thecontentslabel.enspace} { } {leadershbox to 1em{hss.hss}hfill thecontentspage}
makeatletter
renewcommandtableofcontents{%
@starttoc{toc}%
}
makeatother
makeatletter
renewcommandtableofcontents{%
@starttoc{toc}%
}
makeatother
begin{document}
begin{center}
Large
textbf{Contents}
end{center}
begin{multicols}{2}
tableofcontents
newpage
section{Section 1}
section{Section 2}
section{Section 3}
section{Section 4}
section{Section 5}
section{Section 6}
section{Section 7}
section{Section 8}
section{Section 9}
section{Section 10}
section{Section 11}
section{Section 12}
section{Section 13}
section{Section 14}
section{Section 15}
section{Section 16}
section{Section 17}
section{Section 18}
section{Section 19}
section{Section 20}
section{Section 21}
section{Section 22}
section{Section 23}
section{Section 24}
section{Section 25}
section{Section 26}
section{Section 27}
section{Section 28}
section{Section 29}
end{multicols}
end{document}
add a comment |
up vote
0
down vote
up vote
0
down vote
Perhaps not as elegant as what you are trying, but:
Since the table of contents is only going to appear once, it's easy enough to remove the header and add a new one back in 'by hand'. Also, if you are mixing one-column and two-column elements, the multicol
package is a little more flexible than setting the entire document to twocolumn
.
EDIT: My original solution didn't work with titlesec
, I think I was using the section*
macro in a way that was incompatible with that package. This seems to work now, with a manually formatted toc heading.
documentclass{article}
usepackage{multicol}
usepackage{titlesec}
titlespacing{section}{0pt}{4ex}{-0.5parskip}
titleformat{section}[hang]{raggedrightnormalfontlargebfseries}{thesection.}{1ex}{}
usepackage{titletoc}
titlecontents{section} [0pt] { } {thecontentslabel.enspace} { } {leadershbox to 1em{hss.hss}hfill thecontentspage}
makeatletter
renewcommandtableofcontents{%
@starttoc{toc}%
}
makeatother
makeatletter
renewcommandtableofcontents{%
@starttoc{toc}%
}
makeatother
begin{document}
begin{center}
Large
textbf{Contents}
end{center}
begin{multicols}{2}
tableofcontents
newpage
section{Section 1}
section{Section 2}
section{Section 3}
section{Section 4}
section{Section 5}
section{Section 6}
section{Section 7}
section{Section 8}
section{Section 9}
section{Section 10}
section{Section 11}
section{Section 12}
section{Section 13}
section{Section 14}
section{Section 15}
section{Section 16}
section{Section 17}
section{Section 18}
section{Section 19}
section{Section 20}
section{Section 21}
section{Section 22}
section{Section 23}
section{Section 24}
section{Section 25}
section{Section 26}
section{Section 27}
section{Section 28}
section{Section 29}
end{multicols}
end{document}
Perhaps not as elegant as what you are trying, but:
Since the table of contents is only going to appear once, it's easy enough to remove the header and add a new one back in 'by hand'. Also, if you are mixing one-column and two-column elements, the multicol
package is a little more flexible than setting the entire document to twocolumn
.
EDIT: My original solution didn't work with titlesec
, I think I was using the section*
macro in a way that was incompatible with that package. This seems to work now, with a manually formatted toc heading.
documentclass{article}
usepackage{multicol}
usepackage{titlesec}
titlespacing{section}{0pt}{4ex}{-0.5parskip}
titleformat{section}[hang]{raggedrightnormalfontlargebfseries}{thesection.}{1ex}{}
usepackage{titletoc}
titlecontents{section} [0pt] { } {thecontentslabel.enspace} { } {leadershbox to 1em{hss.hss}hfill thecontentspage}
makeatletter
renewcommandtableofcontents{%
@starttoc{toc}%
}
makeatother
makeatletter
renewcommandtableofcontents{%
@starttoc{toc}%
}
makeatother
begin{document}
begin{center}
Large
textbf{Contents}
end{center}
begin{multicols}{2}
tableofcontents
newpage
section{Section 1}
section{Section 2}
section{Section 3}
section{Section 4}
section{Section 5}
section{Section 6}
section{Section 7}
section{Section 8}
section{Section 9}
section{Section 10}
section{Section 11}
section{Section 12}
section{Section 13}
section{Section 14}
section{Section 15}
section{Section 16}
section{Section 17}
section{Section 18}
section{Section 19}
section{Section 20}
section{Section 21}
section{Section 22}
section{Section 23}
section{Section 24}
section{Section 25}
section{Section 26}
section{Section 27}
section{Section 28}
section{Section 29}
end{multicols}
end{document}
edited Apr 13 '17 at 12:35
Community♦
1
1
answered Dec 22 '15 at 17:49
Tyler
2,0981127
2,0981127
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f284334%2fcentred-contents-in-toc-in-twocolumn-document-with-custom-sections%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown