Hanging indents with a Pandoc bibliography












1















I'm using Pandoc / Markdown / LaTeX to write lab reports.



I've opted to not deal with multiple intermediate files for my bibliography. So I have to use this to generate my documents:



pandoc --csl=apa.csl lab02.md --bibliography=bibtex.bib -o lab02.pdf


This works alright. The issue is that hanging indent does not work. It's easy to solve this through this code block:



begingroup
# References
setlength{parindent}{-0.2in}
setlength{leftskip}{0.2in}
setlength{parskip}{8pt}

<div id="refs"></div>
endgroup


Which is how I am citing references. I have to do this because I have a required section after references, otherwise I could simply do # References and have it automatically put everything in, and just do that setlength stuff once right at the end of the doc.



My question is concerning how to create a custom command to do this faster, because I like hanging indent in some other sections too. I want do do this both for ease of use and to learn how to make commands. I am having trouble doing this on my own.



Ideally it'd be something like: starthang which maps to



begingroup
# References
setlength{parindent}{-0.2in}
setlength{leftskip}{0.2in}
setlength{parskip}{8pt}


And



endhang which just is an alias for endgroup



The best I have come up with is this, which doesn't seem to work:



newenvironment{hang}
{ {begingroup
setlength{parindent}{-0.2in}
setlength{leftskip}{0.2in}
setlength{parskip}{8pt}
}
{
endgroup
}
}


Any ideas greatly appreciated.










share|improve this question





























    1















    I'm using Pandoc / Markdown / LaTeX to write lab reports.



    I've opted to not deal with multiple intermediate files for my bibliography. So I have to use this to generate my documents:



    pandoc --csl=apa.csl lab02.md --bibliography=bibtex.bib -o lab02.pdf


    This works alright. The issue is that hanging indent does not work. It's easy to solve this through this code block:



    begingroup
    # References
    setlength{parindent}{-0.2in}
    setlength{leftskip}{0.2in}
    setlength{parskip}{8pt}

    <div id="refs"></div>
    endgroup


    Which is how I am citing references. I have to do this because I have a required section after references, otherwise I could simply do # References and have it automatically put everything in, and just do that setlength stuff once right at the end of the doc.



    My question is concerning how to create a custom command to do this faster, because I like hanging indent in some other sections too. I want do do this both for ease of use and to learn how to make commands. I am having trouble doing this on my own.



    Ideally it'd be something like: starthang which maps to



    begingroup
    # References
    setlength{parindent}{-0.2in}
    setlength{leftskip}{0.2in}
    setlength{parskip}{8pt}


    And



    endhang which just is an alias for endgroup



    The best I have come up with is this, which doesn't seem to work:



    newenvironment{hang}
    { {begingroup
    setlength{parindent}{-0.2in}
    setlength{leftskip}{0.2in}
    setlength{parskip}{8pt}
    }
    {
    endgroup
    }
    }


    Any ideas greatly appreciated.










    share|improve this question



























      1












      1








      1








      I'm using Pandoc / Markdown / LaTeX to write lab reports.



      I've opted to not deal with multiple intermediate files for my bibliography. So I have to use this to generate my documents:



      pandoc --csl=apa.csl lab02.md --bibliography=bibtex.bib -o lab02.pdf


      This works alright. The issue is that hanging indent does not work. It's easy to solve this through this code block:



      begingroup
      # References
      setlength{parindent}{-0.2in}
      setlength{leftskip}{0.2in}
      setlength{parskip}{8pt}

      <div id="refs"></div>
      endgroup


      Which is how I am citing references. I have to do this because I have a required section after references, otherwise I could simply do # References and have it automatically put everything in, and just do that setlength stuff once right at the end of the doc.



      My question is concerning how to create a custom command to do this faster, because I like hanging indent in some other sections too. I want do do this both for ease of use and to learn how to make commands. I am having trouble doing this on my own.



      Ideally it'd be something like: starthang which maps to



      begingroup
      # References
      setlength{parindent}{-0.2in}
      setlength{leftskip}{0.2in}
      setlength{parskip}{8pt}


      And



      endhang which just is an alias for endgroup



      The best I have come up with is this, which doesn't seem to work:



      newenvironment{hang}
      { {begingroup
      setlength{parindent}{-0.2in}
      setlength{leftskip}{0.2in}
      setlength{parskip}{8pt}
      }
      {
      endgroup
      }
      }


      Any ideas greatly appreciated.










      share|improve this question
















      I'm using Pandoc / Markdown / LaTeX to write lab reports.



      I've opted to not deal with multiple intermediate files for my bibliography. So I have to use this to generate my documents:



      pandoc --csl=apa.csl lab02.md --bibliography=bibtex.bib -o lab02.pdf


      This works alright. The issue is that hanging indent does not work. It's easy to solve this through this code block:



      begingroup
      # References
      setlength{parindent}{-0.2in}
      setlength{leftskip}{0.2in}
      setlength{parskip}{8pt}

      <div id="refs"></div>
      endgroup


      Which is how I am citing references. I have to do this because I have a required section after references, otherwise I could simply do # References and have it automatically put everything in, and just do that setlength stuff once right at the end of the doc.



      My question is concerning how to create a custom command to do this faster, because I like hanging indent in some other sections too. I want do do this both for ease of use and to learn how to make commands. I am having trouble doing this on my own.



      Ideally it'd be something like: starthang which maps to



      begingroup
      # References
      setlength{parindent}{-0.2in}
      setlength{leftskip}{0.2in}
      setlength{parskip}{8pt}


      And



      endhang which just is an alias for endgroup



      The best I have come up with is this, which doesn't seem to work:



      newenvironment{hang}
      { {begingroup
      setlength{parindent}{-0.2in}
      setlength{leftskip}{0.2in}
      setlength{parskip}{8pt}
      }
      {
      endgroup
      }
      }


      Any ideas greatly appreciated.







      pdf pandoc markdown






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 5 at 4:41









      JouleV

      4,98111239




      4,98111239










      asked Feb 28 at 21:07









      Atticus MassieAtticus Massie

      61




      61






















          1 Answer
          1






          active

          oldest

          votes


















          2














          One easy solution is to use the hangparas environment from the hanging package:



          Pandoc Bibliography example with hangparas



          ---
          header-includes: |
          usepackage{hanging}
          references:
          - id: 'abou-el-haj:1983bury'
          type: article-journal
          title: >-
          Bury St Edmunds Abbey Between 1070 and 1124: A History of Property,
          Privilege, and Monastic Art Production
          container-title: Art History
          page: 1-29
          volume: '6'
          issue: '1'
          DOI: 10/gftmwk
          author:
          - family: Abou-El-Haj
          given: Barbara
          issued:
          - year: 1983
          month: 3
          - id: 'abou-el-haj:1991audiences'
          type: article-journal
          title: The audiences for the medieval cult of saints
          container-title: Gesta
          page: 3-15
          volume: '30'
          issue: '1'
          DOI: 10/bhjtnp
          author:
          - family: Abou-El-Haj
          given: Barbara
          issued:
          - year: 1991
          ---

          [@abou-el-haj:1983bury; @abou-el-haj:1991audiences]

          # References

          ```{=latex}
          begin{hangparas}{1em}{1}
          ```

          <div id="refs"></div>

          ```{=latex}
          end{hangparas}
          ```





          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/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%2f477219%2fhanging-indents-with-a-pandoc-bibliography%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









            2














            One easy solution is to use the hangparas environment from the hanging package:



            Pandoc Bibliography example with hangparas



            ---
            header-includes: |
            usepackage{hanging}
            references:
            - id: 'abou-el-haj:1983bury'
            type: article-journal
            title: >-
            Bury St Edmunds Abbey Between 1070 and 1124: A History of Property,
            Privilege, and Monastic Art Production
            container-title: Art History
            page: 1-29
            volume: '6'
            issue: '1'
            DOI: 10/gftmwk
            author:
            - family: Abou-El-Haj
            given: Barbara
            issued:
            - year: 1983
            month: 3
            - id: 'abou-el-haj:1991audiences'
            type: article-journal
            title: The audiences for the medieval cult of saints
            container-title: Gesta
            page: 3-15
            volume: '30'
            issue: '1'
            DOI: 10/bhjtnp
            author:
            - family: Abou-El-Haj
            given: Barbara
            issued:
            - year: 1991
            ---

            [@abou-el-haj:1983bury; @abou-el-haj:1991audiences]

            # References

            ```{=latex}
            begin{hangparas}{1em}{1}
            ```

            <div id="refs"></div>

            ```{=latex}
            end{hangparas}
            ```





            share|improve this answer




























              2














              One easy solution is to use the hangparas environment from the hanging package:



              Pandoc Bibliography example with hangparas



              ---
              header-includes: |
              usepackage{hanging}
              references:
              - id: 'abou-el-haj:1983bury'
              type: article-journal
              title: >-
              Bury St Edmunds Abbey Between 1070 and 1124: A History of Property,
              Privilege, and Monastic Art Production
              container-title: Art History
              page: 1-29
              volume: '6'
              issue: '1'
              DOI: 10/gftmwk
              author:
              - family: Abou-El-Haj
              given: Barbara
              issued:
              - year: 1983
              month: 3
              - id: 'abou-el-haj:1991audiences'
              type: article-journal
              title: The audiences for the medieval cult of saints
              container-title: Gesta
              page: 3-15
              volume: '30'
              issue: '1'
              DOI: 10/bhjtnp
              author:
              - family: Abou-El-Haj
              given: Barbara
              issued:
              - year: 1991
              ---

              [@abou-el-haj:1983bury; @abou-el-haj:1991audiences]

              # References

              ```{=latex}
              begin{hangparas}{1em}{1}
              ```

              <div id="refs"></div>

              ```{=latex}
              end{hangparas}
              ```





              share|improve this answer


























                2












                2








                2







                One easy solution is to use the hangparas environment from the hanging package:



                Pandoc Bibliography example with hangparas



                ---
                header-includes: |
                usepackage{hanging}
                references:
                - id: 'abou-el-haj:1983bury'
                type: article-journal
                title: >-
                Bury St Edmunds Abbey Between 1070 and 1124: A History of Property,
                Privilege, and Monastic Art Production
                container-title: Art History
                page: 1-29
                volume: '6'
                issue: '1'
                DOI: 10/gftmwk
                author:
                - family: Abou-El-Haj
                given: Barbara
                issued:
                - year: 1983
                month: 3
                - id: 'abou-el-haj:1991audiences'
                type: article-journal
                title: The audiences for the medieval cult of saints
                container-title: Gesta
                page: 3-15
                volume: '30'
                issue: '1'
                DOI: 10/bhjtnp
                author:
                - family: Abou-El-Haj
                given: Barbara
                issued:
                - year: 1991
                ---

                [@abou-el-haj:1983bury; @abou-el-haj:1991audiences]

                # References

                ```{=latex}
                begin{hangparas}{1em}{1}
                ```

                <div id="refs"></div>

                ```{=latex}
                end{hangparas}
                ```





                share|improve this answer













                One easy solution is to use the hangparas environment from the hanging package:



                Pandoc Bibliography example with hangparas



                ---
                header-includes: |
                usepackage{hanging}
                references:
                - id: 'abou-el-haj:1983bury'
                type: article-journal
                title: >-
                Bury St Edmunds Abbey Between 1070 and 1124: A History of Property,
                Privilege, and Monastic Art Production
                container-title: Art History
                page: 1-29
                volume: '6'
                issue: '1'
                DOI: 10/gftmwk
                author:
                - family: Abou-El-Haj
                given: Barbara
                issued:
                - year: 1983
                month: 3
                - id: 'abou-el-haj:1991audiences'
                type: article-journal
                title: The audiences for the medieval cult of saints
                container-title: Gesta
                page: 3-15
                volume: '30'
                issue: '1'
                DOI: 10/bhjtnp
                author:
                - family: Abou-El-Haj
                given: Barbara
                issued:
                - year: 1991
                ---

                [@abou-el-haj:1983bury; @abou-el-haj:1991audiences]

                # References

                ```{=latex}
                begin{hangparas}{1em}{1}
                ```

                <div id="refs"></div>

                ```{=latex}
                end{hangparas}
                ```






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 4 at 19:13









                Andrew DunningAndrew Dunning

                617315




                617315






























                    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%2f477219%2fhanging-indents-with-a-pandoc-bibliography%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?