Automatically end list item with proper punctuation (semicolon, period)List separated by semicolons, ending with a periodEnumerate and itemize undefined + captions not workingaligning a multiline formula with the bullet of itemizeItem displayed twice in beamer itemizeSplit itemize into multiple columnsHow to achieve multicolumn item lists with independent content?possible memoir bug with font sizes and tightlistsFinishing math with a periodIndentation of new list levels with enumitemChecking if current item is last item inside enumerated list

What does Yoda's species eat?

Automatically verify passwords for classroom exercise?

SSD not reaching advertised speed

RPMs too high on freeway?

Running code in a different tmux pane

Advenit versus Venit

Days in indexed month

Evaluating a definite Integral with a constant n

Beautiful planar geometry theorems not encountered in high school

How is a series resistor limiting the voltage for a diode?

What other tricks were there to get more data onto floppy disks?

Telugu fonts are not recognized by Blender 2.8

Is it a mistake to use a password that has previously been used (by anyone ever)?

SSH host identification changes on one wireless network

Is it possible to change paper title after send back from reviewers for revising?

Would an intelligent alien civilisation categorise EM radiation the same as us?

What should be the waveform for ZX Spectrum tapes?

What is the correct way for pilots to say times?

Reproduce diagram relating different continuity properties

Euclidean Distance Between Two Matrices

Was it possible for a message from Paris to reach London within 48 hours in 1782?

Why are there so many binary systems?

UK visitors visa needed fast for badly injured family member

Is every conformal manifold equivalent to a flat one with cone singularities?



Automatically end list item with proper punctuation (semicolon, period)


List separated by semicolons, ending with a periodEnumerate and itemize undefined + captions not workingaligning a multiline formula with the bullet of itemizeItem displayed twice in beamer itemizeSplit itemize into multiple columnsHow to achieve multicolumn item lists with independent content?possible memoir bug with font sizes and tightlistsFinishing math with a periodIndentation of new list levels with enumitemChecking if current item is last item inside enumerated list






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









6


















If I have a list using itemize, I want to automatically end each item with a semicolon (for all but the last item) or a period (for the last item).



For example:



beginitemize
item One
item Two
item Three
enditemize


Should display as



  • One;

  • Two;

  • Three.

Is there any way to make that happen? I looked around but didn't really find anything. The closest I could find was this, but that seems to be a fancy, custom list rather than a vanilla itemize.










share|improve this question

































    6


















    If I have a list using itemize, I want to automatically end each item with a semicolon (for all but the last item) or a period (for the last item).



    For example:



    beginitemize
    item One
    item Two
    item Three
    enditemize


    Should display as



    • One;

    • Two;

    • Three.

    Is there any way to make that happen? I looked around but didn't really find anything. The closest I could find was this, but that seems to be a fancy, custom list rather than a vanilla itemize.










    share|improve this question





























      6













      6









      6








      If I have a list using itemize, I want to automatically end each item with a semicolon (for all but the last item) or a period (for the last item).



      For example:



      beginitemize
      item One
      item Two
      item Three
      enditemize


      Should display as



      • One;

      • Two;

      • Three.

      Is there any way to make that happen? I looked around but didn't really find anything. The closest I could find was this, but that seems to be a fancy, custom list rather than a vanilla itemize.










      share|improve this question
















      If I have a list using itemize, I want to automatically end each item with a semicolon (for all but the last item) or a period (for the last item).



      For example:



      beginitemize
      item One
      item Two
      item Three
      enditemize


      Should display as



      • One;

      • Two;

      • Three.

      Is there any way to make that happen? I looked around but didn't really find anything. The closest I could find was this, but that seems to be a fancy, custom list rather than a vanilla itemize.







      lists itemize punctuation






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 7 at 18:10









      Bernard

      198k8 gold badges88 silver badges233 bronze badges




      198k8 gold badges88 silver badges233 bronze badges










      asked Sep 7 at 17:55









      MarcelMarcel

      1634 bronze badges




      1634 bronze badges























          2 Answers
          2






          active

          oldest

          votes


















          5



















          I'm not sure whether it is a good idea to do this, maybe you should use a different environment for that. The following patches item inside every itemize environment to add a semicolon after the first, and the enditemize macro is changed to add a dot. You can no longer nest itemize environments with this simple approach. All in all I think this creates more problems than it solves...



          documentclass[]article

          usepackageetoolbox
          AtBeginEnvironmentitemize
          %
          defitemizepunctuationdefitemizepunctuationifhmodeunskipfi;%
          pretocmditemitemizepunctuation%
          pretocmdenditemizeifhmodeunskipfi.%


          newenvironmentpunctitemize
          %
          itemize
          defitemizepunctuationdefitemizepunctuationifhmodeunskipfi;%
          pretocmditemitemizepunctuation%
          pretocmdenditemizeifhmodeunskipfi.%

          %
          enditemize


          begindocument
          beginitemize
          item One
          item Two
          item Three
          enditemize

          beginpunctitemize
          item One
          item Two
          item Three
          endpunctitemize
          enddocument


          enter image description here



          EDIT: added the environment approach, nesting is still not supported.






          share|improve this answer




























          • Thanks for the answer. When you say use a different environment, do you mean add a new punctuateditemize (for example) rather than overriding the default itemize? If so, could you give an example of what this would look like?

            – Marcel
            Sep 7 at 18:06











          • @Marcel see my edit.

            – Skillmon
            Sep 7 at 18:11











          • Thanks for the edit. I am nitpicking now, but if I have a newline in the item, the semicolon / period is on its own line. I don't suppose there is any way to fix that?

            – Marcel
            Sep 7 at 18:26











          • Actually, it looks like that happens if there is a newline in the itemize.

            – Marcel
            Sep 7 at 18:37






          • 1





            @Skillmon Probably Marcel is referring to a blank line between items. Try it.

            – egreg
            Sep 7 at 20:24


















          7



















          You can use xparse, absorbing the whole contents and splitting it at item; then add a semicolon (and the removed item) between items.



          The processing is complicated by the fact that a blank line between items would introduce a spurious paragraph before the semicolon or the final period, so we need to remove blanks and par tokens at the end of each item.



          Thus the sequence obtained by splitting at item is mapped to “purify” it.



          I added enumitem for maximum flexibility.



          documentclassarticle
          usepackagexparse
          usepackageenumitem

          ExplSyntaxOn

          NewDocumentEnvironmentautoitemizeO +b

          beginitemize[#1]
          marcel_autoitemize:n #2
          enditemize


          seq_new:N l__marcel_autoitemize_items_seq
          seq_new:N l__marcel_autoitemize_items_nopar_seq
          tl_new:N l__marcel_autoitemize_item_tl

          cs_new_protected:Nn marcel_autoitemize:n

          % split the contents at item; this also removes blanks at either end
          seq_set_split:Nnn l__marcel_autoitemize_items_seq item #1
          % remove the first (empty) item
          seq_pop_left:NN l__marcel_autoitemize_items_seq l_tmpa_tl
          % we need to remove trailing par tokens
          seq_clear:N l__marcel_autoitemize_items_nopar_seq
          seq_map_function:NN l__marcel_autoitemize_items_seq __marcel_autoitemize_purify:n
          % start the first item
          item
          % use the sequence, putting a semicolon and item between items
          seq_use:Nn l__marcel_autoitemize_items_nopar_seq ; item
          % end up with a period
          .


          cs_new_protected:Nn __marcel_autoitemize_purify:n

          tl_set:Nn l__marcel_autoitemize_item_tl #1
          regex_replace_once:nnN s* cpar* Z l__marcel_autoitemize_item_tl
          seq_put_right:NV l__marcel_autoitemize_items_nopar_seq l__marcel_autoitemize_item_tl


          ExplSyntaxOff

          begindocument

          beginautoitemize
          item One

          item Two
          item Three
          endautoitemize

          beginautoitemize[label=--]
          item One
          item Two
          item Three
          endautoitemize

          enddocument


          enter image description here






          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',
            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/4.0/"u003ecc by-sa 4.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%2f507406%2fautomatically-end-list-item-with-proper-punctuation-semicolon-period%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown


























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            5



















            I'm not sure whether it is a good idea to do this, maybe you should use a different environment for that. The following patches item inside every itemize environment to add a semicolon after the first, and the enditemize macro is changed to add a dot. You can no longer nest itemize environments with this simple approach. All in all I think this creates more problems than it solves...



            documentclass[]article

            usepackageetoolbox
            AtBeginEnvironmentitemize
            %
            defitemizepunctuationdefitemizepunctuationifhmodeunskipfi;%
            pretocmditemitemizepunctuation%
            pretocmdenditemizeifhmodeunskipfi.%


            newenvironmentpunctitemize
            %
            itemize
            defitemizepunctuationdefitemizepunctuationifhmodeunskipfi;%
            pretocmditemitemizepunctuation%
            pretocmdenditemizeifhmodeunskipfi.%

            %
            enditemize


            begindocument
            beginitemize
            item One
            item Two
            item Three
            enditemize

            beginpunctitemize
            item One
            item Two
            item Three
            endpunctitemize
            enddocument


            enter image description here



            EDIT: added the environment approach, nesting is still not supported.






            share|improve this answer




























            • Thanks for the answer. When you say use a different environment, do you mean add a new punctuateditemize (for example) rather than overriding the default itemize? If so, could you give an example of what this would look like?

              – Marcel
              Sep 7 at 18:06











            • @Marcel see my edit.

              – Skillmon
              Sep 7 at 18:11











            • Thanks for the edit. I am nitpicking now, but if I have a newline in the item, the semicolon / period is on its own line. I don't suppose there is any way to fix that?

              – Marcel
              Sep 7 at 18:26











            • Actually, it looks like that happens if there is a newline in the itemize.

              – Marcel
              Sep 7 at 18:37






            • 1





              @Skillmon Probably Marcel is referring to a blank line between items. Try it.

              – egreg
              Sep 7 at 20:24















            5



















            I'm not sure whether it is a good idea to do this, maybe you should use a different environment for that. The following patches item inside every itemize environment to add a semicolon after the first, and the enditemize macro is changed to add a dot. You can no longer nest itemize environments with this simple approach. All in all I think this creates more problems than it solves...



            documentclass[]article

            usepackageetoolbox
            AtBeginEnvironmentitemize
            %
            defitemizepunctuationdefitemizepunctuationifhmodeunskipfi;%
            pretocmditemitemizepunctuation%
            pretocmdenditemizeifhmodeunskipfi.%


            newenvironmentpunctitemize
            %
            itemize
            defitemizepunctuationdefitemizepunctuationifhmodeunskipfi;%
            pretocmditemitemizepunctuation%
            pretocmdenditemizeifhmodeunskipfi.%

            %
            enditemize


            begindocument
            beginitemize
            item One
            item Two
            item Three
            enditemize

            beginpunctitemize
            item One
            item Two
            item Three
            endpunctitemize
            enddocument


            enter image description here



            EDIT: added the environment approach, nesting is still not supported.






            share|improve this answer




























            • Thanks for the answer. When you say use a different environment, do you mean add a new punctuateditemize (for example) rather than overriding the default itemize? If so, could you give an example of what this would look like?

              – Marcel
              Sep 7 at 18:06











            • @Marcel see my edit.

              – Skillmon
              Sep 7 at 18:11











            • Thanks for the edit. I am nitpicking now, but if I have a newline in the item, the semicolon / period is on its own line. I don't suppose there is any way to fix that?

              – Marcel
              Sep 7 at 18:26











            • Actually, it looks like that happens if there is a newline in the itemize.

              – Marcel
              Sep 7 at 18:37






            • 1





              @Skillmon Probably Marcel is referring to a blank line between items. Try it.

              – egreg
              Sep 7 at 20:24













            5















            5











            5









            I'm not sure whether it is a good idea to do this, maybe you should use a different environment for that. The following patches item inside every itemize environment to add a semicolon after the first, and the enditemize macro is changed to add a dot. You can no longer nest itemize environments with this simple approach. All in all I think this creates more problems than it solves...



            documentclass[]article

            usepackageetoolbox
            AtBeginEnvironmentitemize
            %
            defitemizepunctuationdefitemizepunctuationifhmodeunskipfi;%
            pretocmditemitemizepunctuation%
            pretocmdenditemizeifhmodeunskipfi.%


            newenvironmentpunctitemize
            %
            itemize
            defitemizepunctuationdefitemizepunctuationifhmodeunskipfi;%
            pretocmditemitemizepunctuation%
            pretocmdenditemizeifhmodeunskipfi.%

            %
            enditemize


            begindocument
            beginitemize
            item One
            item Two
            item Three
            enditemize

            beginpunctitemize
            item One
            item Two
            item Three
            endpunctitemize
            enddocument


            enter image description here



            EDIT: added the environment approach, nesting is still not supported.






            share|improve this answer
















            I'm not sure whether it is a good idea to do this, maybe you should use a different environment for that. The following patches item inside every itemize environment to add a semicolon after the first, and the enditemize macro is changed to add a dot. You can no longer nest itemize environments with this simple approach. All in all I think this creates more problems than it solves...



            documentclass[]article

            usepackageetoolbox
            AtBeginEnvironmentitemize
            %
            defitemizepunctuationdefitemizepunctuationifhmodeunskipfi;%
            pretocmditemitemizepunctuation%
            pretocmdenditemizeifhmodeunskipfi.%


            newenvironmentpunctitemize
            %
            itemize
            defitemizepunctuationdefitemizepunctuationifhmodeunskipfi;%
            pretocmditemitemizepunctuation%
            pretocmdenditemizeifhmodeunskipfi.%

            %
            enditemize


            begindocument
            beginitemize
            item One
            item Two
            item Three
            enditemize

            beginpunctitemize
            item One
            item Two
            item Three
            endpunctitemize
            enddocument


            enter image description here



            EDIT: added the environment approach, nesting is still not supported.







            share|improve this answer















            share|improve this answer




            share|improve this answer








            edited Sep 7 at 22:36









            user7214865

            1477 bronze badges




            1477 bronze badges










            answered Sep 7 at 18:04









            SkillmonSkillmon

            30.1k1 gold badge30 silver badges63 bronze badges




            30.1k1 gold badge30 silver badges63 bronze badges















            • Thanks for the answer. When you say use a different environment, do you mean add a new punctuateditemize (for example) rather than overriding the default itemize? If so, could you give an example of what this would look like?

              – Marcel
              Sep 7 at 18:06











            • @Marcel see my edit.

              – Skillmon
              Sep 7 at 18:11











            • Thanks for the edit. I am nitpicking now, but if I have a newline in the item, the semicolon / period is on its own line. I don't suppose there is any way to fix that?

              – Marcel
              Sep 7 at 18:26











            • Actually, it looks like that happens if there is a newline in the itemize.

              – Marcel
              Sep 7 at 18:37






            • 1





              @Skillmon Probably Marcel is referring to a blank line between items. Try it.

              – egreg
              Sep 7 at 20:24

















            • Thanks for the answer. When you say use a different environment, do you mean add a new punctuateditemize (for example) rather than overriding the default itemize? If so, could you give an example of what this would look like?

              – Marcel
              Sep 7 at 18:06











            • @Marcel see my edit.

              – Skillmon
              Sep 7 at 18:11











            • Thanks for the edit. I am nitpicking now, but if I have a newline in the item, the semicolon / period is on its own line. I don't suppose there is any way to fix that?

              – Marcel
              Sep 7 at 18:26











            • Actually, it looks like that happens if there is a newline in the itemize.

              – Marcel
              Sep 7 at 18:37






            • 1





              @Skillmon Probably Marcel is referring to a blank line between items. Try it.

              – egreg
              Sep 7 at 20:24
















            Thanks for the answer. When you say use a different environment, do you mean add a new punctuateditemize (for example) rather than overriding the default itemize? If so, could you give an example of what this would look like?

            – Marcel
            Sep 7 at 18:06





            Thanks for the answer. When you say use a different environment, do you mean add a new punctuateditemize (for example) rather than overriding the default itemize? If so, could you give an example of what this would look like?

            – Marcel
            Sep 7 at 18:06













            @Marcel see my edit.

            – Skillmon
            Sep 7 at 18:11





            @Marcel see my edit.

            – Skillmon
            Sep 7 at 18:11













            Thanks for the edit. I am nitpicking now, but if I have a newline in the item, the semicolon / period is on its own line. I don't suppose there is any way to fix that?

            – Marcel
            Sep 7 at 18:26





            Thanks for the edit. I am nitpicking now, but if I have a newline in the item, the semicolon / period is on its own line. I don't suppose there is any way to fix that?

            – Marcel
            Sep 7 at 18:26













            Actually, it looks like that happens if there is a newline in the itemize.

            – Marcel
            Sep 7 at 18:37





            Actually, it looks like that happens if there is a newline in the itemize.

            – Marcel
            Sep 7 at 18:37




            1




            1





            @Skillmon Probably Marcel is referring to a blank line between items. Try it.

            – egreg
            Sep 7 at 20:24





            @Skillmon Probably Marcel is referring to a blank line between items. Try it.

            – egreg
            Sep 7 at 20:24













            7



















            You can use xparse, absorbing the whole contents and splitting it at item; then add a semicolon (and the removed item) between items.



            The processing is complicated by the fact that a blank line between items would introduce a spurious paragraph before the semicolon or the final period, so we need to remove blanks and par tokens at the end of each item.



            Thus the sequence obtained by splitting at item is mapped to “purify” it.



            I added enumitem for maximum flexibility.



            documentclassarticle
            usepackagexparse
            usepackageenumitem

            ExplSyntaxOn

            NewDocumentEnvironmentautoitemizeO +b

            beginitemize[#1]
            marcel_autoitemize:n #2
            enditemize


            seq_new:N l__marcel_autoitemize_items_seq
            seq_new:N l__marcel_autoitemize_items_nopar_seq
            tl_new:N l__marcel_autoitemize_item_tl

            cs_new_protected:Nn marcel_autoitemize:n

            % split the contents at item; this also removes blanks at either end
            seq_set_split:Nnn l__marcel_autoitemize_items_seq item #1
            % remove the first (empty) item
            seq_pop_left:NN l__marcel_autoitemize_items_seq l_tmpa_tl
            % we need to remove trailing par tokens
            seq_clear:N l__marcel_autoitemize_items_nopar_seq
            seq_map_function:NN l__marcel_autoitemize_items_seq __marcel_autoitemize_purify:n
            % start the first item
            item
            % use the sequence, putting a semicolon and item between items
            seq_use:Nn l__marcel_autoitemize_items_nopar_seq ; item
            % end up with a period
            .


            cs_new_protected:Nn __marcel_autoitemize_purify:n

            tl_set:Nn l__marcel_autoitemize_item_tl #1
            regex_replace_once:nnN s* cpar* Z l__marcel_autoitemize_item_tl
            seq_put_right:NV l__marcel_autoitemize_items_nopar_seq l__marcel_autoitemize_item_tl


            ExplSyntaxOff

            begindocument

            beginautoitemize
            item One

            item Two
            item Three
            endautoitemize

            beginautoitemize[label=--]
            item One
            item Two
            item Three
            endautoitemize

            enddocument


            enter image description here






            share|improve this answer






























              7



















              You can use xparse, absorbing the whole contents and splitting it at item; then add a semicolon (and the removed item) between items.



              The processing is complicated by the fact that a blank line between items would introduce a spurious paragraph before the semicolon or the final period, so we need to remove blanks and par tokens at the end of each item.



              Thus the sequence obtained by splitting at item is mapped to “purify” it.



              I added enumitem for maximum flexibility.



              documentclassarticle
              usepackagexparse
              usepackageenumitem

              ExplSyntaxOn

              NewDocumentEnvironmentautoitemizeO +b

              beginitemize[#1]
              marcel_autoitemize:n #2
              enditemize


              seq_new:N l__marcel_autoitemize_items_seq
              seq_new:N l__marcel_autoitemize_items_nopar_seq
              tl_new:N l__marcel_autoitemize_item_tl

              cs_new_protected:Nn marcel_autoitemize:n

              % split the contents at item; this also removes blanks at either end
              seq_set_split:Nnn l__marcel_autoitemize_items_seq item #1
              % remove the first (empty) item
              seq_pop_left:NN l__marcel_autoitemize_items_seq l_tmpa_tl
              % we need to remove trailing par tokens
              seq_clear:N l__marcel_autoitemize_items_nopar_seq
              seq_map_function:NN l__marcel_autoitemize_items_seq __marcel_autoitemize_purify:n
              % start the first item
              item
              % use the sequence, putting a semicolon and item between items
              seq_use:Nn l__marcel_autoitemize_items_nopar_seq ; item
              % end up with a period
              .


              cs_new_protected:Nn __marcel_autoitemize_purify:n

              tl_set:Nn l__marcel_autoitemize_item_tl #1
              regex_replace_once:nnN s* cpar* Z l__marcel_autoitemize_item_tl
              seq_put_right:NV l__marcel_autoitemize_items_nopar_seq l__marcel_autoitemize_item_tl


              ExplSyntaxOff

              begindocument

              beginautoitemize
              item One

              item Two
              item Three
              endautoitemize

              beginautoitemize[label=--]
              item One
              item Two
              item Three
              endautoitemize

              enddocument


              enter image description here






              share|improve this answer




























                7















                7











                7









                You can use xparse, absorbing the whole contents and splitting it at item; then add a semicolon (and the removed item) between items.



                The processing is complicated by the fact that a blank line between items would introduce a spurious paragraph before the semicolon or the final period, so we need to remove blanks and par tokens at the end of each item.



                Thus the sequence obtained by splitting at item is mapped to “purify” it.



                I added enumitem for maximum flexibility.



                documentclassarticle
                usepackagexparse
                usepackageenumitem

                ExplSyntaxOn

                NewDocumentEnvironmentautoitemizeO +b

                beginitemize[#1]
                marcel_autoitemize:n #2
                enditemize


                seq_new:N l__marcel_autoitemize_items_seq
                seq_new:N l__marcel_autoitemize_items_nopar_seq
                tl_new:N l__marcel_autoitemize_item_tl

                cs_new_protected:Nn marcel_autoitemize:n

                % split the contents at item; this also removes blanks at either end
                seq_set_split:Nnn l__marcel_autoitemize_items_seq item #1
                % remove the first (empty) item
                seq_pop_left:NN l__marcel_autoitemize_items_seq l_tmpa_tl
                % we need to remove trailing par tokens
                seq_clear:N l__marcel_autoitemize_items_nopar_seq
                seq_map_function:NN l__marcel_autoitemize_items_seq __marcel_autoitemize_purify:n
                % start the first item
                item
                % use the sequence, putting a semicolon and item between items
                seq_use:Nn l__marcel_autoitemize_items_nopar_seq ; item
                % end up with a period
                .


                cs_new_protected:Nn __marcel_autoitemize_purify:n

                tl_set:Nn l__marcel_autoitemize_item_tl #1
                regex_replace_once:nnN s* cpar* Z l__marcel_autoitemize_item_tl
                seq_put_right:NV l__marcel_autoitemize_items_nopar_seq l__marcel_autoitemize_item_tl


                ExplSyntaxOff

                begindocument

                beginautoitemize
                item One

                item Two
                item Three
                endautoitemize

                beginautoitemize[label=--]
                item One
                item Two
                item Three
                endautoitemize

                enddocument


                enter image description here






                share|improve this answer














                You can use xparse, absorbing the whole contents and splitting it at item; then add a semicolon (and the removed item) between items.



                The processing is complicated by the fact that a blank line between items would introduce a spurious paragraph before the semicolon or the final period, so we need to remove blanks and par tokens at the end of each item.



                Thus the sequence obtained by splitting at item is mapped to “purify” it.



                I added enumitem for maximum flexibility.



                documentclassarticle
                usepackagexparse
                usepackageenumitem

                ExplSyntaxOn

                NewDocumentEnvironmentautoitemizeO +b

                beginitemize[#1]
                marcel_autoitemize:n #2
                enditemize


                seq_new:N l__marcel_autoitemize_items_seq
                seq_new:N l__marcel_autoitemize_items_nopar_seq
                tl_new:N l__marcel_autoitemize_item_tl

                cs_new_protected:Nn marcel_autoitemize:n

                % split the contents at item; this also removes blanks at either end
                seq_set_split:Nnn l__marcel_autoitemize_items_seq item #1
                % remove the first (empty) item
                seq_pop_left:NN l__marcel_autoitemize_items_seq l_tmpa_tl
                % we need to remove trailing par tokens
                seq_clear:N l__marcel_autoitemize_items_nopar_seq
                seq_map_function:NN l__marcel_autoitemize_items_seq __marcel_autoitemize_purify:n
                % start the first item
                item
                % use the sequence, putting a semicolon and item between items
                seq_use:Nn l__marcel_autoitemize_items_nopar_seq ; item
                % end up with a period
                .


                cs_new_protected:Nn __marcel_autoitemize_purify:n

                tl_set:Nn l__marcel_autoitemize_item_tl #1
                regex_replace_once:nnN s* cpar* Z l__marcel_autoitemize_item_tl
                seq_put_right:NV l__marcel_autoitemize_items_nopar_seq l__marcel_autoitemize_item_tl


                ExplSyntaxOff

                begindocument

                beginautoitemize
                item One

                item Two
                item Three
                endautoitemize

                beginautoitemize[label=--]
                item One
                item Two
                item Three
                endautoitemize

                enddocument


                enter image description here







                share|improve this answer













                share|improve this answer




                share|improve this answer










                answered Sep 7 at 20:12









                egregegreg

                783k93 gold badges2038 silver badges3409 bronze badges




                783k93 gold badges2038 silver badges3409 bronze badges































                    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%2f507406%2fautomatically-end-list-item-with-proper-punctuation-semicolon-period%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

                    Tamil (spriik) Luke uk diar | Nawigatjuun

                    Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

                    Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?