“environ” package and nested environments won't work












0















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{book}
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}
usetikzlibrary{shadows.blur}

usepackage{color}
usepackage{pbsi} % for handwriting
%usepackage{gfsartemisia-euler} % default font
%usepackage[default]{raleway}
%usepackage{noto}
%usepackage{newpxtext,newpxmath}
usepackage{bera}
%usepackage{DejaVuSerif}

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}








share







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.

























    0















    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{book}
    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}
    usetikzlibrary{shadows.blur}

    usepackage{color}
    usepackage{pbsi} % for handwriting
    %usepackage{gfsartemisia-euler} % default font
    %usepackage[default]{raleway}
    %usepackage{noto}
    %usepackage{newpxtext,newpxmath}
    usepackage{bera}
    %usepackage{DejaVuSerif}

    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}








    share







    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.























      0












      0








      0








      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{book}
      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}
      usetikzlibrary{shadows.blur}

      usepackage{color}
      usepackage{pbsi} % for handwriting
      %usepackage{gfsartemisia-euler} % default font
      %usepackage[default]{raleway}
      %usepackage{noto}
      %usepackage{newpxtext,newpxmath}
      usepackage{bera}
      %usepackage{DejaVuSerif}

      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}








      share







      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{book}
      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}
      usetikzlibrary{shadows.blur}

      usepackage{color}
      usepackage{pbsi} % for handwriting
      %usepackage{gfsartemisia-euler} % default font
      %usepackage[default]{raleway}
      %usepackage{noto}
      %usepackage{newpxtext,newpxmath}
      usepackage{bera}
      %usepackage{DejaVuSerif}

      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}






      environments nesting





      share







      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







      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



      share






      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 3 mins ago









      Metal3dMetal3d

      1012




      1012




      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.






















          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

          Lallio

          Futebolista

          Jornalista