How to make a bracketed environment like this?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
6
down vote

favorite
3












I'm hoping to write a custom environment for a double-bracketed "key point" section (see image below). The left and right brackets should be as tall as the text and there should be a little icon with title and text, exactly like in the following example:



enter image description here



Not sure where to start.










share|improve this question

















  • 4




    Welcome to TeX.SE! I'd like to encourage you to look at the tcolorbox package.
    – marmot
    Sep 24 at 20:49














up vote
6
down vote

favorite
3












I'm hoping to write a custom environment for a double-bracketed "key point" section (see image below). The left and right brackets should be as tall as the text and there should be a little icon with title and text, exactly like in the following example:



enter image description here



Not sure where to start.










share|improve this question

















  • 4




    Welcome to TeX.SE! I'd like to encourage you to look at the tcolorbox package.
    – marmot
    Sep 24 at 20:49












up vote
6
down vote

favorite
3









up vote
6
down vote

favorite
3






3





I'm hoping to write a custom environment for a double-bracketed "key point" section (see image below). The left and right brackets should be as tall as the text and there should be a little icon with title and text, exactly like in the following example:



enter image description here



Not sure where to start.










share|improve this question













I'm hoping to write a custom environment for a double-bracketed "key point" section (see image below). The left and right brackets should be as tall as the text and there should be a little icon with title and text, exactly like in the following example:



enter image description here



Not sure where to start.







tikz-pgf macros environments






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 24 at 20:45









user5601

1333




1333







  • 4




    Welcome to TeX.SE! I'd like to encourage you to look at the tcolorbox package.
    – marmot
    Sep 24 at 20:49












  • 4




    Welcome to TeX.SE! I'd like to encourage you to look at the tcolorbox package.
    – marmot
    Sep 24 at 20:49







4




4




Welcome to TeX.SE! I'd like to encourage you to look at the tcolorbox package.
– marmot
Sep 24 at 20:49




Welcome to TeX.SE! I'd like to encourage you to look at the tcolorbox package.
– marmot
Sep 24 at 20:49










2 Answers
2






active

oldest

votes

















up vote
12
down vote



accepted










Just for fun: a tcolorbox based answer.



documentclassarticle
usepackage[most]tcolorbox
usepackagelipsum
newtcolorboxlbulbox[1]enhanced,
colback=white,
boxrule=0mm,top=0mm,bottom=0mm,left=2cm,right=4mm,sharp corners,
overlay=%
draw[ultra thick] ([xshift=2mm]frame.north west)-

begindocument
lipsum[1]
beginlbulbox
textbfNew- and old-style classes.par
Old-style classes have only human students. In new-style classes, ducks, koalas
and marmots are welcome. Hibernation needs of marmot students are respected.
endlbulbox
lipsum[2]
enddocument


enter image description here






share|improve this answer



























    up vote
    8
    down vote













    The following is a quick implementation of what you want without any packages. The syntax is quick and dirty and a mixture of LaTeX and TeX syntax. Every aspect of the environment should be adjustable if you change the used lengths and macros (every one should be commented to make clear what it's used for).



    documentclassarticle

    usepackagegraphicx

    makeatletter
    newcommandBracket@head[1]textbf#1 % format the heading
    % store the icon
    newsaveboxBracket@icon
    setboxBracket@iconhboxincludegraphics[width=1cm]example-image-duck
    % the vertical displacement of the icon from the centre of the contents
    newlengthBracket@iconOffset
    Bracket@iconOffset0pt
    % store the contents of the environment
    newsaveboxBracket@box
    % the width it should take as a macro so that the width is evaluated when used,
    % this should provide more flexibility
    newcommandBracket@totwidth.95linewidth
    % the actual contents width (gets calculated)
    newlengthBracket@width
    % the vertical amount of space the brackets are taller than their contents
    newlengthBracket@vpad
    Bracket@vpad5mm
    % the width of the horizontal rules of the brackets
    newlengthBracket@length
    Bracket@length5mm
    % the thickness of the bracket rules
    newlengthBracket@linewidth
    Bracket@linewidth2pt
    % the amount of white space between the left bracket and the logo
    newlengthBracket@hpadLeft
    Bracket@hpadLeft2.5mm
    % the amount of white space between the logo and the contents
    newlengthBracket@hpadIcon
    Bracket@hpadIcon2.5mm
    % the amount of white space between the right bracket and the contents
    newlengthBracket@hpadRight
    Bracket@hpadRight5mm
    % the vertical white space added above the whole environment
    newlengthBracket@aboveSkip
    Bracket@aboveSkip1ex
    % the vertical white space added below the whole environment
    newlengthBracket@belowSkip
    Bracket@belowSkip1ex
    % the definition of the environment
    newenvironmentBracket[1]
    %
    Bracket@widthBracket@totwidth
    advanceBracket@width-Bracket@hpadRight
    advanceBracket@width-Bracket@hpadLeft
    advanceBracket@width-Bracket@hpadIcon
    advanceBracket@width-wdBracket@icon
    advanceBracket@width-2Bracket@linewidth
    setboxBracket@boxvboxbgroup
    hsizeBracket@width
    linewidthhsize
    noindent
    Bracket@head#1par
    @afterindentfalse
    @afterheading

    %
    egroup
    par
    vskipBracket@aboveSkip
    noindent
    null
    hskipdimexpr(linewidth-Bracket@totwidth)/2relax
    rlap
    %
    vrule height dimexprhtBracket@box+Bracket@vpad
    depth dimexprdpBracket@box+Bracket@vpad
    width Bracket@linewidth
    rlap
    %
    rlap
    %
    raiseboxdimexprhtBracket@box+Bracket@vpadrelax
    %
    vrule height 0pt
    depth Bracket@linewidth
    width Bracket@length
    %
    %
    raisebox-dimexprdpBracket@box+Bracket@vpadrelax
    %
    vrule height Bracket@linewidth
    depth 0pt
    width Bracket@length
    %
    %
    hskipBracket@hpadLeft
    raisebox
    %
    dimexpr
    .5htBracket@box-.5dpBracket@box
    -.5htBracket@icon+.5dpBracket@icon
    +Bracket@iconOffset
    relax

    useboxBracket@icon%
    hskipBracket@hpadIcon
    useboxBracket@box
    hskipBracket@hpadRight
    vrule height dimexprhtBracket@box+Bracket@vpad
    depth dimexprdpBracket@box+Bracket@vpad
    width Bracket@linewidth
    rlap
    %
    hskip-Bracket@linewidth
    llap
    %
    raiseboxdimexprhtBracket@box+Bracket@vpadrelax
    %
    vrule height 0pt
    depth Bracket@linewidth
    width Bracket@length
    %
    %
    llap
    %
    raisebox-dimexprdpBracket@box+Bracket@vpadrelax
    %
    vrule height Bracket@linewidth
    depth 0pt
    width Bracket@length
    %
    %
    %
    %
    par
    vskipBracket@belowSkip

    makeatother

    usepackageduckuments% only for blindduck

    begindocument
    blindduck[1]
    beginBracketNew- and old-style classes
    blindduck[2]
    endBracket
    noindent
    blindduck[3]
    enddocument


    enter image description here



    EDIT: Allows a total width greater than the surrounding linewidth without overfull boxes.



    I should mention that the result is not page breakable. If this is required, tcolorbox can be page broken if set up correctly, so take a look at @marmot's answer (this doesn't claim that the way @marmot set up tcolorbox is page breakable, I didn't check this, so it might be breakable, but might as well be not).






    share|improve this answer






















      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',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      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%2f452329%2fhow-to-make-a-bracketed-environment-like-this%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      12
      down vote



      accepted










      Just for fun: a tcolorbox based answer.



      documentclassarticle
      usepackage[most]tcolorbox
      usepackagelipsum
      newtcolorboxlbulbox[1]enhanced,
      colback=white,
      boxrule=0mm,top=0mm,bottom=0mm,left=2cm,right=4mm,sharp corners,
      overlay=%
      draw[ultra thick] ([xshift=2mm]frame.north west)-

      begindocument
      lipsum[1]
      beginlbulbox
      textbfNew- and old-style classes.par
      Old-style classes have only human students. In new-style classes, ducks, koalas
      and marmots are welcome. Hibernation needs of marmot students are respected.
      endlbulbox
      lipsum[2]
      enddocument


      enter image description here






      share|improve this answer
























        up vote
        12
        down vote



        accepted










        Just for fun: a tcolorbox based answer.



        documentclassarticle
        usepackage[most]tcolorbox
        usepackagelipsum
        newtcolorboxlbulbox[1]enhanced,
        colback=white,
        boxrule=0mm,top=0mm,bottom=0mm,left=2cm,right=4mm,sharp corners,
        overlay=%
        draw[ultra thick] ([xshift=2mm]frame.north west)-

        begindocument
        lipsum[1]
        beginlbulbox
        textbfNew- and old-style classes.par
        Old-style classes have only human students. In new-style classes, ducks, koalas
        and marmots are welcome. Hibernation needs of marmot students are respected.
        endlbulbox
        lipsum[2]
        enddocument


        enter image description here






        share|improve this answer






















          up vote
          12
          down vote



          accepted







          up vote
          12
          down vote



          accepted






          Just for fun: a tcolorbox based answer.



          documentclassarticle
          usepackage[most]tcolorbox
          usepackagelipsum
          newtcolorboxlbulbox[1]enhanced,
          colback=white,
          boxrule=0mm,top=0mm,bottom=0mm,left=2cm,right=4mm,sharp corners,
          overlay=%
          draw[ultra thick] ([xshift=2mm]frame.north west)-

          begindocument
          lipsum[1]
          beginlbulbox
          textbfNew- and old-style classes.par
          Old-style classes have only human students. In new-style classes, ducks, koalas
          and marmots are welcome. Hibernation needs of marmot students are respected.
          endlbulbox
          lipsum[2]
          enddocument


          enter image description here






          share|improve this answer












          Just for fun: a tcolorbox based answer.



          documentclassarticle
          usepackage[most]tcolorbox
          usepackagelipsum
          newtcolorboxlbulbox[1]enhanced,
          colback=white,
          boxrule=0mm,top=0mm,bottom=0mm,left=2cm,right=4mm,sharp corners,
          overlay=%
          draw[ultra thick] ([xshift=2mm]frame.north west)-

          begindocument
          lipsum[1]
          beginlbulbox
          textbfNew- and old-style classes.par
          Old-style classes have only human students. In new-style classes, ducks, koalas
          and marmots are welcome. Hibernation needs of marmot students are respected.
          endlbulbox
          lipsum[2]
          enddocument


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 25 at 0:50









          marmot

          62.7k468135




          62.7k468135




















              up vote
              8
              down vote













              The following is a quick implementation of what you want without any packages. The syntax is quick and dirty and a mixture of LaTeX and TeX syntax. Every aspect of the environment should be adjustable if you change the used lengths and macros (every one should be commented to make clear what it's used for).



              documentclassarticle

              usepackagegraphicx

              makeatletter
              newcommandBracket@head[1]textbf#1 % format the heading
              % store the icon
              newsaveboxBracket@icon
              setboxBracket@iconhboxincludegraphics[width=1cm]example-image-duck
              % the vertical displacement of the icon from the centre of the contents
              newlengthBracket@iconOffset
              Bracket@iconOffset0pt
              % store the contents of the environment
              newsaveboxBracket@box
              % the width it should take as a macro so that the width is evaluated when used,
              % this should provide more flexibility
              newcommandBracket@totwidth.95linewidth
              % the actual contents width (gets calculated)
              newlengthBracket@width
              % the vertical amount of space the brackets are taller than their contents
              newlengthBracket@vpad
              Bracket@vpad5mm
              % the width of the horizontal rules of the brackets
              newlengthBracket@length
              Bracket@length5mm
              % the thickness of the bracket rules
              newlengthBracket@linewidth
              Bracket@linewidth2pt
              % the amount of white space between the left bracket and the logo
              newlengthBracket@hpadLeft
              Bracket@hpadLeft2.5mm
              % the amount of white space between the logo and the contents
              newlengthBracket@hpadIcon
              Bracket@hpadIcon2.5mm
              % the amount of white space between the right bracket and the contents
              newlengthBracket@hpadRight
              Bracket@hpadRight5mm
              % the vertical white space added above the whole environment
              newlengthBracket@aboveSkip
              Bracket@aboveSkip1ex
              % the vertical white space added below the whole environment
              newlengthBracket@belowSkip
              Bracket@belowSkip1ex
              % the definition of the environment
              newenvironmentBracket[1]
              %
              Bracket@widthBracket@totwidth
              advanceBracket@width-Bracket@hpadRight
              advanceBracket@width-Bracket@hpadLeft
              advanceBracket@width-Bracket@hpadIcon
              advanceBracket@width-wdBracket@icon
              advanceBracket@width-2Bracket@linewidth
              setboxBracket@boxvboxbgroup
              hsizeBracket@width
              linewidthhsize
              noindent
              Bracket@head#1par
              @afterindentfalse
              @afterheading

              %
              egroup
              par
              vskipBracket@aboveSkip
              noindent
              null
              hskipdimexpr(linewidth-Bracket@totwidth)/2relax
              rlap
              %
              vrule height dimexprhtBracket@box+Bracket@vpad
              depth dimexprdpBracket@box+Bracket@vpad
              width Bracket@linewidth
              rlap
              %
              rlap
              %
              raiseboxdimexprhtBracket@box+Bracket@vpadrelax
              %
              vrule height 0pt
              depth Bracket@linewidth
              width Bracket@length
              %
              %
              raisebox-dimexprdpBracket@box+Bracket@vpadrelax
              %
              vrule height Bracket@linewidth
              depth 0pt
              width Bracket@length
              %
              %
              hskipBracket@hpadLeft
              raisebox
              %
              dimexpr
              .5htBracket@box-.5dpBracket@box
              -.5htBracket@icon+.5dpBracket@icon
              +Bracket@iconOffset
              relax

              useboxBracket@icon%
              hskipBracket@hpadIcon
              useboxBracket@box
              hskipBracket@hpadRight
              vrule height dimexprhtBracket@box+Bracket@vpad
              depth dimexprdpBracket@box+Bracket@vpad
              width Bracket@linewidth
              rlap
              %
              hskip-Bracket@linewidth
              llap
              %
              raiseboxdimexprhtBracket@box+Bracket@vpadrelax
              %
              vrule height 0pt
              depth Bracket@linewidth
              width Bracket@length
              %
              %
              llap
              %
              raisebox-dimexprdpBracket@box+Bracket@vpadrelax
              %
              vrule height Bracket@linewidth
              depth 0pt
              width Bracket@length
              %
              %
              %
              %
              par
              vskipBracket@belowSkip

              makeatother

              usepackageduckuments% only for blindduck

              begindocument
              blindduck[1]
              beginBracketNew- and old-style classes
              blindduck[2]
              endBracket
              noindent
              blindduck[3]
              enddocument


              enter image description here



              EDIT: Allows a total width greater than the surrounding linewidth without overfull boxes.



              I should mention that the result is not page breakable. If this is required, tcolorbox can be page broken if set up correctly, so take a look at @marmot's answer (this doesn't claim that the way @marmot set up tcolorbox is page breakable, I didn't check this, so it might be breakable, but might as well be not).






              share|improve this answer


























                up vote
                8
                down vote













                The following is a quick implementation of what you want without any packages. The syntax is quick and dirty and a mixture of LaTeX and TeX syntax. Every aspect of the environment should be adjustable if you change the used lengths and macros (every one should be commented to make clear what it's used for).



                documentclassarticle

                usepackagegraphicx

                makeatletter
                newcommandBracket@head[1]textbf#1 % format the heading
                % store the icon
                newsaveboxBracket@icon
                setboxBracket@iconhboxincludegraphics[width=1cm]example-image-duck
                % the vertical displacement of the icon from the centre of the contents
                newlengthBracket@iconOffset
                Bracket@iconOffset0pt
                % store the contents of the environment
                newsaveboxBracket@box
                % the width it should take as a macro so that the width is evaluated when used,
                % this should provide more flexibility
                newcommandBracket@totwidth.95linewidth
                % the actual contents width (gets calculated)
                newlengthBracket@width
                % the vertical amount of space the brackets are taller than their contents
                newlengthBracket@vpad
                Bracket@vpad5mm
                % the width of the horizontal rules of the brackets
                newlengthBracket@length
                Bracket@length5mm
                % the thickness of the bracket rules
                newlengthBracket@linewidth
                Bracket@linewidth2pt
                % the amount of white space between the left bracket and the logo
                newlengthBracket@hpadLeft
                Bracket@hpadLeft2.5mm
                % the amount of white space between the logo and the contents
                newlengthBracket@hpadIcon
                Bracket@hpadIcon2.5mm
                % the amount of white space between the right bracket and the contents
                newlengthBracket@hpadRight
                Bracket@hpadRight5mm
                % the vertical white space added above the whole environment
                newlengthBracket@aboveSkip
                Bracket@aboveSkip1ex
                % the vertical white space added below the whole environment
                newlengthBracket@belowSkip
                Bracket@belowSkip1ex
                % the definition of the environment
                newenvironmentBracket[1]
                %
                Bracket@widthBracket@totwidth
                advanceBracket@width-Bracket@hpadRight
                advanceBracket@width-Bracket@hpadLeft
                advanceBracket@width-Bracket@hpadIcon
                advanceBracket@width-wdBracket@icon
                advanceBracket@width-2Bracket@linewidth
                setboxBracket@boxvboxbgroup
                hsizeBracket@width
                linewidthhsize
                noindent
                Bracket@head#1par
                @afterindentfalse
                @afterheading

                %
                egroup
                par
                vskipBracket@aboveSkip
                noindent
                null
                hskipdimexpr(linewidth-Bracket@totwidth)/2relax
                rlap
                %
                vrule height dimexprhtBracket@box+Bracket@vpad
                depth dimexprdpBracket@box+Bracket@vpad
                width Bracket@linewidth
                rlap
                %
                rlap
                %
                raiseboxdimexprhtBracket@box+Bracket@vpadrelax
                %
                vrule height 0pt
                depth Bracket@linewidth
                width Bracket@length
                %
                %
                raisebox-dimexprdpBracket@box+Bracket@vpadrelax
                %
                vrule height Bracket@linewidth
                depth 0pt
                width Bracket@length
                %
                %
                hskipBracket@hpadLeft
                raisebox
                %
                dimexpr
                .5htBracket@box-.5dpBracket@box
                -.5htBracket@icon+.5dpBracket@icon
                +Bracket@iconOffset
                relax

                useboxBracket@icon%
                hskipBracket@hpadIcon
                useboxBracket@box
                hskipBracket@hpadRight
                vrule height dimexprhtBracket@box+Bracket@vpad
                depth dimexprdpBracket@box+Bracket@vpad
                width Bracket@linewidth
                rlap
                %
                hskip-Bracket@linewidth
                llap
                %
                raiseboxdimexprhtBracket@box+Bracket@vpadrelax
                %
                vrule height 0pt
                depth Bracket@linewidth
                width Bracket@length
                %
                %
                llap
                %
                raisebox-dimexprdpBracket@box+Bracket@vpadrelax
                %
                vrule height Bracket@linewidth
                depth 0pt
                width Bracket@length
                %
                %
                %
                %
                par
                vskipBracket@belowSkip

                makeatother

                usepackageduckuments% only for blindduck

                begindocument
                blindduck[1]
                beginBracketNew- and old-style classes
                blindduck[2]
                endBracket
                noindent
                blindduck[3]
                enddocument


                enter image description here



                EDIT: Allows a total width greater than the surrounding linewidth without overfull boxes.



                I should mention that the result is not page breakable. If this is required, tcolorbox can be page broken if set up correctly, so take a look at @marmot's answer (this doesn't claim that the way @marmot set up tcolorbox is page breakable, I didn't check this, so it might be breakable, but might as well be not).






                share|improve this answer
























                  up vote
                  8
                  down vote










                  up vote
                  8
                  down vote









                  The following is a quick implementation of what you want without any packages. The syntax is quick and dirty and a mixture of LaTeX and TeX syntax. Every aspect of the environment should be adjustable if you change the used lengths and macros (every one should be commented to make clear what it's used for).



                  documentclassarticle

                  usepackagegraphicx

                  makeatletter
                  newcommandBracket@head[1]textbf#1 % format the heading
                  % store the icon
                  newsaveboxBracket@icon
                  setboxBracket@iconhboxincludegraphics[width=1cm]example-image-duck
                  % the vertical displacement of the icon from the centre of the contents
                  newlengthBracket@iconOffset
                  Bracket@iconOffset0pt
                  % store the contents of the environment
                  newsaveboxBracket@box
                  % the width it should take as a macro so that the width is evaluated when used,
                  % this should provide more flexibility
                  newcommandBracket@totwidth.95linewidth
                  % the actual contents width (gets calculated)
                  newlengthBracket@width
                  % the vertical amount of space the brackets are taller than their contents
                  newlengthBracket@vpad
                  Bracket@vpad5mm
                  % the width of the horizontal rules of the brackets
                  newlengthBracket@length
                  Bracket@length5mm
                  % the thickness of the bracket rules
                  newlengthBracket@linewidth
                  Bracket@linewidth2pt
                  % the amount of white space between the left bracket and the logo
                  newlengthBracket@hpadLeft
                  Bracket@hpadLeft2.5mm
                  % the amount of white space between the logo and the contents
                  newlengthBracket@hpadIcon
                  Bracket@hpadIcon2.5mm
                  % the amount of white space between the right bracket and the contents
                  newlengthBracket@hpadRight
                  Bracket@hpadRight5mm
                  % the vertical white space added above the whole environment
                  newlengthBracket@aboveSkip
                  Bracket@aboveSkip1ex
                  % the vertical white space added below the whole environment
                  newlengthBracket@belowSkip
                  Bracket@belowSkip1ex
                  % the definition of the environment
                  newenvironmentBracket[1]
                  %
                  Bracket@widthBracket@totwidth
                  advanceBracket@width-Bracket@hpadRight
                  advanceBracket@width-Bracket@hpadLeft
                  advanceBracket@width-Bracket@hpadIcon
                  advanceBracket@width-wdBracket@icon
                  advanceBracket@width-2Bracket@linewidth
                  setboxBracket@boxvboxbgroup
                  hsizeBracket@width
                  linewidthhsize
                  noindent
                  Bracket@head#1par
                  @afterindentfalse
                  @afterheading

                  %
                  egroup
                  par
                  vskipBracket@aboveSkip
                  noindent
                  null
                  hskipdimexpr(linewidth-Bracket@totwidth)/2relax
                  rlap
                  %
                  vrule height dimexprhtBracket@box+Bracket@vpad
                  depth dimexprdpBracket@box+Bracket@vpad
                  width Bracket@linewidth
                  rlap
                  %
                  rlap
                  %
                  raiseboxdimexprhtBracket@box+Bracket@vpadrelax
                  %
                  vrule height 0pt
                  depth Bracket@linewidth
                  width Bracket@length
                  %
                  %
                  raisebox-dimexprdpBracket@box+Bracket@vpadrelax
                  %
                  vrule height Bracket@linewidth
                  depth 0pt
                  width Bracket@length
                  %
                  %
                  hskipBracket@hpadLeft
                  raisebox
                  %
                  dimexpr
                  .5htBracket@box-.5dpBracket@box
                  -.5htBracket@icon+.5dpBracket@icon
                  +Bracket@iconOffset
                  relax

                  useboxBracket@icon%
                  hskipBracket@hpadIcon
                  useboxBracket@box
                  hskipBracket@hpadRight
                  vrule height dimexprhtBracket@box+Bracket@vpad
                  depth dimexprdpBracket@box+Bracket@vpad
                  width Bracket@linewidth
                  rlap
                  %
                  hskip-Bracket@linewidth
                  llap
                  %
                  raiseboxdimexprhtBracket@box+Bracket@vpadrelax
                  %
                  vrule height 0pt
                  depth Bracket@linewidth
                  width Bracket@length
                  %
                  %
                  llap
                  %
                  raisebox-dimexprdpBracket@box+Bracket@vpadrelax
                  %
                  vrule height Bracket@linewidth
                  depth 0pt
                  width Bracket@length
                  %
                  %
                  %
                  %
                  par
                  vskipBracket@belowSkip

                  makeatother

                  usepackageduckuments% only for blindduck

                  begindocument
                  blindduck[1]
                  beginBracketNew- and old-style classes
                  blindduck[2]
                  endBracket
                  noindent
                  blindduck[3]
                  enddocument


                  enter image description here



                  EDIT: Allows a total width greater than the surrounding linewidth without overfull boxes.



                  I should mention that the result is not page breakable. If this is required, tcolorbox can be page broken if set up correctly, so take a look at @marmot's answer (this doesn't claim that the way @marmot set up tcolorbox is page breakable, I didn't check this, so it might be breakable, but might as well be not).






                  share|improve this answer














                  The following is a quick implementation of what you want without any packages. The syntax is quick and dirty and a mixture of LaTeX and TeX syntax. Every aspect of the environment should be adjustable if you change the used lengths and macros (every one should be commented to make clear what it's used for).



                  documentclassarticle

                  usepackagegraphicx

                  makeatletter
                  newcommandBracket@head[1]textbf#1 % format the heading
                  % store the icon
                  newsaveboxBracket@icon
                  setboxBracket@iconhboxincludegraphics[width=1cm]example-image-duck
                  % the vertical displacement of the icon from the centre of the contents
                  newlengthBracket@iconOffset
                  Bracket@iconOffset0pt
                  % store the contents of the environment
                  newsaveboxBracket@box
                  % the width it should take as a macro so that the width is evaluated when used,
                  % this should provide more flexibility
                  newcommandBracket@totwidth.95linewidth
                  % the actual contents width (gets calculated)
                  newlengthBracket@width
                  % the vertical amount of space the brackets are taller than their contents
                  newlengthBracket@vpad
                  Bracket@vpad5mm
                  % the width of the horizontal rules of the brackets
                  newlengthBracket@length
                  Bracket@length5mm
                  % the thickness of the bracket rules
                  newlengthBracket@linewidth
                  Bracket@linewidth2pt
                  % the amount of white space between the left bracket and the logo
                  newlengthBracket@hpadLeft
                  Bracket@hpadLeft2.5mm
                  % the amount of white space between the logo and the contents
                  newlengthBracket@hpadIcon
                  Bracket@hpadIcon2.5mm
                  % the amount of white space between the right bracket and the contents
                  newlengthBracket@hpadRight
                  Bracket@hpadRight5mm
                  % the vertical white space added above the whole environment
                  newlengthBracket@aboveSkip
                  Bracket@aboveSkip1ex
                  % the vertical white space added below the whole environment
                  newlengthBracket@belowSkip
                  Bracket@belowSkip1ex
                  % the definition of the environment
                  newenvironmentBracket[1]
                  %
                  Bracket@widthBracket@totwidth
                  advanceBracket@width-Bracket@hpadRight
                  advanceBracket@width-Bracket@hpadLeft
                  advanceBracket@width-Bracket@hpadIcon
                  advanceBracket@width-wdBracket@icon
                  advanceBracket@width-2Bracket@linewidth
                  setboxBracket@boxvboxbgroup
                  hsizeBracket@width
                  linewidthhsize
                  noindent
                  Bracket@head#1par
                  @afterindentfalse
                  @afterheading

                  %
                  egroup
                  par
                  vskipBracket@aboveSkip
                  noindent
                  null
                  hskipdimexpr(linewidth-Bracket@totwidth)/2relax
                  rlap
                  %
                  vrule height dimexprhtBracket@box+Bracket@vpad
                  depth dimexprdpBracket@box+Bracket@vpad
                  width Bracket@linewidth
                  rlap
                  %
                  rlap
                  %
                  raiseboxdimexprhtBracket@box+Bracket@vpadrelax
                  %
                  vrule height 0pt
                  depth Bracket@linewidth
                  width Bracket@length
                  %
                  %
                  raisebox-dimexprdpBracket@box+Bracket@vpadrelax
                  %
                  vrule height Bracket@linewidth
                  depth 0pt
                  width Bracket@length
                  %
                  %
                  hskipBracket@hpadLeft
                  raisebox
                  %
                  dimexpr
                  .5htBracket@box-.5dpBracket@box
                  -.5htBracket@icon+.5dpBracket@icon
                  +Bracket@iconOffset
                  relax

                  useboxBracket@icon%
                  hskipBracket@hpadIcon
                  useboxBracket@box
                  hskipBracket@hpadRight
                  vrule height dimexprhtBracket@box+Bracket@vpad
                  depth dimexprdpBracket@box+Bracket@vpad
                  width Bracket@linewidth
                  rlap
                  %
                  hskip-Bracket@linewidth
                  llap
                  %
                  raiseboxdimexprhtBracket@box+Bracket@vpadrelax
                  %
                  vrule height 0pt
                  depth Bracket@linewidth
                  width Bracket@length
                  %
                  %
                  llap
                  %
                  raisebox-dimexprdpBracket@box+Bracket@vpadrelax
                  %
                  vrule height Bracket@linewidth
                  depth 0pt
                  width Bracket@length
                  %
                  %
                  %
                  %
                  par
                  vskipBracket@belowSkip

                  makeatother

                  usepackageduckuments% only for blindduck

                  begindocument
                  blindduck[1]
                  beginBracketNew- and old-style classes
                  blindduck[2]
                  endBracket
                  noindent
                  blindduck[3]
                  enddocument


                  enter image description here



                  EDIT: Allows a total width greater than the surrounding linewidth without overfull boxes.



                  I should mention that the result is not page breakable. If this is required, tcolorbox can be page broken if set up correctly, so take a look at @marmot's answer (this doesn't claim that the way @marmot set up tcolorbox is page breakable, I didn't check this, so it might be breakable, but might as well be not).







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Sep 25 at 6:47

























                  answered Sep 24 at 21:49









                  Skillmon

                  18.9k11637




                  18.9k11637



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f452329%2fhow-to-make-a-bracketed-environment-like-this%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      Peggy Mitchell

                      The Forum (Inglewood, California)

                      Palaiologos