“environ” package and nested environments won't work












1















I'm trying to make a little style package to make some nice blocks with icons and so on. I'm using environ package + tikz. Actually the document compiles and shows me my boxes but with errors saying that some environments are not closed.



I created a "iconbox" environment with environ package that accepts some arguments (title, icon, colors...) and I want to use it to generalize some boxes: info box, danger box...



The problem begins when I want to create a new environment that uses the iconbox I've created.



If I want to use NewEnviron that calls another one, LaTeX crashes in recursion.



If I use the legacy newenvironment so LaTeX says that I didn't close the iconbox block.



And of course, I tried beginiconbox and endiconbox in start and end block but it doesn't work.



Here is a "copy/paste" that should give you the problem



documentclass{article}
usepackage[utf8]{inputenc}
usepackage[francais]{babel}
usepackage[T1]{fontenc}
usepackage{xcolor}
usepackage[tikz]{bclogo}
usepackage[framemethod=tikz]{mdframed}
usepackage{environ} % NewEnviron
usepackage{fontawesome} % font awesome icons
%Options: Sonny, Lenny, Glenn, Conny, Rejne, Bjarne, Bjornstrup
usepackage[Sonny]{fncychap}

usepackage{tikz}
usetikzlibrary{babel}
usetikzlibrary{shadows.blur}

usepackage{color}
usepackage{pbsi} % for handwriting
usepackage{bera}

definecolor{m3dorange}{HTML}{ff9966}
definecolor{m3dred}{HTML}{c9453e}
definecolor{m3dgreen}{HTML}{4f9c45}
definecolor{m3dblue}{HTML}{2499d0}

% title, icon, color, title color
NewEnviron{iconbox}[4]{%
begin{center}
begin{tikzpicture}
node [
top color=#3!10,
bottom color = white,
inner sep=2em,
rounded corners=1em,
draw=#3!60,
inner sep=1.2em,
text width=textwidth*.7,
drop shadow = {opacity=.4},
shadow yshift = -4,
shadow xshift = 4,
font=paritshape
] (frame) at (0, 0) {hspace{1.5em}textbf{bsifamily{centeringLargetextcolor{#4}{#1}}}vspace{.8em}parBODY};%
node [
shape=circle,
top color=#4!90,
bottom color=white!50,
color=white,
circular drop shadow={opacity = .7},
font=Huge,
inner sep=6pt] at (frame.north west) {centeringtextbf{#2}};
end{tikzpicture}
end{center}
}

newenvironment{danger}[1]
{begin{iconbox}{#1}{faExclamation}{m3dorange}{red}}
{end{iconbox}}
newenvironment{success}[1]
{begin{iconbox}{#1}{faStickyNoteO}{m3dgreen}{m3dgreen}}
{end{iconbox}}
newenvironment{info}[1]
{begin{iconbox}{#1}{faBookmark}{m3dblue}{m3dblue}}
{end{iconbox}}

begin{document}
begin{danger}{Warning}
You do it wrong.
end{danger}
end{document}


It generates that kind of box:



enter image description here



But... with errors...



So, how can I do ?



Thanks a lot.










share|improve this question









New contributor




Metal3d is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1





    Is there any reason why you are not using tcolorbox?

    – marmot
    5 mins ago











  • @matmot Yes, the fact is that I want to draw nodes, place element exactly where I want, and so on - I will add a preview (I don't know how you do that here, except by using a screenshot)

    – Metal3d
    4 mins ago













  • AFAIK tcolorbox does not forbid you doing this.

    – marmot
    3 mins ago











  • Take a look on the picture I've just added, this is what I expect to do. Actually the problem is not the drawing, the problem is "how to use environ package in nested environments" ;)

    – Metal3d
    25 secs ago
















1















I'm trying to make a little style package to make some nice blocks with icons and so on. I'm using environ package + tikz. Actually the document compiles and shows me my boxes but with errors saying that some environments are not closed.



I created a "iconbox" environment with environ package that accepts some arguments (title, icon, colors...) and I want to use it to generalize some boxes: info box, danger box...



The problem begins when I want to create a new environment that uses the iconbox I've created.



If I want to use NewEnviron that calls another one, LaTeX crashes in recursion.



If I use the legacy newenvironment so LaTeX says that I didn't close the iconbox block.



And of course, I tried beginiconbox and endiconbox in start and end block but it doesn't work.



Here is a "copy/paste" that should give you the problem



documentclass{article}
usepackage[utf8]{inputenc}
usepackage[francais]{babel}
usepackage[T1]{fontenc}
usepackage{xcolor}
usepackage[tikz]{bclogo}
usepackage[framemethod=tikz]{mdframed}
usepackage{environ} % NewEnviron
usepackage{fontawesome} % font awesome icons
%Options: Sonny, Lenny, Glenn, Conny, Rejne, Bjarne, Bjornstrup
usepackage[Sonny]{fncychap}

usepackage{tikz}
usetikzlibrary{babel}
usetikzlibrary{shadows.blur}

usepackage{color}
usepackage{pbsi} % for handwriting
usepackage{bera}

definecolor{m3dorange}{HTML}{ff9966}
definecolor{m3dred}{HTML}{c9453e}
definecolor{m3dgreen}{HTML}{4f9c45}
definecolor{m3dblue}{HTML}{2499d0}

% title, icon, color, title color
NewEnviron{iconbox}[4]{%
begin{center}
begin{tikzpicture}
node [
top color=#3!10,
bottom color = white,
inner sep=2em,
rounded corners=1em,
draw=#3!60,
inner sep=1.2em,
text width=textwidth*.7,
drop shadow = {opacity=.4},
shadow yshift = -4,
shadow xshift = 4,
font=paritshape
] (frame) at (0, 0) {hspace{1.5em}textbf{bsifamily{centeringLargetextcolor{#4}{#1}}}vspace{.8em}parBODY};%
node [
shape=circle,
top color=#4!90,
bottom color=white!50,
color=white,
circular drop shadow={opacity = .7},
font=Huge,
inner sep=6pt] at (frame.north west) {centeringtextbf{#2}};
end{tikzpicture}
end{center}
}

newenvironment{danger}[1]
{begin{iconbox}{#1}{faExclamation}{m3dorange}{red}}
{end{iconbox}}
newenvironment{success}[1]
{begin{iconbox}{#1}{faStickyNoteO}{m3dgreen}{m3dgreen}}
{end{iconbox}}
newenvironment{info}[1]
{begin{iconbox}{#1}{faBookmark}{m3dblue}{m3dblue}}
{end{iconbox}}

begin{document}
begin{danger}{Warning}
You do it wrong.
end{danger}
end{document}


It generates that kind of box:



enter image description here



But... with errors...



So, how can I do ?



Thanks a lot.










share|improve this question









New contributor




Metal3d is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1





    Is there any reason why you are not using tcolorbox?

    – marmot
    5 mins ago











  • @matmot Yes, the fact is that I want to draw nodes, place element exactly where I want, and so on - I will add a preview (I don't know how you do that here, except by using a screenshot)

    – Metal3d
    4 mins ago













  • AFAIK tcolorbox does not forbid you doing this.

    – marmot
    3 mins ago











  • Take a look on the picture I've just added, this is what I expect to do. Actually the problem is not the drawing, the problem is "how to use environ package in nested environments" ;)

    – Metal3d
    25 secs ago














1












1








1








I'm trying to make a little style package to make some nice blocks with icons and so on. I'm using environ package + tikz. Actually the document compiles and shows me my boxes but with errors saying that some environments are not closed.



I created a "iconbox" environment with environ package that accepts some arguments (title, icon, colors...) and I want to use it to generalize some boxes: info box, danger box...



The problem begins when I want to create a new environment that uses the iconbox I've created.



If I want to use NewEnviron that calls another one, LaTeX crashes in recursion.



If I use the legacy newenvironment so LaTeX says that I didn't close the iconbox block.



And of course, I tried beginiconbox and endiconbox in start and end block but it doesn't work.



Here is a "copy/paste" that should give you the problem



documentclass{article}
usepackage[utf8]{inputenc}
usepackage[francais]{babel}
usepackage[T1]{fontenc}
usepackage{xcolor}
usepackage[tikz]{bclogo}
usepackage[framemethod=tikz]{mdframed}
usepackage{environ} % NewEnviron
usepackage{fontawesome} % font awesome icons
%Options: Sonny, Lenny, Glenn, Conny, Rejne, Bjarne, Bjornstrup
usepackage[Sonny]{fncychap}

usepackage{tikz}
usetikzlibrary{babel}
usetikzlibrary{shadows.blur}

usepackage{color}
usepackage{pbsi} % for handwriting
usepackage{bera}

definecolor{m3dorange}{HTML}{ff9966}
definecolor{m3dred}{HTML}{c9453e}
definecolor{m3dgreen}{HTML}{4f9c45}
definecolor{m3dblue}{HTML}{2499d0}

% title, icon, color, title color
NewEnviron{iconbox}[4]{%
begin{center}
begin{tikzpicture}
node [
top color=#3!10,
bottom color = white,
inner sep=2em,
rounded corners=1em,
draw=#3!60,
inner sep=1.2em,
text width=textwidth*.7,
drop shadow = {opacity=.4},
shadow yshift = -4,
shadow xshift = 4,
font=paritshape
] (frame) at (0, 0) {hspace{1.5em}textbf{bsifamily{centeringLargetextcolor{#4}{#1}}}vspace{.8em}parBODY};%
node [
shape=circle,
top color=#4!90,
bottom color=white!50,
color=white,
circular drop shadow={opacity = .7},
font=Huge,
inner sep=6pt] at (frame.north west) {centeringtextbf{#2}};
end{tikzpicture}
end{center}
}

newenvironment{danger}[1]
{begin{iconbox}{#1}{faExclamation}{m3dorange}{red}}
{end{iconbox}}
newenvironment{success}[1]
{begin{iconbox}{#1}{faStickyNoteO}{m3dgreen}{m3dgreen}}
{end{iconbox}}
newenvironment{info}[1]
{begin{iconbox}{#1}{faBookmark}{m3dblue}{m3dblue}}
{end{iconbox}}

begin{document}
begin{danger}{Warning}
You do it wrong.
end{danger}
end{document}


It generates that kind of box:



enter image description here



But... with errors...



So, how can I do ?



Thanks a lot.










share|improve this question









New contributor




Metal3d is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I'm trying to make a little style package to make some nice blocks with icons and so on. I'm using environ package + tikz. Actually the document compiles and shows me my boxes but with errors saying that some environments are not closed.



I created a "iconbox" environment with environ package that accepts some arguments (title, icon, colors...) and I want to use it to generalize some boxes: info box, danger box...



The problem begins when I want to create a new environment that uses the iconbox I've created.



If I want to use NewEnviron that calls another one, LaTeX crashes in recursion.



If I use the legacy newenvironment so LaTeX says that I didn't close the iconbox block.



And of course, I tried beginiconbox and endiconbox in start and end block but it doesn't work.



Here is a "copy/paste" that should give you the problem



documentclass{article}
usepackage[utf8]{inputenc}
usepackage[francais]{babel}
usepackage[T1]{fontenc}
usepackage{xcolor}
usepackage[tikz]{bclogo}
usepackage[framemethod=tikz]{mdframed}
usepackage{environ} % NewEnviron
usepackage{fontawesome} % font awesome icons
%Options: Sonny, Lenny, Glenn, Conny, Rejne, Bjarne, Bjornstrup
usepackage[Sonny]{fncychap}

usepackage{tikz}
usetikzlibrary{babel}
usetikzlibrary{shadows.blur}

usepackage{color}
usepackage{pbsi} % for handwriting
usepackage{bera}

definecolor{m3dorange}{HTML}{ff9966}
definecolor{m3dred}{HTML}{c9453e}
definecolor{m3dgreen}{HTML}{4f9c45}
definecolor{m3dblue}{HTML}{2499d0}

% title, icon, color, title color
NewEnviron{iconbox}[4]{%
begin{center}
begin{tikzpicture}
node [
top color=#3!10,
bottom color = white,
inner sep=2em,
rounded corners=1em,
draw=#3!60,
inner sep=1.2em,
text width=textwidth*.7,
drop shadow = {opacity=.4},
shadow yshift = -4,
shadow xshift = 4,
font=paritshape
] (frame) at (0, 0) {hspace{1.5em}textbf{bsifamily{centeringLargetextcolor{#4}{#1}}}vspace{.8em}parBODY};%
node [
shape=circle,
top color=#4!90,
bottom color=white!50,
color=white,
circular drop shadow={opacity = .7},
font=Huge,
inner sep=6pt] at (frame.north west) {centeringtextbf{#2}};
end{tikzpicture}
end{center}
}

newenvironment{danger}[1]
{begin{iconbox}{#1}{faExclamation}{m3dorange}{red}}
{end{iconbox}}
newenvironment{success}[1]
{begin{iconbox}{#1}{faStickyNoteO}{m3dgreen}{m3dgreen}}
{end{iconbox}}
newenvironment{info}[1]
{begin{iconbox}{#1}{faBookmark}{m3dblue}{m3dblue}}
{end{iconbox}}

begin{document}
begin{danger}{Warning}
You do it wrong.
end{danger}
end{document}


It generates that kind of box:



enter image description here



But... with errors...



So, how can I do ?



Thanks a lot.







environments nesting






share|improve this question









New contributor




Metal3d is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Metal3d is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 1 min ago







Metal3d













New contributor




Metal3d is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 11 mins ago









Metal3dMetal3d

1063




1063




New contributor




Metal3d is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Metal3d is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Metal3d is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 1





    Is there any reason why you are not using tcolorbox?

    – marmot
    5 mins ago











  • @matmot Yes, the fact is that I want to draw nodes, place element exactly where I want, and so on - I will add a preview (I don't know how you do that here, except by using a screenshot)

    – Metal3d
    4 mins ago













  • AFAIK tcolorbox does not forbid you doing this.

    – marmot
    3 mins ago











  • Take a look on the picture I've just added, this is what I expect to do. Actually the problem is not the drawing, the problem is "how to use environ package in nested environments" ;)

    – Metal3d
    25 secs ago














  • 1





    Is there any reason why you are not using tcolorbox?

    – marmot
    5 mins ago











  • @matmot Yes, the fact is that I want to draw nodes, place element exactly where I want, and so on - I will add a preview (I don't know how you do that here, except by using a screenshot)

    – Metal3d
    4 mins ago













  • AFAIK tcolorbox does not forbid you doing this.

    – marmot
    3 mins ago











  • Take a look on the picture I've just added, this is what I expect to do. Actually the problem is not the drawing, the problem is "how to use environ package in nested environments" ;)

    – Metal3d
    25 secs ago








1




1





Is there any reason why you are not using tcolorbox?

– marmot
5 mins ago





Is there any reason why you are not using tcolorbox?

– marmot
5 mins ago













@matmot Yes, the fact is that I want to draw nodes, place element exactly where I want, and so on - I will add a preview (I don't know how you do that here, except by using a screenshot)

– Metal3d
4 mins ago







@matmot Yes, the fact is that I want to draw nodes, place element exactly where I want, and so on - I will add a preview (I don't know how you do that here, except by using a screenshot)

– Metal3d
4 mins ago















AFAIK tcolorbox does not forbid you doing this.

– marmot
3 mins ago





AFAIK tcolorbox does not forbid you doing this.

– marmot
3 mins ago













Take a look on the picture I've just added, this is what I expect to do. Actually the problem is not the drawing, the problem is "how to use environ package in nested environments" ;)

– Metal3d
25 secs ago





Take a look on the picture I've just added, this is what I expect to do. Actually the problem is not the drawing, the problem is "how to use environ package in nested environments" ;)

– Metal3d
25 secs ago










0






active

oldest

votes











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


}
});






Metal3d is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f474449%2fenviron-package-and-nested-environments-wont-work%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes








Metal3d is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















Metal3d is a new contributor. Be nice, and check out our Code of Conduct.













Metal3d is a new contributor. Be nice, and check out our Code of Conduct.












Metal3d is a new contributor. Be nice, and check out our Code of Conduct.
















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%2f474449%2fenviron-package-and-nested-environments-wont-work%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

Entries order in /etc/network/interfaces

新発田市

Grub takes very long (several minutes) to open Menu (in Multi-Boot-System)