Makeuppercase in section formatting
I was trying to make a section style with uppercase fonts and color. But when I use MakeUppercase
like
makeatletter
renewcommand{@seccntformat}[1]{{textcolor{purple}{csname the#1endcsname}hspace{1em}}}
renewcommand{section}{@startsection{section}{1}{z@}
{-4ex @plus -1ex @minus -.4ex}
{1ex @plus.2ex }
{normalfontlargesffamilybfseriesMakeUppercasecolor{purple}}}
The following errors are shown
Argument of @declaredcolor has an extra }. section{}
sectioning formatting
add a comment |
I was trying to make a section style with uppercase fonts and color. But when I use MakeUppercase
like
makeatletter
renewcommand{@seccntformat}[1]{{textcolor{purple}{csname the#1endcsname}hspace{1em}}}
renewcommand{section}{@startsection{section}{1}{z@}
{-4ex @plus -1ex @minus -.4ex}
{1ex @plus.2ex }
{normalfontlargesffamilybfseriesMakeUppercasecolor{purple}}}
The following errors are shown
Argument of @declaredcolor has an extra }. section{}
sectioning formatting
1
Welcome to TeX.SE! Try swappingMakeUppercase
andcolor{purple}
on the last line:{normalfontlargesffamilybfseriescolor{purple}MakeUppercase}
. All ofnormalfont
,large
,sffamily
,bfseries
, andcolor{purple}
are switches (i.e. their effect last until the current scope ends) whileMakeUppercase
is a macro that takes one argument, so the way the sectioning commands work, the command which takes one argument must be last.
– Phelype Oleinik
Feb 12 at 18:54
add a comment |
I was trying to make a section style with uppercase fonts and color. But when I use MakeUppercase
like
makeatletter
renewcommand{@seccntformat}[1]{{textcolor{purple}{csname the#1endcsname}hspace{1em}}}
renewcommand{section}{@startsection{section}{1}{z@}
{-4ex @plus -1ex @minus -.4ex}
{1ex @plus.2ex }
{normalfontlargesffamilybfseriesMakeUppercasecolor{purple}}}
The following errors are shown
Argument of @declaredcolor has an extra }. section{}
sectioning formatting
I was trying to make a section style with uppercase fonts and color. But when I use MakeUppercase
like
makeatletter
renewcommand{@seccntformat}[1]{{textcolor{purple}{csname the#1endcsname}hspace{1em}}}
renewcommand{section}{@startsection{section}{1}{z@}
{-4ex @plus -1ex @minus -.4ex}
{1ex @plus.2ex }
{normalfontlargesffamilybfseriesMakeUppercasecolor{purple}}}
The following errors are shown
Argument of @declaredcolor has an extra }. section{}
sectioning formatting
sectioning formatting
edited Feb 12 at 18:53
Phelype Oleinik
23.5k54586
23.5k54586
asked Feb 12 at 18:51
Fawaz OlappilanFawaz Olappilan
102
102
1
Welcome to TeX.SE! Try swappingMakeUppercase
andcolor{purple}
on the last line:{normalfontlargesffamilybfseriescolor{purple}MakeUppercase}
. All ofnormalfont
,large
,sffamily
,bfseries
, andcolor{purple}
are switches (i.e. their effect last until the current scope ends) whileMakeUppercase
is a macro that takes one argument, so the way the sectioning commands work, the command which takes one argument must be last.
– Phelype Oleinik
Feb 12 at 18:54
add a comment |
1
Welcome to TeX.SE! Try swappingMakeUppercase
andcolor{purple}
on the last line:{normalfontlargesffamilybfseriescolor{purple}MakeUppercase}
. All ofnormalfont
,large
,sffamily
,bfseries
, andcolor{purple}
are switches (i.e. their effect last until the current scope ends) whileMakeUppercase
is a macro that takes one argument, so the way the sectioning commands work, the command which takes one argument must be last.
– Phelype Oleinik
Feb 12 at 18:54
1
1
Welcome to TeX.SE! Try swapping
MakeUppercase
and color{purple}
on the last line: {normalfontlargesffamilybfseriescolor{purple}MakeUppercase}
. All of normalfont
, large
, sffamily
, bfseries
, and color{purple}
are switches (i.e. their effect last until the current scope ends) while MakeUppercase
is a macro that takes one argument, so the way the sectioning commands work, the command which takes one argument must be last.– Phelype Oleinik
Feb 12 at 18:54
Welcome to TeX.SE! Try swapping
MakeUppercase
and color{purple}
on the last line: {normalfontlargesffamilybfseriescolor{purple}MakeUppercase}
. All of normalfont
, large
, sffamily
, bfseries
, and color{purple}
are switches (i.e. their effect last until the current scope ends) while MakeUppercase
is a macro that takes one argument, so the way the sectioning commands work, the command which takes one argument must be last.– Phelype Oleinik
Feb 12 at 18:54
add a comment |
1 Answer
1
active
oldest
votes
If you swap the order of MakeUppercase
and color{purple}
it works. Internally, the sectioning commands do (approximately) this:
<formatting>{@seccntformat{<number>} <title>}
where <formatting>
is the last argument of @startsection
, <number>
is the section number and <title>
, you guessed, the title :)
If we do like you suggested, section{hello}
becomes:
normalfontlargesffamilybfseriesMakeUppercasecolor{purple}{1 hello}
(@seccntformat
is not important right now). Try running the above and you'll see the same error. That happens because MakeUppercase
grabs color
as argument and when color
tries to do its thing it won't find the droids color name it was looking for and chaos will ensue. But if you swap the order it works :)
normalfontlargesffamilybfseriescolor{purple}MakeUppercase{1 hello}
But now you'll get another error:
! Package xcolor Error: Undefined color `PURPLE'.
but why?! Remember the @seccntformat
back then? You had:
<formatting>{@seccntformat{<number>} <title>}
when <formatting>
contains MakeUppercase
and @seccntformat
contains textcolor{purple}{<number>}
, then you have:
MakeUppercase{textcolor{purple}{<number>} <title>}
which will MakeUppercase
before textcolor
is executed:
{textcolor{PURPLE}{<NUMBER>} <TITLE>}
Yes, the NUMBER too :)
But you don't need that. The counter is used after the color{purple}
, so it will already be coloured. You can remove that and the number will be purple too. If you take that out, your definition of @seccntformat
is identical to LaTeX's one, so you can remove it altogether.
After all this the output is:
MWE:
documentclass{article}
usepackage{xcolor}
makeatletter
% renewcommand{@seccntformat}[1]{csname the#1endcsnamehspace{1em}} == default :)
renewcommand{section}{@startsection{section}{1}{z@}
{-4ex @plus -1ex @minus -.4ex}
{1ex @plus.2ex }
{normalfontlargesffamilybfseriescolor{purple}MakeUppercase}}
makeatother
begin{document}
pagestyle{empty}
section{Hello}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
end{document}
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2f474564%2fmakeuppercase-in-section-formatting%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you swap the order of MakeUppercase
and color{purple}
it works. Internally, the sectioning commands do (approximately) this:
<formatting>{@seccntformat{<number>} <title>}
where <formatting>
is the last argument of @startsection
, <number>
is the section number and <title>
, you guessed, the title :)
If we do like you suggested, section{hello}
becomes:
normalfontlargesffamilybfseriesMakeUppercasecolor{purple}{1 hello}
(@seccntformat
is not important right now). Try running the above and you'll see the same error. That happens because MakeUppercase
grabs color
as argument and when color
tries to do its thing it won't find the droids color name it was looking for and chaos will ensue. But if you swap the order it works :)
normalfontlargesffamilybfseriescolor{purple}MakeUppercase{1 hello}
But now you'll get another error:
! Package xcolor Error: Undefined color `PURPLE'.
but why?! Remember the @seccntformat
back then? You had:
<formatting>{@seccntformat{<number>} <title>}
when <formatting>
contains MakeUppercase
and @seccntformat
contains textcolor{purple}{<number>}
, then you have:
MakeUppercase{textcolor{purple}{<number>} <title>}
which will MakeUppercase
before textcolor
is executed:
{textcolor{PURPLE}{<NUMBER>} <TITLE>}
Yes, the NUMBER too :)
But you don't need that. The counter is used after the color{purple}
, so it will already be coloured. You can remove that and the number will be purple too. If you take that out, your definition of @seccntformat
is identical to LaTeX's one, so you can remove it altogether.
After all this the output is:
MWE:
documentclass{article}
usepackage{xcolor}
makeatletter
% renewcommand{@seccntformat}[1]{csname the#1endcsnamehspace{1em}} == default :)
renewcommand{section}{@startsection{section}{1}{z@}
{-4ex @plus -1ex @minus -.4ex}
{1ex @plus.2ex }
{normalfontlargesffamilybfseriescolor{purple}MakeUppercase}}
makeatother
begin{document}
pagestyle{empty}
section{Hello}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
end{document}
add a comment |
If you swap the order of MakeUppercase
and color{purple}
it works. Internally, the sectioning commands do (approximately) this:
<formatting>{@seccntformat{<number>} <title>}
where <formatting>
is the last argument of @startsection
, <number>
is the section number and <title>
, you guessed, the title :)
If we do like you suggested, section{hello}
becomes:
normalfontlargesffamilybfseriesMakeUppercasecolor{purple}{1 hello}
(@seccntformat
is not important right now). Try running the above and you'll see the same error. That happens because MakeUppercase
grabs color
as argument and when color
tries to do its thing it won't find the droids color name it was looking for and chaos will ensue. But if you swap the order it works :)
normalfontlargesffamilybfseriescolor{purple}MakeUppercase{1 hello}
But now you'll get another error:
! Package xcolor Error: Undefined color `PURPLE'.
but why?! Remember the @seccntformat
back then? You had:
<formatting>{@seccntformat{<number>} <title>}
when <formatting>
contains MakeUppercase
and @seccntformat
contains textcolor{purple}{<number>}
, then you have:
MakeUppercase{textcolor{purple}{<number>} <title>}
which will MakeUppercase
before textcolor
is executed:
{textcolor{PURPLE}{<NUMBER>} <TITLE>}
Yes, the NUMBER too :)
But you don't need that. The counter is used after the color{purple}
, so it will already be coloured. You can remove that and the number will be purple too. If you take that out, your definition of @seccntformat
is identical to LaTeX's one, so you can remove it altogether.
After all this the output is:
MWE:
documentclass{article}
usepackage{xcolor}
makeatletter
% renewcommand{@seccntformat}[1]{csname the#1endcsnamehspace{1em}} == default :)
renewcommand{section}{@startsection{section}{1}{z@}
{-4ex @plus -1ex @minus -.4ex}
{1ex @plus.2ex }
{normalfontlargesffamilybfseriescolor{purple}MakeUppercase}}
makeatother
begin{document}
pagestyle{empty}
section{Hello}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
end{document}
add a comment |
If you swap the order of MakeUppercase
and color{purple}
it works. Internally, the sectioning commands do (approximately) this:
<formatting>{@seccntformat{<number>} <title>}
where <formatting>
is the last argument of @startsection
, <number>
is the section number and <title>
, you guessed, the title :)
If we do like you suggested, section{hello}
becomes:
normalfontlargesffamilybfseriesMakeUppercasecolor{purple}{1 hello}
(@seccntformat
is not important right now). Try running the above and you'll see the same error. That happens because MakeUppercase
grabs color
as argument and when color
tries to do its thing it won't find the droids color name it was looking for and chaos will ensue. But if you swap the order it works :)
normalfontlargesffamilybfseriescolor{purple}MakeUppercase{1 hello}
But now you'll get another error:
! Package xcolor Error: Undefined color `PURPLE'.
but why?! Remember the @seccntformat
back then? You had:
<formatting>{@seccntformat{<number>} <title>}
when <formatting>
contains MakeUppercase
and @seccntformat
contains textcolor{purple}{<number>}
, then you have:
MakeUppercase{textcolor{purple}{<number>} <title>}
which will MakeUppercase
before textcolor
is executed:
{textcolor{PURPLE}{<NUMBER>} <TITLE>}
Yes, the NUMBER too :)
But you don't need that. The counter is used after the color{purple}
, so it will already be coloured. You can remove that and the number will be purple too. If you take that out, your definition of @seccntformat
is identical to LaTeX's one, so you can remove it altogether.
After all this the output is:
MWE:
documentclass{article}
usepackage{xcolor}
makeatletter
% renewcommand{@seccntformat}[1]{csname the#1endcsnamehspace{1em}} == default :)
renewcommand{section}{@startsection{section}{1}{z@}
{-4ex @plus -1ex @minus -.4ex}
{1ex @plus.2ex }
{normalfontlargesffamilybfseriescolor{purple}MakeUppercase}}
makeatother
begin{document}
pagestyle{empty}
section{Hello}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
end{document}
If you swap the order of MakeUppercase
and color{purple}
it works. Internally, the sectioning commands do (approximately) this:
<formatting>{@seccntformat{<number>} <title>}
where <formatting>
is the last argument of @startsection
, <number>
is the section number and <title>
, you guessed, the title :)
If we do like you suggested, section{hello}
becomes:
normalfontlargesffamilybfseriesMakeUppercasecolor{purple}{1 hello}
(@seccntformat
is not important right now). Try running the above and you'll see the same error. That happens because MakeUppercase
grabs color
as argument and when color
tries to do its thing it won't find the droids color name it was looking for and chaos will ensue. But if you swap the order it works :)
normalfontlargesffamilybfseriescolor{purple}MakeUppercase{1 hello}
But now you'll get another error:
! Package xcolor Error: Undefined color `PURPLE'.
but why?! Remember the @seccntformat
back then? You had:
<formatting>{@seccntformat{<number>} <title>}
when <formatting>
contains MakeUppercase
and @seccntformat
contains textcolor{purple}{<number>}
, then you have:
MakeUppercase{textcolor{purple}{<number>} <title>}
which will MakeUppercase
before textcolor
is executed:
{textcolor{PURPLE}{<NUMBER>} <TITLE>}
Yes, the NUMBER too :)
But you don't need that. The counter is used after the color{purple}
, so it will already be coloured. You can remove that and the number will be purple too. If you take that out, your definition of @seccntformat
is identical to LaTeX's one, so you can remove it altogether.
After all this the output is:
MWE:
documentclass{article}
usepackage{xcolor}
makeatletter
% renewcommand{@seccntformat}[1]{csname the#1endcsnamehspace{1em}} == default :)
renewcommand{section}{@startsection{section}{1}{z@}
{-4ex @plus -1ex @minus -.4ex}
{1ex @plus.2ex }
{normalfontlargesffamilybfseriescolor{purple}MakeUppercase}}
makeatother
begin{document}
pagestyle{empty}
section{Hello}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
end{document}
answered Feb 12 at 19:16
Phelype OleinikPhelype Oleinik
23.5k54586
23.5k54586
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.
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%2f474564%2fmakeuppercase-in-section-formatting%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
1
Welcome to TeX.SE! Try swapping
MakeUppercase
andcolor{purple}
on the last line:{normalfontlargesffamilybfseriescolor{purple}MakeUppercase}
. All ofnormalfont
,large
,sffamily
,bfseries
, andcolor{purple}
are switches (i.e. their effect last until the current scope ends) whileMakeUppercase
is a macro that takes one argument, so the way the sectioning commands work, the command which takes one argument must be last.– Phelype Oleinik
Feb 12 at 18:54