etoolbox: AtBeginEnvironment is not At Begin EnvironmentRemove space after figure and before textSpacing around table and figure environmentsmultiple lists in etoolboxPhantom and etoolbox iftogglePackage etoolbox Warning: Patching 'begin' failed!Hide an environment and show it later in the documentetoolbox conflict with bm packageProblem changing spacing for equation environmentquestion of ifstrequal in etoolboxImage Not Found in Command with EtoolboxEnd mark switching fails because @ifnextchar's behavior in an environment hook is not as naively expectedObeylines and gappto from etoolbox

What is/are this/these giant NASA box(es)?

What is the indigenous Russian word for a wild boar?

Why would Lupin kill Pettigrew?

Can a helicopter mask itself from Radar?

Is this light switch installation safe and legal?

Beginner's snake game using PyGame

The deliberate use of misleading terminology

Can non-English-speaking characters use wordplay specific to English?

What does it mean when you think without speaking?

Strange math syntax in old basic listing

What does "tea juice" mean in this context?

Is floating in space similar to falling under gravity?

Select row of data if next row contains zero

Is it possible to kill all life on Earth?

When a current flow in an inductor is interrupted, what limits the voltage rise?

Comment dit-on « I’ll tell you what » ?

Can't connect to Internet in bash using Mac OS

If I create magical darkness with the Silent Image spell, can I see through it if I have the Devil's Sight warlock invocation?

Thousands and thousands of words

Is having a hidden directory under /etc safe?

Why do Russians call their women expensive ("дорогая")?

Self-Preservation: How to DM NPCs that Love Living?

How do I subvert the tropes of a train heist?

Why is there a need to modify system call tables in linux?



etoolbox: AtBeginEnvironment is not At Begin Environment


Remove space after figure and before textSpacing around table and figure environmentsmultiple lists in etoolboxPhantom and etoolbox iftogglePackage etoolbox Warning: Patching 'begin' failed!Hide an environment and show it later in the documentetoolbox conflict with bm packageProblem changing spacing for equation environmentquestion of ifstrequal in etoolboxImage Not Found in Command with EtoolboxEnd mark switching fails because @ifnextchar's behavior in an environment hook is not as naively expectedObeylines and gappto from etoolbox













5















I tried the following MWE:



documentclassarticle
usepackageetoolbox

AtBeginEnvironmenttableAtBeginEnvironmentpar
AtEndEnvironmenttableAtEndEnvironmentpar
BeforeBeginEnvironmenttableBeforeBeginEnvironmentpar
AfterEndEnvironmenttableAfterEndEnvironmentpar

begindocument
Text beforepar
begintable [t]%
Table textpar
endtable
Text afterpar
enddocument


and got the following result:



Table text
AtEndEnvironment
Text before
BeforeBeginEnvironment
AtBeginEnvironment
AfterEndEnvironment
Text after


I was expecting AtBeginEnvironment to travel to the top of the page together with the float.
Here is what the manual has to say on the matter:



AtBeginEnvironment<environment><code>
Appends arbitrary <code> to a hook executed by the begin command
at the beginning of a given <environment>, immediately before
<environment>, inside the group opened by begin.


I do not know what happens inside an environment definition; I guess it declares some special commands called <environment> (e.g. table) and end<environment> (e.g. endtable).



But in this case, shouldn't it be immediately after <environment>, in order to be a complement to AtEndEnvironment just as BeforeBeginEnvironment is a complement to AfterEndEnvironment?



Anyway, how can I add code to the beginning of an environment? I'm trying to set a certain font style for all tables, and AtBeginEnvironmenttablesmall does not work. Also I guess this behavior makes this answer incorrect, because addvspace would stay at the point of declaration of the figure instead of moving together with it.










share|improve this question




























    5















    I tried the following MWE:



    documentclassarticle
    usepackageetoolbox

    AtBeginEnvironmenttableAtBeginEnvironmentpar
    AtEndEnvironmenttableAtEndEnvironmentpar
    BeforeBeginEnvironmenttableBeforeBeginEnvironmentpar
    AfterEndEnvironmenttableAfterEndEnvironmentpar

    begindocument
    Text beforepar
    begintable [t]%
    Table textpar
    endtable
    Text afterpar
    enddocument


    and got the following result:



    Table text
    AtEndEnvironment
    Text before
    BeforeBeginEnvironment
    AtBeginEnvironment
    AfterEndEnvironment
    Text after


    I was expecting AtBeginEnvironment to travel to the top of the page together with the float.
    Here is what the manual has to say on the matter:



    AtBeginEnvironment<environment><code>
    Appends arbitrary <code> to a hook executed by the begin command
    at the beginning of a given <environment>, immediately before
    <environment>, inside the group opened by begin.


    I do not know what happens inside an environment definition; I guess it declares some special commands called <environment> (e.g. table) and end<environment> (e.g. endtable).



    But in this case, shouldn't it be immediately after <environment>, in order to be a complement to AtEndEnvironment just as BeforeBeginEnvironment is a complement to AfterEndEnvironment?



    Anyway, how can I add code to the beginning of an environment? I'm trying to set a certain font style for all tables, and AtBeginEnvironmenttablesmall does not work. Also I guess this behavior makes this answer incorrect, because addvspace would stay at the point of declaration of the figure instead of moving together with it.










    share|improve this question


























      5












      5








      5








      I tried the following MWE:



      documentclassarticle
      usepackageetoolbox

      AtBeginEnvironmenttableAtBeginEnvironmentpar
      AtEndEnvironmenttableAtEndEnvironmentpar
      BeforeBeginEnvironmenttableBeforeBeginEnvironmentpar
      AfterEndEnvironmenttableAfterEndEnvironmentpar

      begindocument
      Text beforepar
      begintable [t]%
      Table textpar
      endtable
      Text afterpar
      enddocument


      and got the following result:



      Table text
      AtEndEnvironment
      Text before
      BeforeBeginEnvironment
      AtBeginEnvironment
      AfterEndEnvironment
      Text after


      I was expecting AtBeginEnvironment to travel to the top of the page together with the float.
      Here is what the manual has to say on the matter:



      AtBeginEnvironment<environment><code>
      Appends arbitrary <code> to a hook executed by the begin command
      at the beginning of a given <environment>, immediately before
      <environment>, inside the group opened by begin.


      I do not know what happens inside an environment definition; I guess it declares some special commands called <environment> (e.g. table) and end<environment> (e.g. endtable).



      But in this case, shouldn't it be immediately after <environment>, in order to be a complement to AtEndEnvironment just as BeforeBeginEnvironment is a complement to AfterEndEnvironment?



      Anyway, how can I add code to the beginning of an environment? I'm trying to set a certain font style for all tables, and AtBeginEnvironmenttablesmall does not work. Also I guess this behavior makes this answer incorrect, because addvspace would stay at the point of declaration of the figure instead of moving together with it.










      share|improve this question
















      I tried the following MWE:



      documentclassarticle
      usepackageetoolbox

      AtBeginEnvironmenttableAtBeginEnvironmentpar
      AtEndEnvironmenttableAtEndEnvironmentpar
      BeforeBeginEnvironmenttableBeforeBeginEnvironmentpar
      AfterEndEnvironmenttableAfterEndEnvironmentpar

      begindocument
      Text beforepar
      begintable [t]%
      Table textpar
      endtable
      Text afterpar
      enddocument


      and got the following result:



      Table text
      AtEndEnvironment
      Text before
      BeforeBeginEnvironment
      AtBeginEnvironment
      AfterEndEnvironment
      Text after


      I was expecting AtBeginEnvironment to travel to the top of the page together with the float.
      Here is what the manual has to say on the matter:



      AtBeginEnvironment<environment><code>
      Appends arbitrary <code> to a hook executed by the begin command
      at the beginning of a given <environment>, immediately before
      <environment>, inside the group opened by begin.


      I do not know what happens inside an environment definition; I guess it declares some special commands called <environment> (e.g. table) and end<environment> (e.g. endtable).



      But in this case, shouldn't it be immediately after <environment>, in order to be a complement to AtEndEnvironment just as BeforeBeginEnvironment is a complement to AfterEndEnvironment?



      Anyway, how can I add code to the beginning of an environment? I'm trying to set a certain font style for all tables, and AtBeginEnvironmenttablesmall does not work. Also I guess this behavior makes this answer incorrect, because addvspace would stay at the point of declaration of the figure instead of moving together with it.







      etoolbox






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 8 hours ago







      ScumCoder

















      asked 8 hours ago









      ScumCoderScumCoder

      625512




      625512




















          1 Answer
          1






          active

          oldest

          votes


















          7














          The etoolbox package redefines begin so that




          1. @beforebegin@<envname>@hook is executed

          2. the usual bookkeeping is performed (setting @currenvir, for instance)


          3. @begin@<envname>@hook is executed
            1 a group is started

          4. the macro <envname> is executed

          Thus what you get is



          @beforebegin@table@hook
          <bookkeeping>
          @begin@table@hook
          begingroup
          table


          The macro table is responsible for starting the creation of a float and expands to @floattable.



          Thus the tokens AtBeginEnvironmentpar and BeforeBeginEnvironmentpar are seen and the paragraphs are typeset before the float is started.



          To the contrary, end is redefined to execute the AtEndEnvironment tokens before end<envname> is executed.



          This should explain the output you get.



          There is a hook for doing things when the float has already begun and is @floatboxreset.



          I would be wary of using the hooks for adding text: they're meant for additional setup.






          share|improve this answer























          • @begin@table@hook isn't inside the group?

            – touhami
            7 hours ago











          • Thank you. > I would be wary of using the hooks for adding text: they're meant for additional setup. I'm wary too, I just used it to see what goes where. > There is a hook for doing things when the float has already begun and is @floatboxreset. That’s helpful, but alas, it does not allow to set different settings for different float types.

            – ScumCoder
            7 hours ago











          • Also, I must add that I ended up using setfloatadjustment command from memoir, on which I stumbled upon when I read your answer and started digging the @floatboxreset.

            – ScumCoder
            7 hours ago











          • @ScumCoder you can put float-type specific code in @floatboxreset you just need to test @captype

            – David Carlisle
            7 hours ago











          • @DavidCarlisle I'm afraid this is a bit too hardcore for me yet, I'll just settle for something more philistine for the time being :)

            – ScumCoder
            7 hours ago











          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%2f493087%2fetoolbox-atbeginenvironment-is-not-at-begin-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









          7














          The etoolbox package redefines begin so that




          1. @beforebegin@<envname>@hook is executed

          2. the usual bookkeeping is performed (setting @currenvir, for instance)


          3. @begin@<envname>@hook is executed
            1 a group is started

          4. the macro <envname> is executed

          Thus what you get is



          @beforebegin@table@hook
          <bookkeeping>
          @begin@table@hook
          begingroup
          table


          The macro table is responsible for starting the creation of a float and expands to @floattable.



          Thus the tokens AtBeginEnvironmentpar and BeforeBeginEnvironmentpar are seen and the paragraphs are typeset before the float is started.



          To the contrary, end is redefined to execute the AtEndEnvironment tokens before end<envname> is executed.



          This should explain the output you get.



          There is a hook for doing things when the float has already begun and is @floatboxreset.



          I would be wary of using the hooks for adding text: they're meant for additional setup.






          share|improve this answer























          • @begin@table@hook isn't inside the group?

            – touhami
            7 hours ago











          • Thank you. > I would be wary of using the hooks for adding text: they're meant for additional setup. I'm wary too, I just used it to see what goes where. > There is a hook for doing things when the float has already begun and is @floatboxreset. That’s helpful, but alas, it does not allow to set different settings for different float types.

            – ScumCoder
            7 hours ago











          • Also, I must add that I ended up using setfloatadjustment command from memoir, on which I stumbled upon when I read your answer and started digging the @floatboxreset.

            – ScumCoder
            7 hours ago











          • @ScumCoder you can put float-type specific code in @floatboxreset you just need to test @captype

            – David Carlisle
            7 hours ago











          • @DavidCarlisle I'm afraid this is a bit too hardcore for me yet, I'll just settle for something more philistine for the time being :)

            – ScumCoder
            7 hours ago















          7














          The etoolbox package redefines begin so that




          1. @beforebegin@<envname>@hook is executed

          2. the usual bookkeeping is performed (setting @currenvir, for instance)


          3. @begin@<envname>@hook is executed
            1 a group is started

          4. the macro <envname> is executed

          Thus what you get is



          @beforebegin@table@hook
          <bookkeeping>
          @begin@table@hook
          begingroup
          table


          The macro table is responsible for starting the creation of a float and expands to @floattable.



          Thus the tokens AtBeginEnvironmentpar and BeforeBeginEnvironmentpar are seen and the paragraphs are typeset before the float is started.



          To the contrary, end is redefined to execute the AtEndEnvironment tokens before end<envname> is executed.



          This should explain the output you get.



          There is a hook for doing things when the float has already begun and is @floatboxreset.



          I would be wary of using the hooks for adding text: they're meant for additional setup.






          share|improve this answer























          • @begin@table@hook isn't inside the group?

            – touhami
            7 hours ago











          • Thank you. > I would be wary of using the hooks for adding text: they're meant for additional setup. I'm wary too, I just used it to see what goes where. > There is a hook for doing things when the float has already begun and is @floatboxreset. That’s helpful, but alas, it does not allow to set different settings for different float types.

            – ScumCoder
            7 hours ago











          • Also, I must add that I ended up using setfloatadjustment command from memoir, on which I stumbled upon when I read your answer and started digging the @floatboxreset.

            – ScumCoder
            7 hours ago











          • @ScumCoder you can put float-type specific code in @floatboxreset you just need to test @captype

            – David Carlisle
            7 hours ago











          • @DavidCarlisle I'm afraid this is a bit too hardcore for me yet, I'll just settle for something more philistine for the time being :)

            – ScumCoder
            7 hours ago













          7












          7








          7







          The etoolbox package redefines begin so that




          1. @beforebegin@<envname>@hook is executed

          2. the usual bookkeeping is performed (setting @currenvir, for instance)


          3. @begin@<envname>@hook is executed
            1 a group is started

          4. the macro <envname> is executed

          Thus what you get is



          @beforebegin@table@hook
          <bookkeeping>
          @begin@table@hook
          begingroup
          table


          The macro table is responsible for starting the creation of a float and expands to @floattable.



          Thus the tokens AtBeginEnvironmentpar and BeforeBeginEnvironmentpar are seen and the paragraphs are typeset before the float is started.



          To the contrary, end is redefined to execute the AtEndEnvironment tokens before end<envname> is executed.



          This should explain the output you get.



          There is a hook for doing things when the float has already begun and is @floatboxreset.



          I would be wary of using the hooks for adding text: they're meant for additional setup.






          share|improve this answer













          The etoolbox package redefines begin so that




          1. @beforebegin@<envname>@hook is executed

          2. the usual bookkeeping is performed (setting @currenvir, for instance)


          3. @begin@<envname>@hook is executed
            1 a group is started

          4. the macro <envname> is executed

          Thus what you get is



          @beforebegin@table@hook
          <bookkeeping>
          @begin@table@hook
          begingroup
          table


          The macro table is responsible for starting the creation of a float and expands to @floattable.



          Thus the tokens AtBeginEnvironmentpar and BeforeBeginEnvironmentpar are seen and the paragraphs are typeset before the float is started.



          To the contrary, end is redefined to execute the AtEndEnvironment tokens before end<envname> is executed.



          This should explain the output you get.



          There is a hook for doing things when the float has already begun and is @floatboxreset.



          I would be wary of using the hooks for adding text: they're meant for additional setup.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 7 hours ago









          egregegreg

          744k8919493288




          744k8919493288












          • @begin@table@hook isn't inside the group?

            – touhami
            7 hours ago











          • Thank you. > I would be wary of using the hooks for adding text: they're meant for additional setup. I'm wary too, I just used it to see what goes where. > There is a hook for doing things when the float has already begun and is @floatboxreset. That’s helpful, but alas, it does not allow to set different settings for different float types.

            – ScumCoder
            7 hours ago











          • Also, I must add that I ended up using setfloatadjustment command from memoir, on which I stumbled upon when I read your answer and started digging the @floatboxreset.

            – ScumCoder
            7 hours ago











          • @ScumCoder you can put float-type specific code in @floatboxreset you just need to test @captype

            – David Carlisle
            7 hours ago











          • @DavidCarlisle I'm afraid this is a bit too hardcore for me yet, I'll just settle for something more philistine for the time being :)

            – ScumCoder
            7 hours ago

















          • @begin@table@hook isn't inside the group?

            – touhami
            7 hours ago











          • Thank you. > I would be wary of using the hooks for adding text: they're meant for additional setup. I'm wary too, I just used it to see what goes where. > There is a hook for doing things when the float has already begun and is @floatboxreset. That’s helpful, but alas, it does not allow to set different settings for different float types.

            – ScumCoder
            7 hours ago











          • Also, I must add that I ended up using setfloatadjustment command from memoir, on which I stumbled upon when I read your answer and started digging the @floatboxreset.

            – ScumCoder
            7 hours ago











          • @ScumCoder you can put float-type specific code in @floatboxreset you just need to test @captype

            – David Carlisle
            7 hours ago











          • @DavidCarlisle I'm afraid this is a bit too hardcore for me yet, I'll just settle for something more philistine for the time being :)

            – ScumCoder
            7 hours ago
















          @begin@table@hook isn't inside the group?

          – touhami
          7 hours ago





          @begin@table@hook isn't inside the group?

          – touhami
          7 hours ago













          Thank you. > I would be wary of using the hooks for adding text: they're meant for additional setup. I'm wary too, I just used it to see what goes where. > There is a hook for doing things when the float has already begun and is @floatboxreset. That’s helpful, but alas, it does not allow to set different settings for different float types.

          – ScumCoder
          7 hours ago





          Thank you. > I would be wary of using the hooks for adding text: they're meant for additional setup. I'm wary too, I just used it to see what goes where. > There is a hook for doing things when the float has already begun and is @floatboxreset. That’s helpful, but alas, it does not allow to set different settings for different float types.

          – ScumCoder
          7 hours ago













          Also, I must add that I ended up using setfloatadjustment command from memoir, on which I stumbled upon when I read your answer and started digging the @floatboxreset.

          – ScumCoder
          7 hours ago





          Also, I must add that I ended up using setfloatadjustment command from memoir, on which I stumbled upon when I read your answer and started digging the @floatboxreset.

          – ScumCoder
          7 hours ago













          @ScumCoder you can put float-type specific code in @floatboxreset you just need to test @captype

          – David Carlisle
          7 hours ago





          @ScumCoder you can put float-type specific code in @floatboxreset you just need to test @captype

          – David Carlisle
          7 hours ago













          @DavidCarlisle I'm afraid this is a bit too hardcore for me yet, I'll just settle for something more philistine for the time being :)

          – ScumCoder
          7 hours ago





          @DavidCarlisle I'm afraid this is a bit too hardcore for me yet, I'll just settle for something more philistine for the time being :)

          – ScumCoder
          7 hours ago

















          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%2f493087%2fetoolbox-atbeginenvironment-is-not-at-begin-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

          Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

          Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

          Ласкавець круглолистий Зміст Опис | Поширення | Галерея | Примітки | Посилання | Навігаційне меню58171138361-22960890446Bupleurum rotundifoliumEuro+Med PlantbasePlants of the World Online — Kew ScienceGermplasm Resources Information Network (GRIN)Ласкавецькн. VI : Літери Ком — Левиправивши або дописавши її