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

titlecase not used for related entries #22

Closed
rzach opened this issue Jun 5, 2021 · 7 comments
Closed

titlecase not used for related entries #22

rzach opened this issue Jun 5, 2021 · 7 comments
Labels
bug Something isn't working
Milestone

Comments

@rzach
Copy link

rzach commented Jun 5, 2021

Describe the bug

Changing the casing of titles using the titlecase: mechanism doesn't work in the formatting of related entries. I have

\DeclareFieldFormat[article,incollection,inproceedings,inbook,unpublished]{titlecase:title}{\MakeSentenceCase*{#1}}

to make titles of journal articles etc. sentence case, but the title of a related entry is still title cased.

To Reproduce
Example attached.
test.zip

Expected behaviour
Title of original and related entry should both have sentence casing applied.

Output
Screenshot from 2021-06-05 13-12-50

Additional context
ext-authoryear.bbx 2021/04/22 v0.12b

@rzach rzach added the bug Something isn't working label Jun 5, 2021
moewew added a commit that referenced this issue Jun 6, 2021
We need to avoid using the redefined version of the macros
that might come with dashed (not that big of an issue)
or authoryear changes (print title instead of name).
moewew added a commit that referenced this issue Jun 6, 2021
@moewew
Copy link
Owner

moewew commented Jun 6, 2021

Thank you very much for reporting this issue.

related:default deletes the author if it coincides with the author of the referring entry. In authoryear styles that means that the title takes the author position, in which case it is printed in a slightly different format. For related entries we don't want that, so 05d5465 simply forces a normal version of the author macro that does not use the title as fallback.

I will investigate the related issue of how exactly the title should be formatted when it replaces the author and will then released a fixed version.

In the meantime here is a workaround

\documentclass{article}
\usepackage[style=ext-authoryear]{biblatex}

\DeclareFieldFormat[article,incollection,inproceedings,inbook,unpublished]{titlecase:title}{\MakeSentenceCase*{#1}}

\newbibmacro*{plain:author}{%
  \ifboolexpr{
    test \ifuseauthor
    and
    not test {\ifnameundef{author}}
  }
    {\printnames{author}%
     \iffieldundef{authortype}
       {}
       {\setunit{\printdelim{authortypedelim}}%
        \usebibmacro{authorstrg}}}
    {}}

\newbibmacro*{plain:editor}{%
  \ifboolexpr{
    test \ifuseeditor
    and
    not test {\ifnameundef{editor}}
  }
    {\printnames{editor}%
     \setunit{\printdelim{editortypedelim}}%
     \usebibmacro{editorstrg}%
     \clearname{editor}}
    {}}

\newbibmacro*{plain:editor+others}{%
  \ifboolexpr{
    test \ifuseeditor
    and
    not test {\ifnameundef{editor}}
  }
    {\printnames{editor}%
     \setunit{\printdelim{editortypedelim}}%
     \usebibmacro{editor+othersstrg}%
     \clearname{editor}}
    {}}

\newbibmacro*{plain:translator}{%
  \ifboolexpr{
    test \ifusetranslator
    and
    not test {\ifnameundef{translator}}
  }
    {\printnames{translator}%
     \setunit{\printdelim{translatortypedelim}}%
     \usebibmacro{translatorstrg}%
     \clearname{translator}}
    {}}

\newbibmacro*{plain:translator+others}{%
  \ifboolexpr{
    test \ifusetranslator
    and
    not test {\ifnameundef{translator}}
  }
    {\printnames{translator}%
     \setunit{\printdelim{translatortypedelim}}%
     \usebibmacro{translator+othersstrg}%
     \clearname{translator}}
    {}}

\makeatletter
\newbibmacro*{related:default}[1]{%
  \entrydata*{#1}{%
    \usedriver
      {\DeclareNameAlias{sortname}{default}%
       \ifnameundef{savedauthor}
         {\ifnameundef{savededitor}
            {}
            {\ifnamesequal{editor}{savededitor}
               {\clearname{editor}}
               {}}}
         {\ifnamesequal{author}{savedauthor}
            {\clearname{author}}
            {}}%
       \letbibmacro*{author}{plain:author}%
       \letbibmacro*{editor}{plain:editor}%
       \letbibmacro*{editor+others}{plain:editor+others}%
       \letbibmacro*{translator}{plain:translator}%
       \letbibmacro*{translator+others}{plain:translator+others}%
       \ifbibmacroundef{date+extradate}
         {}
         {\renewbibmacro*{date+extradate}{}%
          \renewbibmacro*{bbx:ifmergeddate}{\@secondoftwo}}%
       \renewbibmacro*{pageref}{}%
       \renewbibmacro*{related:init}{}}
      {\thefield{entrytype}}}}
\makeatother

\begin{filecontents}{\jobname.bib}
@unpublished{Peirce1880,
  title        = {A {Boolian} Algebra with One Constant},
  author       = {Peirce, Charles Sanders},
  date         = {1880},
  annotation   = {Unpublished, c. 1880},
  howpublished = {Manuscript}, 
  related      = {Peirce1933a},
  relatedtype  = {editedas}
}
@book{Peirce1933,
  title     = {Collected Papers},
  author    = {Peirce, Charles Sanders},
  editor    = {Hartshorne, Charles and Weiss, Paul},
  date      = {1933},
  volume    = {4},
  publisher = {Harvard University Press},
  location  = {Cambridge, M.A.},
}
@inbook{Peirce1933a,
  title     = {A {Boolian} Algebra with One Constant},
  origdate  = {1880},
  crossref  = {Peirce1933},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\cite{Peirce1880}
\printbibliography
\end{document}

moewew added a commit that referenced this issue Jun 6, 2021
@moewew
Copy link
Owner

moewew commented Jun 6, 2021

Come to think of it, the same underlying issue also occurs with the standard styles, you just can't see it. I'm wondering if and how this could be fixed in standard biblatex...

@rzach
Copy link
Author

rzach commented Jun 6, 2021

Thanks! I can't really say I understand why the absence of an author field in the related entry would influence how the title is processed, or why your fix fixes things despite not mentioning any lines containing title or titlecase ;)
I can confirm that (a version of) the problem exists in plain biblatex. I've filed an issue there: plk/biblatex#1149

@rzach
Copy link
Author

rzach commented Jun 6, 2021

(I mean, it knows it's still a title since the quotation marks are there, so whatever bit of code puts the quotation marks around the title in the related entry should be changed from using title to title:titlecase right?)

moewew added a commit to plk/biblatex that referenced this issue Jun 7, 2021
@moewew
Copy link
Owner

moewew commented Jun 7, 2021

Changed the fix to use the biblatex fix for plk/biblatex#1149 in 8aa29ed.

It may be another few days before I release a fixed version of biblatex-ext. Ideally I'd like to figure out a way to automatically disable the related:default if it is no longer needed.

@moewew moewew added this to the v0.13 milestone Jun 8, 2021
@moewew
Copy link
Owner

moewew commented Jun 8, 2021

The fix will be disabled for biblatex v3.17+ (29c83dd). Version 0.13 is off to CTAN now and should pop up in MikTeX and TeX Live in the next days.

@moewew
Copy link
Owner

moewew commented Jun 10, 2021

biblatex-ext v0.13 is available in both MikTeX and TeX live 2021 now.

\documentclass{article}
\usepackage[style=ext-authoryear]{biblatex}

\DeclareFieldFormat[article,incollection,inproceedings,inbook,unpublished]{titlecase:title}{\MakeSentenceCase*{#1}}

\begin{filecontents}{\jobname.bib}
@unpublished{Peirce1880,
  title        = {A {Boolian} Algebra with One Constant},
  author       = {Peirce, Charles Sanders},
  date         = {1880},
  annotation   = {Unpublished, c. 1880},
  howpublished = {Manuscript}, 
  related      = {Peirce1933a},
  relatedtype  = {editedas}
}
@book{Peirce1933,
  title     = {Collected Papers},
  author    = {Peirce, Charles Sanders},
  editor    = {Hartshorne, Charles and Weiss, Paul},
  date      = {1933},
  volume    = {4},
  publisher = {Harvard University Press},
  location  = {Cambridge, M.A.},
}
@inbook{Peirce1933a,
  title     = {A {Boolian} Algebra with One Constant},
  origdate  = {1880},
  crossref  = {Peirce1933},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\cite{Peirce1880}
\printbibliography
\end{document}

gives the expected result with that version.

Peirce, Charles Sanders (1880). “A Boolian algebra with one constant”. Manuscript. “A Boolian algebra with one constant”. In: Charles Sanders Peirce. Collected Papers. Ed. by Charles Hartshorne and Paul Weiss. Vol. 4. Cambridge, M.A.: Harvard University Press, 1933.

screenshot of the output quoted above

@moewew moewew closed this as completed Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants