michal-h21 / biblatex-iso690

ISO 690 style for biblatex.
LaTeX Project Public License v1.3c
93 stars 31 forks source link

Missing punctuation between howpublished and urldate #96

Closed Dominik-97 closed 2 years ago

Dominik-97 commented 2 years ago

MWE:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage[headheight=2cm,]{geometry}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\usepackage{pgfplots}
\usepackage{xcolor}
\usepackage{multirow}
\usepackage{tikz}
\usepackage[hyphens, spaces, obeyspaces]{url}
\usepackage{hyperref}

% ...

\usepackage[backend=biber,defernumbers=true,style=iso-authoryear,]{biblatex}
\addbibresource{Zdroje/Zdroje.bib}

% ...

\DeclareFieldFormat[misc]{urldate}{[cit. #1].}
\DeclareFieldFormat[misc]{url}{Dostupné z: #1}

% ...

\begin{document}

% ...

%\include{...}

Some text\footfullcite{example}.

% ...

\printbibliography[omitnumbers=true,type=misc,heading=subbibliography,title={Online zdroje}]

% ...

\end{document}
@misc{example,
    title = {{exmp}, a.s. - {Detail} - {example}.cz},
    url = {https://www.exmp.cz/search/detail/cz-12345678/},
    urldate = {2021-12-27},
}

From compiling the MWE I get this:

image

According to ISO 690, I should get this:

exmp, a.s. - Detail - example.cz [online]. [cit. 2021-12-27]. Dostupné z: https://www.exmp.cz/search/detail/cz-12345678/

Current workaround is to add howpublished = {online}, for the entry in a bib file and either using the \DeclareFieldFormat[misc]{howpublished}{[#1].} or editing the bibmacro.

michal-h21 commented 2 years ago

First issue is that you don't have an author in your .bib file. It is required to include it. If the author is unknown, use author={Anon}.

There is no period between [online] and citation date because you don't have any publisher information in the bib file. You can test for their missing using the following redefinition of the urldate macro:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage[headheight=2cm,]{geometry}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\usepackage{pgfplots}
\usepackage{xcolor}
\usepackage{multirow}
\usepackage{tikz}
\usepackage[hyphens, spaces, obeyspaces]{url}
\usepackage{hyperref}

% ...

\usepackage[backend=biber,defernumbers=true,style=iso-authoryear,]{biblatex}
\addbibresource{Zdroje/Zdroje.bib}

% ...

\DeclareFieldFormat[misc]{urldate}{[cit. #1].}
\DeclareFieldFormat[misc]{url}{Dostupné z: \url{#1}}

% The url seen date of @online entries is always printed
\renewbibmacro*{urldate}{%
  % if there is no publisher specified in the bib file, set unit to period
  \ifboolexpr{%
    test {\iflistundef{publisher}}%
    and test {\iflistundef{location}}%
  }{\setunit{\adddot\addspace}}%
  {\setunit{\addspace}}%
  \ifboolexpr{
    test {\iftoggle{bbx:url}}
    or test {\ifentrytype{online}}
  }
    {\printurldate}%
    {}%
}
% ...

\begin{document}

% ...

%\include{...}

Some text\footfullcite{example}.

% ...

\printbibliography[omitnumbers=true,type=misc,heading=subbibliography,title={Online zdroje}]

% ...

\end{document}
Dominik-97 commented 2 years ago

The macro redefinition works for me, I had to add the following line:

\providetoggle{bbx:url}

I am not exactly sure what it does, however when compiling without this line, the compiler throws the following error:

Package etoolbox Error: Toggle 'bbx:url' undefined.
See the etoolbox package documentation for explanation.

Might be because I am using an older version of MacTex (TeX Live 2019) and biber (2.12).

Could you please confirm, wheter providing the toggle is the correct solution to the problem?

If so, I think we can consider this issue resolved.

Thank you very much

michal-h21 commented 2 years ago

Ah, it is quite old distribution. You may want to add also the following line, to actually print the URL date:

\settoggle{bbx:url}{true}

Dominik-97 commented 2 years ago

Works great, thank you.