Having multiple section with different color which have the same environment












2















I'm having trouble changing the sections's colors. They all have the same environment rSection defined below :



newenvironment{rSection}[1]{ 
sectionskip
MakeUppercase{bf #1} % Section title
sectionlineskip
hrule % Horizontal line
begin{list}{}{
setlength{leftmargin}{1.5em}
}
item
}{
end{list}
}


But if I manage to set a specific color for this section, every sections will have the same color.. I tried



begin{rSection}{protecttextcolor{ForestGreen} Education}



but xcolor doesn't recognize this color but it does for basic text within the section..
How can I solve this ?










share|improve this question

























  • ForestGreen is a color named via dvipsnames or svgnames, so loading usepackage[dvipsnames,svgnames]{xcolor} should work. Or try PassOptionsToPackage{svgnames,dvipsnames}{xcolor} best right after documentclass{...}

    – Christian Hupfer
    Feb 1 at 22:03











  • With dvipsnames, but I successfully changed the color to ForestGreen of the text within the section. But trying to change the section's title makes xcolor not recognizing any color.. mayne because capitalized letters ?

    – Romain B.
    Feb 1 at 22:06











  • MakeUppercase is responsible for this, for upper case of ForestGreen, i.e. FORESTGREEN, which is unknown of course. You may need a different interface to your section environment, pushing the color out of the MakeUppercase argument.

    – Christian Hupfer
    Feb 1 at 22:11











  • Besides all: bf is outdated. Use bfseries instead

    – Christian Hupfer
    Feb 1 at 22:11











  • apart from uppercasing issues textcolor{ForestGreen} Education is textcolor{ForestGreen}{E}ducation and would just color E, was that intended?

    – David Carlisle
    Feb 1 at 22:19
















2















I'm having trouble changing the sections's colors. They all have the same environment rSection defined below :



newenvironment{rSection}[1]{ 
sectionskip
MakeUppercase{bf #1} % Section title
sectionlineskip
hrule % Horizontal line
begin{list}{}{
setlength{leftmargin}{1.5em}
}
item
}{
end{list}
}


But if I manage to set a specific color for this section, every sections will have the same color.. I tried



begin{rSection}{protecttextcolor{ForestGreen} Education}



but xcolor doesn't recognize this color but it does for basic text within the section..
How can I solve this ?










share|improve this question

























  • ForestGreen is a color named via dvipsnames or svgnames, so loading usepackage[dvipsnames,svgnames]{xcolor} should work. Or try PassOptionsToPackage{svgnames,dvipsnames}{xcolor} best right after documentclass{...}

    – Christian Hupfer
    Feb 1 at 22:03











  • With dvipsnames, but I successfully changed the color to ForestGreen of the text within the section. But trying to change the section's title makes xcolor not recognizing any color.. mayne because capitalized letters ?

    – Romain B.
    Feb 1 at 22:06











  • MakeUppercase is responsible for this, for upper case of ForestGreen, i.e. FORESTGREEN, which is unknown of course. You may need a different interface to your section environment, pushing the color out of the MakeUppercase argument.

    – Christian Hupfer
    Feb 1 at 22:11











  • Besides all: bf is outdated. Use bfseries instead

    – Christian Hupfer
    Feb 1 at 22:11











  • apart from uppercasing issues textcolor{ForestGreen} Education is textcolor{ForestGreen}{E}ducation and would just color E, was that intended?

    – David Carlisle
    Feb 1 at 22:19














2












2








2








I'm having trouble changing the sections's colors. They all have the same environment rSection defined below :



newenvironment{rSection}[1]{ 
sectionskip
MakeUppercase{bf #1} % Section title
sectionlineskip
hrule % Horizontal line
begin{list}{}{
setlength{leftmargin}{1.5em}
}
item
}{
end{list}
}


But if I manage to set a specific color for this section, every sections will have the same color.. I tried



begin{rSection}{protecttextcolor{ForestGreen} Education}



but xcolor doesn't recognize this color but it does for basic text within the section..
How can I solve this ?










share|improve this question
















I'm having trouble changing the sections's colors. They all have the same environment rSection defined below :



newenvironment{rSection}[1]{ 
sectionskip
MakeUppercase{bf #1} % Section title
sectionlineskip
hrule % Horizontal line
begin{list}{}{
setlength{leftmargin}{1.5em}
}
item
}{
end{list}
}


But if I manage to set a specific color for this section, every sections will have the same color.. I tried



begin{rSection}{protecttextcolor{ForestGreen} Education}



but xcolor doesn't recognize this color but it does for basic text within the section..
How can I solve this ?







sectioning color






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 1 at 22:02









Christian Hupfer

150k15198393




150k15198393










asked Feb 1 at 21:53









Romain B.Romain B.

1113




1113













  • ForestGreen is a color named via dvipsnames or svgnames, so loading usepackage[dvipsnames,svgnames]{xcolor} should work. Or try PassOptionsToPackage{svgnames,dvipsnames}{xcolor} best right after documentclass{...}

    – Christian Hupfer
    Feb 1 at 22:03











  • With dvipsnames, but I successfully changed the color to ForestGreen of the text within the section. But trying to change the section's title makes xcolor not recognizing any color.. mayne because capitalized letters ?

    – Romain B.
    Feb 1 at 22:06











  • MakeUppercase is responsible for this, for upper case of ForestGreen, i.e. FORESTGREEN, which is unknown of course. You may need a different interface to your section environment, pushing the color out of the MakeUppercase argument.

    – Christian Hupfer
    Feb 1 at 22:11











  • Besides all: bf is outdated. Use bfseries instead

    – Christian Hupfer
    Feb 1 at 22:11











  • apart from uppercasing issues textcolor{ForestGreen} Education is textcolor{ForestGreen}{E}ducation and would just color E, was that intended?

    – David Carlisle
    Feb 1 at 22:19



















  • ForestGreen is a color named via dvipsnames or svgnames, so loading usepackage[dvipsnames,svgnames]{xcolor} should work. Or try PassOptionsToPackage{svgnames,dvipsnames}{xcolor} best right after documentclass{...}

    – Christian Hupfer
    Feb 1 at 22:03











  • With dvipsnames, but I successfully changed the color to ForestGreen of the text within the section. But trying to change the section's title makes xcolor not recognizing any color.. mayne because capitalized letters ?

    – Romain B.
    Feb 1 at 22:06











  • MakeUppercase is responsible for this, for upper case of ForestGreen, i.e. FORESTGREEN, which is unknown of course. You may need a different interface to your section environment, pushing the color out of the MakeUppercase argument.

    – Christian Hupfer
    Feb 1 at 22:11











  • Besides all: bf is outdated. Use bfseries instead

    – Christian Hupfer
    Feb 1 at 22:11











  • apart from uppercasing issues textcolor{ForestGreen} Education is textcolor{ForestGreen}{E}ducation and would just color E, was that intended?

    – David Carlisle
    Feb 1 at 22:19

















ForestGreen is a color named via dvipsnames or svgnames, so loading usepackage[dvipsnames,svgnames]{xcolor} should work. Or try PassOptionsToPackage{svgnames,dvipsnames}{xcolor} best right after documentclass{...}

– Christian Hupfer
Feb 1 at 22:03





ForestGreen is a color named via dvipsnames or svgnames, so loading usepackage[dvipsnames,svgnames]{xcolor} should work. Or try PassOptionsToPackage{svgnames,dvipsnames}{xcolor} best right after documentclass{...}

– Christian Hupfer
Feb 1 at 22:03













With dvipsnames, but I successfully changed the color to ForestGreen of the text within the section. But trying to change the section's title makes xcolor not recognizing any color.. mayne because capitalized letters ?

– Romain B.
Feb 1 at 22:06





With dvipsnames, but I successfully changed the color to ForestGreen of the text within the section. But trying to change the section's title makes xcolor not recognizing any color.. mayne because capitalized letters ?

– Romain B.
Feb 1 at 22:06













MakeUppercase is responsible for this, for upper case of ForestGreen, i.e. FORESTGREEN, which is unknown of course. You may need a different interface to your section environment, pushing the color out of the MakeUppercase argument.

– Christian Hupfer
Feb 1 at 22:11





MakeUppercase is responsible for this, for upper case of ForestGreen, i.e. FORESTGREEN, which is unknown of course. You may need a different interface to your section environment, pushing the color out of the MakeUppercase argument.

– Christian Hupfer
Feb 1 at 22:11













Besides all: bf is outdated. Use bfseries instead

– Christian Hupfer
Feb 1 at 22:11





Besides all: bf is outdated. Use bfseries instead

– Christian Hupfer
Feb 1 at 22:11













apart from uppercasing issues textcolor{ForestGreen} Education is textcolor{ForestGreen}{E}ducation and would just color E, was that intended?

– David Carlisle
Feb 1 at 22:19





apart from uppercasing issues textcolor{ForestGreen} Education is textcolor{ForestGreen}{E}ducation and would just color E, was that intended?

– David Carlisle
Feb 1 at 22:19










1 Answer
1






active

oldest

votes


















2














Because you gave us no compilable code I can only guess what the commands sectionskip and sectionlineskip should do. I simply commented them in the following code.



You can define a second parameter carrying the color name for environment rSection like



newenvironment{rSection}[2]{% 
% sectionskip
color{#2}MakeUppercase{bf #1} % Section title
% sectionlineskip
hrule % Horizontal line
begin{list}{}{
setlength{leftmargin}{1.5em}
}
item
}{
end{list}
}


then you can use



begin{rSection}{Education}{ForestGreen}


to get the green color.



Please see the following compilable code:



documentclass{article}

usepackage[svgnames]{xcolor}

newenvironment{rSection}[2]{%
% sectionskip
color{#2}MakeUppercase{bf #1} % Section title
% sectionlineskip
hrule % Horizontal line
begin{list}{}{
setlength{leftmargin}{1.5em}
}
item
}{
end{list}
}


begin{document}

begin{rSection}{Education}{ForestGreen}
Text Text Text
end{rSection}

begin{rSection}{Education}{red}
Text Text Text
end{rSection}

end{document}


and its result:



resulting pdf



If your used class already defined the environment rSection simply create a new one myrSection in your preamble of your document with



newenvironment{myrSection}[2]{% 
sectionskip
color{#2}MakeUppercase{bfseries #1} % Section title
sectionlineskip
hrule % Horizontal line
begin{list}{}{
setlength{leftmargin}{1.5em}
}
item
}{
end{list}
}


and use it this way in your document:



begin{myrSection}{Education}{ForestGreen}
Text Text Text
end{myrSection}





share|improve this answer


























  • Thanks you but the whole section have the color I defined, it's not what I wanted, sorry if I was unclear about that. Thanks anway ! Solved it :)

    – Romain B.
    Feb 1 at 22:47











  • @RomainB. well, what do you want? Only Education green? Then you could use textcolor{#2}{MakeUppercase{bf #1}}. See the second pair of{} for textcolor{color}{text} ...

    – Kurt
    Feb 1 at 22:54











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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f472959%2fhaving-multiple-section-with-different-color-which-have-the-same-environment%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









2














Because you gave us no compilable code I can only guess what the commands sectionskip and sectionlineskip should do. I simply commented them in the following code.



You can define a second parameter carrying the color name for environment rSection like



newenvironment{rSection}[2]{% 
% sectionskip
color{#2}MakeUppercase{bf #1} % Section title
% sectionlineskip
hrule % Horizontal line
begin{list}{}{
setlength{leftmargin}{1.5em}
}
item
}{
end{list}
}


then you can use



begin{rSection}{Education}{ForestGreen}


to get the green color.



Please see the following compilable code:



documentclass{article}

usepackage[svgnames]{xcolor}

newenvironment{rSection}[2]{%
% sectionskip
color{#2}MakeUppercase{bf #1} % Section title
% sectionlineskip
hrule % Horizontal line
begin{list}{}{
setlength{leftmargin}{1.5em}
}
item
}{
end{list}
}


begin{document}

begin{rSection}{Education}{ForestGreen}
Text Text Text
end{rSection}

begin{rSection}{Education}{red}
Text Text Text
end{rSection}

end{document}


and its result:



resulting pdf



If your used class already defined the environment rSection simply create a new one myrSection in your preamble of your document with



newenvironment{myrSection}[2]{% 
sectionskip
color{#2}MakeUppercase{bfseries #1} % Section title
sectionlineskip
hrule % Horizontal line
begin{list}{}{
setlength{leftmargin}{1.5em}
}
item
}{
end{list}
}


and use it this way in your document:



begin{myrSection}{Education}{ForestGreen}
Text Text Text
end{myrSection}





share|improve this answer


























  • Thanks you but the whole section have the color I defined, it's not what I wanted, sorry if I was unclear about that. Thanks anway ! Solved it :)

    – Romain B.
    Feb 1 at 22:47











  • @RomainB. well, what do you want? Only Education green? Then you could use textcolor{#2}{MakeUppercase{bf #1}}. See the second pair of{} for textcolor{color}{text} ...

    – Kurt
    Feb 1 at 22:54
















2














Because you gave us no compilable code I can only guess what the commands sectionskip and sectionlineskip should do. I simply commented them in the following code.



You can define a second parameter carrying the color name for environment rSection like



newenvironment{rSection}[2]{% 
% sectionskip
color{#2}MakeUppercase{bf #1} % Section title
% sectionlineskip
hrule % Horizontal line
begin{list}{}{
setlength{leftmargin}{1.5em}
}
item
}{
end{list}
}


then you can use



begin{rSection}{Education}{ForestGreen}


to get the green color.



Please see the following compilable code:



documentclass{article}

usepackage[svgnames]{xcolor}

newenvironment{rSection}[2]{%
% sectionskip
color{#2}MakeUppercase{bf #1} % Section title
% sectionlineskip
hrule % Horizontal line
begin{list}{}{
setlength{leftmargin}{1.5em}
}
item
}{
end{list}
}


begin{document}

begin{rSection}{Education}{ForestGreen}
Text Text Text
end{rSection}

begin{rSection}{Education}{red}
Text Text Text
end{rSection}

end{document}


and its result:



resulting pdf



If your used class already defined the environment rSection simply create a new one myrSection in your preamble of your document with



newenvironment{myrSection}[2]{% 
sectionskip
color{#2}MakeUppercase{bfseries #1} % Section title
sectionlineskip
hrule % Horizontal line
begin{list}{}{
setlength{leftmargin}{1.5em}
}
item
}{
end{list}
}


and use it this way in your document:



begin{myrSection}{Education}{ForestGreen}
Text Text Text
end{myrSection}





share|improve this answer


























  • Thanks you but the whole section have the color I defined, it's not what I wanted, sorry if I was unclear about that. Thanks anway ! Solved it :)

    – Romain B.
    Feb 1 at 22:47











  • @RomainB. well, what do you want? Only Education green? Then you could use textcolor{#2}{MakeUppercase{bf #1}}. See the second pair of{} for textcolor{color}{text} ...

    – Kurt
    Feb 1 at 22:54














2












2








2







Because you gave us no compilable code I can only guess what the commands sectionskip and sectionlineskip should do. I simply commented them in the following code.



You can define a second parameter carrying the color name for environment rSection like



newenvironment{rSection}[2]{% 
% sectionskip
color{#2}MakeUppercase{bf #1} % Section title
% sectionlineskip
hrule % Horizontal line
begin{list}{}{
setlength{leftmargin}{1.5em}
}
item
}{
end{list}
}


then you can use



begin{rSection}{Education}{ForestGreen}


to get the green color.



Please see the following compilable code:



documentclass{article}

usepackage[svgnames]{xcolor}

newenvironment{rSection}[2]{%
% sectionskip
color{#2}MakeUppercase{bf #1} % Section title
% sectionlineskip
hrule % Horizontal line
begin{list}{}{
setlength{leftmargin}{1.5em}
}
item
}{
end{list}
}


begin{document}

begin{rSection}{Education}{ForestGreen}
Text Text Text
end{rSection}

begin{rSection}{Education}{red}
Text Text Text
end{rSection}

end{document}


and its result:



resulting pdf



If your used class already defined the environment rSection simply create a new one myrSection in your preamble of your document with



newenvironment{myrSection}[2]{% 
sectionskip
color{#2}MakeUppercase{bfseries #1} % Section title
sectionlineskip
hrule % Horizontal line
begin{list}{}{
setlength{leftmargin}{1.5em}
}
item
}{
end{list}
}


and use it this way in your document:



begin{myrSection}{Education}{ForestGreen}
Text Text Text
end{myrSection}





share|improve this answer















Because you gave us no compilable code I can only guess what the commands sectionskip and sectionlineskip should do. I simply commented them in the following code.



You can define a second parameter carrying the color name for environment rSection like



newenvironment{rSection}[2]{% 
% sectionskip
color{#2}MakeUppercase{bf #1} % Section title
% sectionlineskip
hrule % Horizontal line
begin{list}{}{
setlength{leftmargin}{1.5em}
}
item
}{
end{list}
}


then you can use



begin{rSection}{Education}{ForestGreen}


to get the green color.



Please see the following compilable code:



documentclass{article}

usepackage[svgnames]{xcolor}

newenvironment{rSection}[2]{%
% sectionskip
color{#2}MakeUppercase{bf #1} % Section title
% sectionlineskip
hrule % Horizontal line
begin{list}{}{
setlength{leftmargin}{1.5em}
}
item
}{
end{list}
}


begin{document}

begin{rSection}{Education}{ForestGreen}
Text Text Text
end{rSection}

begin{rSection}{Education}{red}
Text Text Text
end{rSection}

end{document}


and its result:



resulting pdf



If your used class already defined the environment rSection simply create a new one myrSection in your preamble of your document with



newenvironment{myrSection}[2]{% 
sectionskip
color{#2}MakeUppercase{bfseries #1} % Section title
sectionlineskip
hrule % Horizontal line
begin{list}{}{
setlength{leftmargin}{1.5em}
}
item
}{
end{list}
}


and use it this way in your document:



begin{myrSection}{Education}{ForestGreen}
Text Text Text
end{myrSection}






share|improve this answer














share|improve this answer



share|improve this answer








edited Feb 1 at 22:45

























answered Feb 1 at 22:21









KurtKurt

37.3k847162




37.3k847162













  • Thanks you but the whole section have the color I defined, it's not what I wanted, sorry if I was unclear about that. Thanks anway ! Solved it :)

    – Romain B.
    Feb 1 at 22:47











  • @RomainB. well, what do you want? Only Education green? Then you could use textcolor{#2}{MakeUppercase{bf #1}}. See the second pair of{} for textcolor{color}{text} ...

    – Kurt
    Feb 1 at 22:54



















  • Thanks you but the whole section have the color I defined, it's not what I wanted, sorry if I was unclear about that. Thanks anway ! Solved it :)

    – Romain B.
    Feb 1 at 22:47











  • @RomainB. well, what do you want? Only Education green? Then you could use textcolor{#2}{MakeUppercase{bf #1}}. See the second pair of{} for textcolor{color}{text} ...

    – Kurt
    Feb 1 at 22:54

















Thanks you but the whole section have the color I defined, it's not what I wanted, sorry if I was unclear about that. Thanks anway ! Solved it :)

– Romain B.
Feb 1 at 22:47





Thanks you but the whole section have the color I defined, it's not what I wanted, sorry if I was unclear about that. Thanks anway ! Solved it :)

– Romain B.
Feb 1 at 22:47













@RomainB. well, what do you want? Only Education green? Then you could use textcolor{#2}{MakeUppercase{bf #1}}. See the second pair of{} for textcolor{color}{text} ...

– Kurt
Feb 1 at 22:54





@RomainB. well, what do you want? Only Education green? Then you could use textcolor{#2}{MakeUppercase{bf #1}}. See the second pair of{} for textcolor{color}{text} ...

– Kurt
Feb 1 at 22:54


















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f472959%2fhaving-multiple-section-with-different-color-which-have-the-same-environment%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Can I use Tabulator js library in my java Spring + Thymeleaf project?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents