How to center section when using titleformat{section}?
up vote
2
down vote
favorite
I decided to use usepackage[center]{titlesec} in order to center my sections, but I don't want them displaying the chapter/section numbering in the chapter/section headings so I applied the titleformat. But with this new macro, it erased the [center] command.
documentclass[14pt]{memoir}
usepackage[center]{titlesec}
usepackage{lipsum}
titleformat{chapter}
{Largebfseries}
{}
{0pt}
{huge}
titleformat{section}
{Largebfseries}
{}
{0pt}
{large}
begin{document}
tableofcontents
chapter{This shouldn't be centered}
clearpage
section{This should be centered}
lipsum[1]
subsection{This should be centered}
Nothing to see here.
end{document}
Result:
horizontal-alignment titlesec
add a comment |
up vote
2
down vote
favorite
I decided to use usepackage[center]{titlesec} in order to center my sections, but I don't want them displaying the chapter/section numbering in the chapter/section headings so I applied the titleformat. But with this new macro, it erased the [center] command.
documentclass[14pt]{memoir}
usepackage[center]{titlesec}
usepackage{lipsum}
titleformat{chapter}
{Largebfseries}
{}
{0pt}
{huge}
titleformat{section}
{Largebfseries}
{}
{0pt}
{large}
begin{document}
tableofcontents
chapter{This shouldn't be centered}
clearpage
section{This should be centered}
lipsum[1]
subsection{This should be centered}
Nothing to see here.
end{document}
Result:
horizontal-alignment titlesec
It worked but generated a /par error on compilation.
– Xyd
Jan 19 '16 at 18:56
See About memoir and titlesec incompatibility
– egreg
Jan 19 '16 at 18:57
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I decided to use usepackage[center]{titlesec} in order to center my sections, but I don't want them displaying the chapter/section numbering in the chapter/section headings so I applied the titleformat. But with this new macro, it erased the [center] command.
documentclass[14pt]{memoir}
usepackage[center]{titlesec}
usepackage{lipsum}
titleformat{chapter}
{Largebfseries}
{}
{0pt}
{huge}
titleformat{section}
{Largebfseries}
{}
{0pt}
{large}
begin{document}
tableofcontents
chapter{This shouldn't be centered}
clearpage
section{This should be centered}
lipsum[1]
subsection{This should be centered}
Nothing to see here.
end{document}
Result:
horizontal-alignment titlesec
I decided to use usepackage[center]{titlesec} in order to center my sections, but I don't want them displaying the chapter/section numbering in the chapter/section headings so I applied the titleformat. But with this new macro, it erased the [center] command.
documentclass[14pt]{memoir}
usepackage[center]{titlesec}
usepackage{lipsum}
titleformat{chapter}
{Largebfseries}
{}
{0pt}
{huge}
titleformat{section}
{Largebfseries}
{}
{0pt}
{large}
begin{document}
tableofcontents
chapter{This shouldn't be centered}
clearpage
section{This should be centered}
lipsum[1]
subsection{This should be centered}
Nothing to see here.
end{document}
Result:
horizontal-alignment titlesec
horizontal-alignment titlesec
edited Nov 13 at 4:05
LCarvalho
969317
969317
asked Jan 19 '16 at 18:40
Xyd
142111
142111
It worked but generated a /par error on compilation.
– Xyd
Jan 19 '16 at 18:56
See About memoir and titlesec incompatibility
– egreg
Jan 19 '16 at 18:57
add a comment |
It worked but generated a /par error on compilation.
– Xyd
Jan 19 '16 at 18:56
See About memoir and titlesec incompatibility
– egreg
Jan 19 '16 at 18:57
It worked but generated a /par error on compilation.
– Xyd
Jan 19 '16 at 18:56
It worked but generated a /par error on compilation.
– Xyd
Jan 19 '16 at 18:56
See About memoir and titlesec incompatibility
– egreg
Jan 19 '16 at 18:57
See About memoir and titlesec incompatibility
– egreg
Jan 19 '16 at 18:57
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
like this ? :
documentclass[14pt]{memoir}
usepackage[center]{titlesec}
usepackage{lipsum}
titleformat{chapter}
{centeringLargebfseries} % format
{}% label
{0pt} % sep
{huge}
setcounter{secnumdepth}{0}
begin{document}
tableofcontents
chapter{This shouldn't be centered}
clearpage
section{This should be centered}
lipsum[1]
subsection{This should be centered}
Nothing to see here.
end{document}
Result:
I tried it and saw that chapter{This shouldn't be centered} actually centered. Oh well but once I removed centering it was all good!... But the numbers came back.
– Xyd
Jan 19 '16 at 18:56
I found an answer elsewhere and used setsecnumdepth{none} maxsecnumdepth{none} instead of setcounter{secnumdepth}{0} and now it worked (as for removing the darn numbers).
– Xyd
Jan 19 '16 at 19:18
add a comment |
up vote
2
down vote
You shouldn't use titlesec
with memoir
, see About memoir and titlesec incompatibility
documentclass[14pt]{memoir}
usepackage{lipsum}
setsecheadstyle{centeringLargebfseries}
setsubsecheadstyle{centeringlargebfseries}
setsechook{setsecnumformat{csname the##1endcsname }}
begin{document}
tableofcontents
chapter{This shouldn't be centered}
section{This should be centered}
lipsum[1]
subsection{This should be centered}
Nothing to see here.
end{document}
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
like this ? :
documentclass[14pt]{memoir}
usepackage[center]{titlesec}
usepackage{lipsum}
titleformat{chapter}
{centeringLargebfseries} % format
{}% label
{0pt} % sep
{huge}
setcounter{secnumdepth}{0}
begin{document}
tableofcontents
chapter{This shouldn't be centered}
clearpage
section{This should be centered}
lipsum[1]
subsection{This should be centered}
Nothing to see here.
end{document}
Result:
I tried it and saw that chapter{This shouldn't be centered} actually centered. Oh well but once I removed centering it was all good!... But the numbers came back.
– Xyd
Jan 19 '16 at 18:56
I found an answer elsewhere and used setsecnumdepth{none} maxsecnumdepth{none} instead of setcounter{secnumdepth}{0} and now it worked (as for removing the darn numbers).
– Xyd
Jan 19 '16 at 19:18
add a comment |
up vote
2
down vote
accepted
like this ? :
documentclass[14pt]{memoir}
usepackage[center]{titlesec}
usepackage{lipsum}
titleformat{chapter}
{centeringLargebfseries} % format
{}% label
{0pt} % sep
{huge}
setcounter{secnumdepth}{0}
begin{document}
tableofcontents
chapter{This shouldn't be centered}
clearpage
section{This should be centered}
lipsum[1]
subsection{This should be centered}
Nothing to see here.
end{document}
Result:
I tried it and saw that chapter{This shouldn't be centered} actually centered. Oh well but once I removed centering it was all good!... But the numbers came back.
– Xyd
Jan 19 '16 at 18:56
I found an answer elsewhere and used setsecnumdepth{none} maxsecnumdepth{none} instead of setcounter{secnumdepth}{0} and now it worked (as for removing the darn numbers).
– Xyd
Jan 19 '16 at 19:18
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
like this ? :
documentclass[14pt]{memoir}
usepackage[center]{titlesec}
usepackage{lipsum}
titleformat{chapter}
{centeringLargebfseries} % format
{}% label
{0pt} % sep
{huge}
setcounter{secnumdepth}{0}
begin{document}
tableofcontents
chapter{This shouldn't be centered}
clearpage
section{This should be centered}
lipsum[1]
subsection{This should be centered}
Nothing to see here.
end{document}
Result:
like this ? :
documentclass[14pt]{memoir}
usepackage[center]{titlesec}
usepackage{lipsum}
titleformat{chapter}
{centeringLargebfseries} % format
{}% label
{0pt} % sep
{huge}
setcounter{secnumdepth}{0}
begin{document}
tableofcontents
chapter{This shouldn't be centered}
clearpage
section{This should be centered}
lipsum[1]
subsection{This should be centered}
Nothing to see here.
end{document}
Result:
edited Nov 13 at 0:38
LCarvalho
969317
969317
answered Jan 19 '16 at 18:51
flav
3,3971625
3,3971625
I tried it and saw that chapter{This shouldn't be centered} actually centered. Oh well but once I removed centering it was all good!... But the numbers came back.
– Xyd
Jan 19 '16 at 18:56
I found an answer elsewhere and used setsecnumdepth{none} maxsecnumdepth{none} instead of setcounter{secnumdepth}{0} and now it worked (as for removing the darn numbers).
– Xyd
Jan 19 '16 at 19:18
add a comment |
I tried it and saw that chapter{This shouldn't be centered} actually centered. Oh well but once I removed centering it was all good!... But the numbers came back.
– Xyd
Jan 19 '16 at 18:56
I found an answer elsewhere and used setsecnumdepth{none} maxsecnumdepth{none} instead of setcounter{secnumdepth}{0} and now it worked (as for removing the darn numbers).
– Xyd
Jan 19 '16 at 19:18
I tried it and saw that chapter{This shouldn't be centered} actually centered. Oh well but once I removed centering it was all good!... But the numbers came back.
– Xyd
Jan 19 '16 at 18:56
I tried it and saw that chapter{This shouldn't be centered} actually centered. Oh well but once I removed centering it was all good!... But the numbers came back.
– Xyd
Jan 19 '16 at 18:56
I found an answer elsewhere and used setsecnumdepth{none} maxsecnumdepth{none} instead of setcounter{secnumdepth}{0} and now it worked (as for removing the darn numbers).
– Xyd
Jan 19 '16 at 19:18
I found an answer elsewhere and used setsecnumdepth{none} maxsecnumdepth{none} instead of setcounter{secnumdepth}{0} and now it worked (as for removing the darn numbers).
– Xyd
Jan 19 '16 at 19:18
add a comment |
up vote
2
down vote
You shouldn't use titlesec
with memoir
, see About memoir and titlesec incompatibility
documentclass[14pt]{memoir}
usepackage{lipsum}
setsecheadstyle{centeringLargebfseries}
setsubsecheadstyle{centeringlargebfseries}
setsechook{setsecnumformat{csname the##1endcsname }}
begin{document}
tableofcontents
chapter{This shouldn't be centered}
section{This should be centered}
lipsum[1]
subsection{This should be centered}
Nothing to see here.
end{document}
add a comment |
up vote
2
down vote
You shouldn't use titlesec
with memoir
, see About memoir and titlesec incompatibility
documentclass[14pt]{memoir}
usepackage{lipsum}
setsecheadstyle{centeringLargebfseries}
setsubsecheadstyle{centeringlargebfseries}
setsechook{setsecnumformat{csname the##1endcsname }}
begin{document}
tableofcontents
chapter{This shouldn't be centered}
section{This should be centered}
lipsum[1]
subsection{This should be centered}
Nothing to see here.
end{document}
add a comment |
up vote
2
down vote
up vote
2
down vote
You shouldn't use titlesec
with memoir
, see About memoir and titlesec incompatibility
documentclass[14pt]{memoir}
usepackage{lipsum}
setsecheadstyle{centeringLargebfseries}
setsubsecheadstyle{centeringlargebfseries}
setsechook{setsecnumformat{csname the##1endcsname }}
begin{document}
tableofcontents
chapter{This shouldn't be centered}
section{This should be centered}
lipsum[1]
subsection{This should be centered}
Nothing to see here.
end{document}
You shouldn't use titlesec
with memoir
, see About memoir and titlesec incompatibility
documentclass[14pt]{memoir}
usepackage{lipsum}
setsecheadstyle{centeringLargebfseries}
setsubsecheadstyle{centeringlargebfseries}
setsechook{setsecnumformat{csname the##1endcsname }}
begin{document}
tableofcontents
chapter{This shouldn't be centered}
section{This should be centered}
lipsum[1]
subsection{This should be centered}
Nothing to see here.
end{document}
edited Apr 13 '17 at 12:35
Community♦
1
1
answered Jan 19 '16 at 19:06
egreg
698k8518553123
698k8518553123
add a comment |
add a comment |
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%2f288424%2fhow-to-center-section-when-using-titleformat-section%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
It worked but generated a /par error on compilation.
– Xyd
Jan 19 '16 at 18:56
See About memoir and titlesec incompatibility
– egreg
Jan 19 '16 at 18:57