Biblatex: showing bibliography group by type while sorting by year descendingBiblatex: divide list of...

Existence of Riemann surface, holomorphic maps

Strange "DuckDuckGo dork" takes me to random website

Changing the laptop's CPU. Should I reinstall Linux?

Why avoid shared user accounts?

How do you voice extended chords?

Globe trotting Grandpa. Where is he going next?

Most demanding German Newspapers

Eww, those bytes are gross

How to make ice magic work from a scientific point of view?

Is there any other language containing the sound of the "evanescent l" in Venetian?

How do I prevent a homebrew Grappling Hook feature from trivializing Tomb of Annihilation?

Why did Democrats in the Senate oppose the Born-Alive Abortion Survivors Protection Act?

False written accusations not made public - is there law to cover this?

How does one write from a minority culture? A question on cultural references

Bash script to truncate subject line of incoming email

Which communication protocol is used in AdLib sound card?

Why was Lupin comfortable with saying Voldemort's name?

Can you tell from a blurry photo if focus was too close or too far?

What will happen if Parliament votes "no" on each of the Brexit-related votes to be held on the 12th, 13th and 14th of March?

How do you catch Smeargle in Pokemon Go?

Citing paid articles from illegal web sharing

How to visualize the Riemann-Roch theorem from complex analysis or geometric topology considerations?

How can the probability of a fumble decrease linearly with more dice?

Macro expansion inside href



Biblatex: showing bibliography group by type while sorting by year descending


Biblatex: divide list of references in subparts by year (descending order)Displaying only the starting page of a page range in bibliographiesSorting of references in Bibliography (books/articles) with correct labelsIs there a more recent bibliography style file (.bst) for PNAS?Bibliography in LaTeX with Biblatex and Biber as backendCiting (author, journalabbr., year) neededBibliography styleTwo-digit year in bib entry for articlesCiting from an Encyclopedia with sub voceBiblatex: Change date/year output for one literature-type onlyHow to sort references by year if they have the same author













0















I am trying to do my CV and would like to build bibliography using Biblatex. In the CV, I have different sections to list my published books, and journal articles, while in each section I want to sort all items by year starting from the most recent.



I was able to sort the entries by year descending following the answer of @moewe: https://tex.stackexchange.com/a/434393/173148. However, when printing bibliography by sections, the years of all publication were shown instead of only the years for the current section.



example picture



The code I used to produce this result: documentclass{article}
usepackage[style=authoryear,sorting=ydnt]{biblatex}
usepackage{filecontents}



begin{filecontents}{jobname.bib}
@book{book1,
author = {author1},
date = {1862},
title = {Book1},
}
@book{book2,
author = {author1 and author2},
date = {1831},
title = {Book2},
}
@article{article1,
title={title1},
author={author1 and author2},
journal={journal1},
volume={1},
number={1},
pages={1},
year={1841}
}
@article{article2,
title={title2},
author={author2},
journal={journal2},
volume={2},
number={2},
pages={2},
year={1842}
}
end{filecontents}

addbibresource{jobname.bib}

usepackage{xparse}

ExplSyntaxOn
seq_new:N g__blxbibbyyear_yearlist_seq

cs_new:Npn __blxbibbyyear_seq_gput_right_once:Nn #1 #2
{
seq_if_in:NnF #1 {#2}
{ seq_gput_right:Nn #1 {#2} }
}

cs_generate_variant:Nn __blxbibbyyear_seq_gput_right_once:Nn { NV, Nx }


prg_new_conditional:Nnn blx_field_if_undef:n { p, T, F , TF }
{
use:c { iffieldundef } { #1 } { prg_return_true: } { prg_return_false: }
}

% unfortunately, iffieldint is not expandable, so no p version for us, boo
prg_new_protected_conditional:Nnn blx_field_if_int:n { T, F , TF }
{
iffieldint { #1 } { prg_return_true: } { prg_return_false: }
}

AtDataInput
{
blx_field_if_undef:nF { labeldatesource }
{
blx_field_if_undef:nTF { thefield{labeldatesource}year }
{
blx_field_if_undef:nF { thefield{labeldatesource} }
{
blx_field_if_int:nT { thefield{labeldatesource} }
{
__blxbibbyyear_seq_gput_right_once:Nx g__blxbibbyyear_yearlist_seq
{ thefield{thefield{labeldatesource}} }
}
}
}
{
__blxbibbyyear_seq_gput_right_once:Nx g__blxbibbyyear_yearlist_seq
{ thefield{thefield{labeldatesource}year} }
}
}
}

cs_new:Npn blxbibbyyear_seq_sort_bydirection:NN #1 #2
{
seq_sort:Nn #2
{
int_compare:nNnTF { ##1 } #1 { ##2 }
{ sort_return_swapped: }
{ sort_return_same: }
}
}

cs_new:Nn blxbibbyyear_seq_sort_descending:N
{
blxbibbyyear_seq_sort_bydirection:NN < #1
}

cs_new_nopar:Npn blxbibbyyear_print_yearbib:nn #1 #2
{
defbibcheck{thisyear}
{
blx_field_if_int:nTF { labelyear }
{
int_compare:nNnF { thefield{labelyear} } = { #1 }
{ skipentry }
}
{ skipentry }
}
printbibliography[heading=subbibliography, title=#1, check=thisyear, #2]
}


DeclareDocumentCommand{printbibbyyear}{O{}}
{
blxbibbyyear_seq_sort_descending:N g__blxbibbyyear_yearlist_seq
seq_map_inline:Nn g__blxbibbyyear_yearlist_seq
{ blxbibbyyear_print_yearbib:nn {##1} {#1} }
}
ExplSyntaxOff

begin{document}
section{Books}
nocite{*}
printbibbyyear[type=book]
section{Articles}
nocite{*}
printbibbyyear[type=article]
end{document}








share







New contributor




Xiaoyu Lu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    I am trying to do my CV and would like to build bibliography using Biblatex. In the CV, I have different sections to list my published books, and journal articles, while in each section I want to sort all items by year starting from the most recent.



    I was able to sort the entries by year descending following the answer of @moewe: https://tex.stackexchange.com/a/434393/173148. However, when printing bibliography by sections, the years of all publication were shown instead of only the years for the current section.



    example picture



    The code I used to produce this result: documentclass{article}
    usepackage[style=authoryear,sorting=ydnt]{biblatex}
    usepackage{filecontents}



    begin{filecontents}{jobname.bib}
    @book{book1,
    author = {author1},
    date = {1862},
    title = {Book1},
    }
    @book{book2,
    author = {author1 and author2},
    date = {1831},
    title = {Book2},
    }
    @article{article1,
    title={title1},
    author={author1 and author2},
    journal={journal1},
    volume={1},
    number={1},
    pages={1},
    year={1841}
    }
    @article{article2,
    title={title2},
    author={author2},
    journal={journal2},
    volume={2},
    number={2},
    pages={2},
    year={1842}
    }
    end{filecontents}

    addbibresource{jobname.bib}

    usepackage{xparse}

    ExplSyntaxOn
    seq_new:N g__blxbibbyyear_yearlist_seq

    cs_new:Npn __blxbibbyyear_seq_gput_right_once:Nn #1 #2
    {
    seq_if_in:NnF #1 {#2}
    { seq_gput_right:Nn #1 {#2} }
    }

    cs_generate_variant:Nn __blxbibbyyear_seq_gput_right_once:Nn { NV, Nx }


    prg_new_conditional:Nnn blx_field_if_undef:n { p, T, F , TF }
    {
    use:c { iffieldundef } { #1 } { prg_return_true: } { prg_return_false: }
    }

    % unfortunately, iffieldint is not expandable, so no p version for us, boo
    prg_new_protected_conditional:Nnn blx_field_if_int:n { T, F , TF }
    {
    iffieldint { #1 } { prg_return_true: } { prg_return_false: }
    }

    AtDataInput
    {
    blx_field_if_undef:nF { labeldatesource }
    {
    blx_field_if_undef:nTF { thefield{labeldatesource}year }
    {
    blx_field_if_undef:nF { thefield{labeldatesource} }
    {
    blx_field_if_int:nT { thefield{labeldatesource} }
    {
    __blxbibbyyear_seq_gput_right_once:Nx g__blxbibbyyear_yearlist_seq
    { thefield{thefield{labeldatesource}} }
    }
    }
    }
    {
    __blxbibbyyear_seq_gput_right_once:Nx g__blxbibbyyear_yearlist_seq
    { thefield{thefield{labeldatesource}year} }
    }
    }
    }

    cs_new:Npn blxbibbyyear_seq_sort_bydirection:NN #1 #2
    {
    seq_sort:Nn #2
    {
    int_compare:nNnTF { ##1 } #1 { ##2 }
    { sort_return_swapped: }
    { sort_return_same: }
    }
    }

    cs_new:Nn blxbibbyyear_seq_sort_descending:N
    {
    blxbibbyyear_seq_sort_bydirection:NN < #1
    }

    cs_new_nopar:Npn blxbibbyyear_print_yearbib:nn #1 #2
    {
    defbibcheck{thisyear}
    {
    blx_field_if_int:nTF { labelyear }
    {
    int_compare:nNnF { thefield{labelyear} } = { #1 }
    { skipentry }
    }
    { skipentry }
    }
    printbibliography[heading=subbibliography, title=#1, check=thisyear, #2]
    }


    DeclareDocumentCommand{printbibbyyear}{O{}}
    {
    blxbibbyyear_seq_sort_descending:N g__blxbibbyyear_yearlist_seq
    seq_map_inline:Nn g__blxbibbyyear_yearlist_seq
    { blxbibbyyear_print_yearbib:nn {##1} {#1} }
    }
    ExplSyntaxOff

    begin{document}
    section{Books}
    nocite{*}
    printbibbyyear[type=book]
    section{Articles}
    nocite{*}
    printbibbyyear[type=article]
    end{document}








    share







    New contributor




    Xiaoyu Lu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I am trying to do my CV and would like to build bibliography using Biblatex. In the CV, I have different sections to list my published books, and journal articles, while in each section I want to sort all items by year starting from the most recent.



      I was able to sort the entries by year descending following the answer of @moewe: https://tex.stackexchange.com/a/434393/173148. However, when printing bibliography by sections, the years of all publication were shown instead of only the years for the current section.



      example picture



      The code I used to produce this result: documentclass{article}
      usepackage[style=authoryear,sorting=ydnt]{biblatex}
      usepackage{filecontents}



      begin{filecontents}{jobname.bib}
      @book{book1,
      author = {author1},
      date = {1862},
      title = {Book1},
      }
      @book{book2,
      author = {author1 and author2},
      date = {1831},
      title = {Book2},
      }
      @article{article1,
      title={title1},
      author={author1 and author2},
      journal={journal1},
      volume={1},
      number={1},
      pages={1},
      year={1841}
      }
      @article{article2,
      title={title2},
      author={author2},
      journal={journal2},
      volume={2},
      number={2},
      pages={2},
      year={1842}
      }
      end{filecontents}

      addbibresource{jobname.bib}

      usepackage{xparse}

      ExplSyntaxOn
      seq_new:N g__blxbibbyyear_yearlist_seq

      cs_new:Npn __blxbibbyyear_seq_gput_right_once:Nn #1 #2
      {
      seq_if_in:NnF #1 {#2}
      { seq_gput_right:Nn #1 {#2} }
      }

      cs_generate_variant:Nn __blxbibbyyear_seq_gput_right_once:Nn { NV, Nx }


      prg_new_conditional:Nnn blx_field_if_undef:n { p, T, F , TF }
      {
      use:c { iffieldundef } { #1 } { prg_return_true: } { prg_return_false: }
      }

      % unfortunately, iffieldint is not expandable, so no p version for us, boo
      prg_new_protected_conditional:Nnn blx_field_if_int:n { T, F , TF }
      {
      iffieldint { #1 } { prg_return_true: } { prg_return_false: }
      }

      AtDataInput
      {
      blx_field_if_undef:nF { labeldatesource }
      {
      blx_field_if_undef:nTF { thefield{labeldatesource}year }
      {
      blx_field_if_undef:nF { thefield{labeldatesource} }
      {
      blx_field_if_int:nT { thefield{labeldatesource} }
      {
      __blxbibbyyear_seq_gput_right_once:Nx g__blxbibbyyear_yearlist_seq
      { thefield{thefield{labeldatesource}} }
      }
      }
      }
      {
      __blxbibbyyear_seq_gput_right_once:Nx g__blxbibbyyear_yearlist_seq
      { thefield{thefield{labeldatesource}year} }
      }
      }
      }

      cs_new:Npn blxbibbyyear_seq_sort_bydirection:NN #1 #2
      {
      seq_sort:Nn #2
      {
      int_compare:nNnTF { ##1 } #1 { ##2 }
      { sort_return_swapped: }
      { sort_return_same: }
      }
      }

      cs_new:Nn blxbibbyyear_seq_sort_descending:N
      {
      blxbibbyyear_seq_sort_bydirection:NN < #1
      }

      cs_new_nopar:Npn blxbibbyyear_print_yearbib:nn #1 #2
      {
      defbibcheck{thisyear}
      {
      blx_field_if_int:nTF { labelyear }
      {
      int_compare:nNnF { thefield{labelyear} } = { #1 }
      { skipentry }
      }
      { skipentry }
      }
      printbibliography[heading=subbibliography, title=#1, check=thisyear, #2]
      }


      DeclareDocumentCommand{printbibbyyear}{O{}}
      {
      blxbibbyyear_seq_sort_descending:N g__blxbibbyyear_yearlist_seq
      seq_map_inline:Nn g__blxbibbyyear_yearlist_seq
      { blxbibbyyear_print_yearbib:nn {##1} {#1} }
      }
      ExplSyntaxOff

      begin{document}
      section{Books}
      nocite{*}
      printbibbyyear[type=book]
      section{Articles}
      nocite{*}
      printbibbyyear[type=article]
      end{document}








      share







      New contributor




      Xiaoyu Lu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I am trying to do my CV and would like to build bibliography using Biblatex. In the CV, I have different sections to list my published books, and journal articles, while in each section I want to sort all items by year starting from the most recent.



      I was able to sort the entries by year descending following the answer of @moewe: https://tex.stackexchange.com/a/434393/173148. However, when printing bibliography by sections, the years of all publication were shown instead of only the years for the current section.



      example picture



      The code I used to produce this result: documentclass{article}
      usepackage[style=authoryear,sorting=ydnt]{biblatex}
      usepackage{filecontents}



      begin{filecontents}{jobname.bib}
      @book{book1,
      author = {author1},
      date = {1862},
      title = {Book1},
      }
      @book{book2,
      author = {author1 and author2},
      date = {1831},
      title = {Book2},
      }
      @article{article1,
      title={title1},
      author={author1 and author2},
      journal={journal1},
      volume={1},
      number={1},
      pages={1},
      year={1841}
      }
      @article{article2,
      title={title2},
      author={author2},
      journal={journal2},
      volume={2},
      number={2},
      pages={2},
      year={1842}
      }
      end{filecontents}

      addbibresource{jobname.bib}

      usepackage{xparse}

      ExplSyntaxOn
      seq_new:N g__blxbibbyyear_yearlist_seq

      cs_new:Npn __blxbibbyyear_seq_gput_right_once:Nn #1 #2
      {
      seq_if_in:NnF #1 {#2}
      { seq_gput_right:Nn #1 {#2} }
      }

      cs_generate_variant:Nn __blxbibbyyear_seq_gput_right_once:Nn { NV, Nx }


      prg_new_conditional:Nnn blx_field_if_undef:n { p, T, F , TF }
      {
      use:c { iffieldundef } { #1 } { prg_return_true: } { prg_return_false: }
      }

      % unfortunately, iffieldint is not expandable, so no p version for us, boo
      prg_new_protected_conditional:Nnn blx_field_if_int:n { T, F , TF }
      {
      iffieldint { #1 } { prg_return_true: } { prg_return_false: }
      }

      AtDataInput
      {
      blx_field_if_undef:nF { labeldatesource }
      {
      blx_field_if_undef:nTF { thefield{labeldatesource}year }
      {
      blx_field_if_undef:nF { thefield{labeldatesource} }
      {
      blx_field_if_int:nT { thefield{labeldatesource} }
      {
      __blxbibbyyear_seq_gput_right_once:Nx g__blxbibbyyear_yearlist_seq
      { thefield{thefield{labeldatesource}} }
      }
      }
      }
      {
      __blxbibbyyear_seq_gput_right_once:Nx g__blxbibbyyear_yearlist_seq
      { thefield{thefield{labeldatesource}year} }
      }
      }
      }

      cs_new:Npn blxbibbyyear_seq_sort_bydirection:NN #1 #2
      {
      seq_sort:Nn #2
      {
      int_compare:nNnTF { ##1 } #1 { ##2 }
      { sort_return_swapped: }
      { sort_return_same: }
      }
      }

      cs_new:Nn blxbibbyyear_seq_sort_descending:N
      {
      blxbibbyyear_seq_sort_bydirection:NN < #1
      }

      cs_new_nopar:Npn blxbibbyyear_print_yearbib:nn #1 #2
      {
      defbibcheck{thisyear}
      {
      blx_field_if_int:nTF { labelyear }
      {
      int_compare:nNnF { thefield{labelyear} } = { #1 }
      { skipentry }
      }
      { skipentry }
      }
      printbibliography[heading=subbibliography, title=#1, check=thisyear, #2]
      }


      DeclareDocumentCommand{printbibbyyear}{O{}}
      {
      blxbibbyyear_seq_sort_descending:N g__blxbibbyyear_yearlist_seq
      seq_map_inline:Nn g__blxbibbyyear_yearlist_seq
      { blxbibbyyear_print_yearbib:nn {##1} {#1} }
      }
      ExplSyntaxOff

      begin{document}
      section{Books}
      nocite{*}
      printbibbyyear[type=book]
      section{Articles}
      nocite{*}
      printbibbyyear[type=article]
      end{document}






      biblatex bibliographies





      share







      New contributor




      Xiaoyu Lu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      Xiaoyu Lu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      Xiaoyu Lu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 6 mins ago









      Xiaoyu LuXiaoyu Lu

      1013




      1013




      New contributor




      Xiaoyu Lu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Xiaoyu Lu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Xiaoyu Lu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          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
          });


          }
          });






          Xiaoyu Lu is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f476863%2fbiblatex-showing-bibliography-group-by-type-while-sorting-by-year-descending%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          Xiaoyu Lu is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Xiaoyu Lu is a new contributor. Be nice, and check out our Code of Conduct.













          Xiaoyu Lu is a new contributor. Be nice, and check out our Code of Conduct.












          Xiaoyu Lu is a new contributor. Be nice, and check out our Code of Conduct.
















          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%2f476863%2fbiblatex-showing-bibliography-group-by-type-while-sorting-by-year-descending%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

          Paper upload error, “Upload failed: The top margin is 0.715 in on page 3, which is below the required...

          Emraan Hashmi Filmografia | Linki zewnętrzne | Menu nawigacyjneGulshan GroverGulshan...

          How can I write this formula?newline and italics added with leqWhy does widehat behave differently if I...