Long command at the end of list












2















With setlist option of package enumitem I'm trying to add some text at the end of an enumerated list. I'm also trying to center some part of this text, but some extra vertical space gets inserted. Here is my code:



documentclass{article}
usepackage{enumitem}


newlist{mylist}{enumerate}{3}
setlist*[mylist]{label=arabic*}
setlist*[mylist]{after*=endgraf
bigskip
bigskip
Some text some text
begin{center}
some centered text
end{center}
Some text some text
}

begin{document}
setlength{topsep}{0pt}
setlength{parskip}{0pt}
With enumerate
begin{mylist}
item First item
end{mylist}

Without enumerate (which looks like the thing I want to have):

1 First itempar
bigskip
bigskip
Some text some text
begin{center}
some centered text
end{center}
Some text some text

end{document}


(topsep and parskip are set to 0 so extra space makes more difference)
I suppose long command inserted with after= to the end of the list generates error. Is there a way to put long command there properly?



I can force good-looking output with some negative vspace but I hope there is some more elegant solution.



EDIT: Thanks to comment by Phelype Oleinik I put endgraf where I couldn't use par. Spacing is now better, but still there is clearly some extra vertical space which I can't remove.










share|improve this question




















  • 1





    Use endgraf where you can't use par.

    – Phelype Oleinik
    Jan 25 at 21:24
















2















With setlist option of package enumitem I'm trying to add some text at the end of an enumerated list. I'm also trying to center some part of this text, but some extra vertical space gets inserted. Here is my code:



documentclass{article}
usepackage{enumitem}


newlist{mylist}{enumerate}{3}
setlist*[mylist]{label=arabic*}
setlist*[mylist]{after*=endgraf
bigskip
bigskip
Some text some text
begin{center}
some centered text
end{center}
Some text some text
}

begin{document}
setlength{topsep}{0pt}
setlength{parskip}{0pt}
With enumerate
begin{mylist}
item First item
end{mylist}

Without enumerate (which looks like the thing I want to have):

1 First itempar
bigskip
bigskip
Some text some text
begin{center}
some centered text
end{center}
Some text some text

end{document}


(topsep and parskip are set to 0 so extra space makes more difference)
I suppose long command inserted with after= to the end of the list generates error. Is there a way to put long command there properly?



I can force good-looking output with some negative vspace but I hope there is some more elegant solution.



EDIT: Thanks to comment by Phelype Oleinik I put endgraf where I couldn't use par. Spacing is now better, but still there is clearly some extra vertical space which I can't remove.










share|improve this question




















  • 1





    Use endgraf where you can't use par.

    – Phelype Oleinik
    Jan 25 at 21:24














2












2








2


0






With setlist option of package enumitem I'm trying to add some text at the end of an enumerated list. I'm also trying to center some part of this text, but some extra vertical space gets inserted. Here is my code:



documentclass{article}
usepackage{enumitem}


newlist{mylist}{enumerate}{3}
setlist*[mylist]{label=arabic*}
setlist*[mylist]{after*=endgraf
bigskip
bigskip
Some text some text
begin{center}
some centered text
end{center}
Some text some text
}

begin{document}
setlength{topsep}{0pt}
setlength{parskip}{0pt}
With enumerate
begin{mylist}
item First item
end{mylist}

Without enumerate (which looks like the thing I want to have):

1 First itempar
bigskip
bigskip
Some text some text
begin{center}
some centered text
end{center}
Some text some text

end{document}


(topsep and parskip are set to 0 so extra space makes more difference)
I suppose long command inserted with after= to the end of the list generates error. Is there a way to put long command there properly?



I can force good-looking output with some negative vspace but I hope there is some more elegant solution.



EDIT: Thanks to comment by Phelype Oleinik I put endgraf where I couldn't use par. Spacing is now better, but still there is clearly some extra vertical space which I can't remove.










share|improve this question
















With setlist option of package enumitem I'm trying to add some text at the end of an enumerated list. I'm also trying to center some part of this text, but some extra vertical space gets inserted. Here is my code:



documentclass{article}
usepackage{enumitem}


newlist{mylist}{enumerate}{3}
setlist*[mylist]{label=arabic*}
setlist*[mylist]{after*=endgraf
bigskip
bigskip
Some text some text
begin{center}
some centered text
end{center}
Some text some text
}

begin{document}
setlength{topsep}{0pt}
setlength{parskip}{0pt}
With enumerate
begin{mylist}
item First item
end{mylist}

Without enumerate (which looks like the thing I want to have):

1 First itempar
bigskip
bigskip
Some text some text
begin{center}
some centered text
end{center}
Some text some text

end{document}


(topsep and parskip are set to 0 so extra space makes more difference)
I suppose long command inserted with after= to the end of the list generates error. Is there a way to put long command there properly?



I can force good-looking output with some negative vspace but I hope there is some more elegant solution.



EDIT: Thanks to comment by Phelype Oleinik I put endgraf where I couldn't use par. Spacing is now better, but still there is clearly some extra vertical space which I can't remove.







spacing enumitem






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 25 at 21:41







Tomasz23

















asked Jan 25 at 21:03









Tomasz23Tomasz23

506




506








  • 1





    Use endgraf where you can't use par.

    – Phelype Oleinik
    Jan 25 at 21:24














  • 1





    Use endgraf where you can't use par.

    – Phelype Oleinik
    Jan 25 at 21:24








1




1





Use endgraf where you can't use par.

– Phelype Oleinik
Jan 25 at 21:24





Use endgraf where you can't use par.

– Phelype Oleinik
Jan 25 at 21:24










2 Answers
2






active

oldest

votes


















2














It's simpler if you use a macro for after:



documentclass{article}
usepackage{enumitem}

newlist{mylist}{enumerate}{3}
setlist*[mylist]{label=arabic*}
setlist*[mylist]{after*=addtext}

newcommand{addtext}{%
vspace*{bigskipamount}
begin{center}
setlength{parskip}{0pt}% remove the vertical space
Some text some texthspace*{fill}par
some centered textpar
Some text some texthspace*{fill}
end{center}
}

begin{document}

begin{mylist}
item First item
item Second item
end{mylist}

end{document}


enter image description here






share|improve this answer































    0














    Is this what you want (I coloured the after part to visualise):



     documentclass{article}
    usepackage{enumitem}
    usepackage{changepage, xcolor}
    usepackage[showframe]{geometry}
    newlengthlabelwd
    settowidth{labelwd}{0}
    newlist{mylist}{enumerate}{3}
    setlist*[mylist]{label=arabic*,start = 6}
    setlist*[mylist]{after*=endgraf
    bigskip
    bigskip
    hspace*{dimexprleftmargini-labelsep-labelwdrelax}color{red}Some text some text \
    nullhfill some centered text hfillnull \
    Some text some text
    }

    begin{document}
    setlength{topsep}{0pt}
    setlength{parskip}{0pt}
    With enumerate
    begin{mylist}
    item First item
    end{mylist}

    Without enumerate (which looks like the thing I want to have):

    1 First itempar
    bigskip
    bigskip
    Some text some text
    begin{center}
    some centered text
    end{center}
    Some text some text

    end{document}


    enter image description here






    share|improve this answer


























    • No, as I said there is some added space between ,,some centered text'' and ,,some text''. I want to have no vertical space there (as in the example outside of the list). Fortunately, egreg's answer provided a solution to this.

      – Tomasz23
      Jan 25 at 23:40











    • @Tomasz23: I must say I overlooked the vertical spacing. Please see my updated code.

      – Bernard
      Jan 25 at 23:54











    • The output you presented is correct, however the code does not compile. I think you must have made typos in leftmargini and labelwd, since they are not recognised by the compiler.

      – Tomasz23
      Jan 26 at 0:16











    • As I replaced only what was modified in the code, maybe there were some typos. I've replaced with a full copy of my code, which naturally compiles for me.

      – Bernard
      Jan 26 at 0:26











    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%2f471890%2flong-command-at-the-end-of-list%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









    2














    It's simpler if you use a macro for after:



    documentclass{article}
    usepackage{enumitem}

    newlist{mylist}{enumerate}{3}
    setlist*[mylist]{label=arabic*}
    setlist*[mylist]{after*=addtext}

    newcommand{addtext}{%
    vspace*{bigskipamount}
    begin{center}
    setlength{parskip}{0pt}% remove the vertical space
    Some text some texthspace*{fill}par
    some centered textpar
    Some text some texthspace*{fill}
    end{center}
    }

    begin{document}

    begin{mylist}
    item First item
    item Second item
    end{mylist}

    end{document}


    enter image description here






    share|improve this answer




























      2














      It's simpler if you use a macro for after:



      documentclass{article}
      usepackage{enumitem}

      newlist{mylist}{enumerate}{3}
      setlist*[mylist]{label=arabic*}
      setlist*[mylist]{after*=addtext}

      newcommand{addtext}{%
      vspace*{bigskipamount}
      begin{center}
      setlength{parskip}{0pt}% remove the vertical space
      Some text some texthspace*{fill}par
      some centered textpar
      Some text some texthspace*{fill}
      end{center}
      }

      begin{document}

      begin{mylist}
      item First item
      item Second item
      end{mylist}

      end{document}


      enter image description here






      share|improve this answer


























        2












        2








        2







        It's simpler if you use a macro for after:



        documentclass{article}
        usepackage{enumitem}

        newlist{mylist}{enumerate}{3}
        setlist*[mylist]{label=arabic*}
        setlist*[mylist]{after*=addtext}

        newcommand{addtext}{%
        vspace*{bigskipamount}
        begin{center}
        setlength{parskip}{0pt}% remove the vertical space
        Some text some texthspace*{fill}par
        some centered textpar
        Some text some texthspace*{fill}
        end{center}
        }

        begin{document}

        begin{mylist}
        item First item
        item Second item
        end{mylist}

        end{document}


        enter image description here






        share|improve this answer













        It's simpler if you use a macro for after:



        documentclass{article}
        usepackage{enumitem}

        newlist{mylist}{enumerate}{3}
        setlist*[mylist]{label=arabic*}
        setlist*[mylist]{after*=addtext}

        newcommand{addtext}{%
        vspace*{bigskipamount}
        begin{center}
        setlength{parskip}{0pt}% remove the vertical space
        Some text some texthspace*{fill}par
        some centered textpar
        Some text some texthspace*{fill}
        end{center}
        }

        begin{document}

        begin{mylist}
        item First item
        item Second item
        end{mylist}

        end{document}


        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 25 at 22:26









        egregegreg

        717k8619023191




        717k8619023191























            0














            Is this what you want (I coloured the after part to visualise):



             documentclass{article}
            usepackage{enumitem}
            usepackage{changepage, xcolor}
            usepackage[showframe]{geometry}
            newlengthlabelwd
            settowidth{labelwd}{0}
            newlist{mylist}{enumerate}{3}
            setlist*[mylist]{label=arabic*,start = 6}
            setlist*[mylist]{after*=endgraf
            bigskip
            bigskip
            hspace*{dimexprleftmargini-labelsep-labelwdrelax}color{red}Some text some text \
            nullhfill some centered text hfillnull \
            Some text some text
            }

            begin{document}
            setlength{topsep}{0pt}
            setlength{parskip}{0pt}
            With enumerate
            begin{mylist}
            item First item
            end{mylist}

            Without enumerate (which looks like the thing I want to have):

            1 First itempar
            bigskip
            bigskip
            Some text some text
            begin{center}
            some centered text
            end{center}
            Some text some text

            end{document}


            enter image description here






            share|improve this answer


























            • No, as I said there is some added space between ,,some centered text'' and ,,some text''. I want to have no vertical space there (as in the example outside of the list). Fortunately, egreg's answer provided a solution to this.

              – Tomasz23
              Jan 25 at 23:40











            • @Tomasz23: I must say I overlooked the vertical spacing. Please see my updated code.

              – Bernard
              Jan 25 at 23:54











            • The output you presented is correct, however the code does not compile. I think you must have made typos in leftmargini and labelwd, since they are not recognised by the compiler.

              – Tomasz23
              Jan 26 at 0:16











            • As I replaced only what was modified in the code, maybe there were some typos. I've replaced with a full copy of my code, which naturally compiles for me.

              – Bernard
              Jan 26 at 0:26
















            0














            Is this what you want (I coloured the after part to visualise):



             documentclass{article}
            usepackage{enumitem}
            usepackage{changepage, xcolor}
            usepackage[showframe]{geometry}
            newlengthlabelwd
            settowidth{labelwd}{0}
            newlist{mylist}{enumerate}{3}
            setlist*[mylist]{label=arabic*,start = 6}
            setlist*[mylist]{after*=endgraf
            bigskip
            bigskip
            hspace*{dimexprleftmargini-labelsep-labelwdrelax}color{red}Some text some text \
            nullhfill some centered text hfillnull \
            Some text some text
            }

            begin{document}
            setlength{topsep}{0pt}
            setlength{parskip}{0pt}
            With enumerate
            begin{mylist}
            item First item
            end{mylist}

            Without enumerate (which looks like the thing I want to have):

            1 First itempar
            bigskip
            bigskip
            Some text some text
            begin{center}
            some centered text
            end{center}
            Some text some text

            end{document}


            enter image description here






            share|improve this answer


























            • No, as I said there is some added space between ,,some centered text'' and ,,some text''. I want to have no vertical space there (as in the example outside of the list). Fortunately, egreg's answer provided a solution to this.

              – Tomasz23
              Jan 25 at 23:40











            • @Tomasz23: I must say I overlooked the vertical spacing. Please see my updated code.

              – Bernard
              Jan 25 at 23:54











            • The output you presented is correct, however the code does not compile. I think you must have made typos in leftmargini and labelwd, since they are not recognised by the compiler.

              – Tomasz23
              Jan 26 at 0:16











            • As I replaced only what was modified in the code, maybe there were some typos. I've replaced with a full copy of my code, which naturally compiles for me.

              – Bernard
              Jan 26 at 0:26














            0












            0








            0







            Is this what you want (I coloured the after part to visualise):



             documentclass{article}
            usepackage{enumitem}
            usepackage{changepage, xcolor}
            usepackage[showframe]{geometry}
            newlengthlabelwd
            settowidth{labelwd}{0}
            newlist{mylist}{enumerate}{3}
            setlist*[mylist]{label=arabic*,start = 6}
            setlist*[mylist]{after*=endgraf
            bigskip
            bigskip
            hspace*{dimexprleftmargini-labelsep-labelwdrelax}color{red}Some text some text \
            nullhfill some centered text hfillnull \
            Some text some text
            }

            begin{document}
            setlength{topsep}{0pt}
            setlength{parskip}{0pt}
            With enumerate
            begin{mylist}
            item First item
            end{mylist}

            Without enumerate (which looks like the thing I want to have):

            1 First itempar
            bigskip
            bigskip
            Some text some text
            begin{center}
            some centered text
            end{center}
            Some text some text

            end{document}


            enter image description here






            share|improve this answer















            Is this what you want (I coloured the after part to visualise):



             documentclass{article}
            usepackage{enumitem}
            usepackage{changepage, xcolor}
            usepackage[showframe]{geometry}
            newlengthlabelwd
            settowidth{labelwd}{0}
            newlist{mylist}{enumerate}{3}
            setlist*[mylist]{label=arabic*,start = 6}
            setlist*[mylist]{after*=endgraf
            bigskip
            bigskip
            hspace*{dimexprleftmargini-labelsep-labelwdrelax}color{red}Some text some text \
            nullhfill some centered text hfillnull \
            Some text some text
            }

            begin{document}
            setlength{topsep}{0pt}
            setlength{parskip}{0pt}
            With enumerate
            begin{mylist}
            item First item
            end{mylist}

            Without enumerate (which looks like the thing I want to have):

            1 First itempar
            bigskip
            bigskip
            Some text some text
            begin{center}
            some centered text
            end{center}
            Some text some text

            end{document}


            enter image description here







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 26 at 0:24

























            answered Jan 25 at 23:13









            BernardBernard

            168k772197




            168k772197













            • No, as I said there is some added space between ,,some centered text'' and ,,some text''. I want to have no vertical space there (as in the example outside of the list). Fortunately, egreg's answer provided a solution to this.

              – Tomasz23
              Jan 25 at 23:40











            • @Tomasz23: I must say I overlooked the vertical spacing. Please see my updated code.

              – Bernard
              Jan 25 at 23:54











            • The output you presented is correct, however the code does not compile. I think you must have made typos in leftmargini and labelwd, since they are not recognised by the compiler.

              – Tomasz23
              Jan 26 at 0:16











            • As I replaced only what was modified in the code, maybe there were some typos. I've replaced with a full copy of my code, which naturally compiles for me.

              – Bernard
              Jan 26 at 0:26



















            • No, as I said there is some added space between ,,some centered text'' and ,,some text''. I want to have no vertical space there (as in the example outside of the list). Fortunately, egreg's answer provided a solution to this.

              – Tomasz23
              Jan 25 at 23:40











            • @Tomasz23: I must say I overlooked the vertical spacing. Please see my updated code.

              – Bernard
              Jan 25 at 23:54











            • The output you presented is correct, however the code does not compile. I think you must have made typos in leftmargini and labelwd, since they are not recognised by the compiler.

              – Tomasz23
              Jan 26 at 0:16











            • As I replaced only what was modified in the code, maybe there were some typos. I've replaced with a full copy of my code, which naturally compiles for me.

              – Bernard
              Jan 26 at 0:26

















            No, as I said there is some added space between ,,some centered text'' and ,,some text''. I want to have no vertical space there (as in the example outside of the list). Fortunately, egreg's answer provided a solution to this.

            – Tomasz23
            Jan 25 at 23:40





            No, as I said there is some added space between ,,some centered text'' and ,,some text''. I want to have no vertical space there (as in the example outside of the list). Fortunately, egreg's answer provided a solution to this.

            – Tomasz23
            Jan 25 at 23:40













            @Tomasz23: I must say I overlooked the vertical spacing. Please see my updated code.

            – Bernard
            Jan 25 at 23:54





            @Tomasz23: I must say I overlooked the vertical spacing. Please see my updated code.

            – Bernard
            Jan 25 at 23:54













            The output you presented is correct, however the code does not compile. I think you must have made typos in leftmargini and labelwd, since they are not recognised by the compiler.

            – Tomasz23
            Jan 26 at 0:16





            The output you presented is correct, however the code does not compile. I think you must have made typos in leftmargini and labelwd, since they are not recognised by the compiler.

            – Tomasz23
            Jan 26 at 0:16













            As I replaced only what was modified in the code, maybe there were some typos. I've replaced with a full copy of my code, which naturally compiles for me.

            – Bernard
            Jan 26 at 0:26





            As I replaced only what was modified in the code, maybe there were some typos. I've replaced with a full copy of my code, which naturally compiles for me.

            – Bernard
            Jan 26 at 0:26


















            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%2f471890%2flong-command-at-the-end-of-list%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

            How to change which sound is reproduced for terminal bell?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Can I use Tabulator js library in my java Spring + Thymeleaf project?