Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A variant of \DeclareSortExclusion #482

Closed
maieul opened this issue Sep 22, 2016 · 5 comments
Closed

A variant of \DeclareSortExclusion #482

maieul opened this issue Sep 22, 2016 · 5 comments

Comments

@maieul
Copy link
Contributor

maieul commented Sep 22, 2016

DeclareSortExclusion allow to exclude some field from sorting for specific entry-type. Should it be possible to have a variant, which will exclude field from entry-type which are not passed as argument.

Here a MWE to understand my need.

\documentclass{book}
\usepackage{filecontents}
\usepackage[citereset=chapter,citestyle=verbose-trad2,bibstyle=verbose]{biblatex}
\begin{filecontents}{\jobname.bib}
@book{A,
  Author={A},
  Title={Toto},
  Maintitle={Ratp}
}

@book{A2,
  Author={A},
  Title={Sncf},
}

@bookinbook{A3,
  Author={A},
  Title={Sncf},
  Booktitle={Ratp},
  Maintitle={Chemin de fer}
}


\end{filecontents}
\bibliography{\jobname.bib}
\DeclareSortExclusion{bookinbook}{maintitle}
\DeclareSortingScheme{nty}{
  \sort{
    \field{presort}
  }
  \sort[final]{
    \field{sortkey}
  }
  \sort{
    \field{sortname}
    \field{author}
    \field{editor}
    \field{translator}
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{sorttitle}
    \field{maintitle}
    \field{title}
  }
  \sort{
    \field{sortyear}
    \field{year}
  }
  \sort{
    \field{volume}
    \literal{0}
  }
}

\begin{document}

\nocite{*}
\printbibliography


\end{document}

My changes on the nty field is required if I want to have a good position for the entry A. However, if I don't do add \DeclareSortExclusion{bookinbook}{maintitle}, there is a problem for the sorting of A3 entry. However, I think it will be better to tell to biber "take account of maintitle only for @book entries", than to tell it "take account of maintitle for all entries except these one`.

@maieul
Copy link
Contributor Author

maieul commented Sep 22, 2016

Ps: by the way, I think my variation of nty should be the default one.

@maieul
Copy link
Contributor Author

maieul commented Sep 22, 2016

For now, I am able to manage it with

\DeclareStyleSourcemap{%
    \maps[datatype=bibtex]{%
        \map[overwrite=false]{%
            \pertype{book}%
              \pertype{collection}%
              \pertype{proceedings}%
              \pertype{reference}%
              \step[fieldsource=maintitle]%
              \step[origfieldval,fieldset=sorttitle]%
            }%
    }%
}%

\DeclareDataInheritance{*}{book,collection,proceedings,reference}{
  \inherit[override=false]{title}{sorttitle}
}

But I am not sur that is the best way.

plk added a commit that referenced this issue Sep 23, 2016
@plk
Copy link
Owner

plk commented Sep 23, 2016

Please try biblatex 3.7 and biber 2.7 from SF. You can do what you want with:

\DeclareSortExclusion{*}{maintitle}
\DeclareSortInclusion{bookinbook}{maintitle}

See the docs for \DeclareSortExclusion and \DeclareSortInclusion

@maieul
Copy link
Contributor Author

maieul commented Sep 23, 2016

many thanks. I will try this week-end, I hope.

Le 23 sept. 2016 � 11:39, plk notifications@github.com a �crit :

Please try biblatex 3.7 and biber 2.7 from SF. You can do what you want with:

\DeclareSortExclusion{*}{maintitle}
\DeclareSortInclusion{bookinbook}{maintitle}

See the docs for \DeclareSortExclusion and \DeclareSortInclusion


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@maieul
Copy link
Contributor Author

maieul commented Sep 24, 2016

I have tried with my example, and it's work.

\DeclareSortExclusion{*}{maintitle}
\DeclareSortInclusion{book}{maintitle}

Many thanks

@plk plk closed this as completed Sep 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants