1

Consider this MWE:

\documentclass{article}
\usepackage[
  bibencoding=utf8,
  backend=biber,
  natbib,
  style=ieee, % this abbreviates month always!
  dateabbrev=true, % but this (alone) seems to have no effect on month abbreviation?
  isbn=true,
  url=true,
  defernumbers=true,
]{biblatex}
\usepackage{filecontents}
\usepackage{hyperref}

\begin{filecontents*}{\jobname.bib}
@article {jo-audm08,
  author = {Some Author},
  title = {{Testing the title of a paper}},
  url = {http://example.com/paper.pdf},
  journal={Proceedings of Some Conference},
  pages={123--127},
  publisher = {example.com},
  year={2008},
  month={jun},
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\makeatletter
\DeclareCiteCommand{\citemonth}
  {\usebibmacro{prenote}}
  {%
    \let\oldabx@bibmonth\abx@bibmonth%
    %\let\abx@bibmonth\blx@imc@biblstring\typeout{CHG: abx@bibmonth \meaning\abx@bibmonth}% false: not abbreviated; but nowork
    \setkeys{blx@opt@pre}{dateabbrev=false}% nowork
    \mkbibmonth{\thefield{month}}%
    \let\abx@bibmonth\oldabx@bibmonth% restore
  }
  {\multicitedelim}
  {\usebibmacro{postnote}}
\makeatother


\begin{document}

Testing month: \citemonth{jo-audm08};

% \printbibliography[sorting=none]

\end{document}

I compile with pdflatex test.tex && biber test && pdflatex test.tex && pdflatex test.tex. No matter what I do, the output is "Testing month: Jun.;"; I'd like to get "Testing month: June;".

My attempt in the MWE above is based on the assumption that the abbreviation is due to the biblatex option dateabbrev=false; but then I looked into texlive/2014/texmf-dist/tex/latex/biblatex-ieee/ieee.bbx, and what do I see:

\DefineBibliographyStrings{english}{  
  june      = Jun\adddot ,
  july      = Jul\adddot ,
  september = Sep\adddot ,
}

So, apparently this is why June is abbreviated - but why are only these three months abbreviated??!

So in principle I could override the \DefineBibliographyStrings in the preamble, which will have global effect - but let's say I want to keep this default behavior (these three months abbreviated), and have the full month names output only when I use \citemonth; is that possible, and if so, how to do it?


EDIT: Uh, this is gonna be complicated: Redefining "cited on" string (and others) in biblatex

The original definitions (full and abbreviated version) can be found in the language-specific .lbx files. ... These strings are declared using the \DeclareBibliographyStrings command which is only available in .lbx files. Outside these files, you have to use \DefineBibliographyStrings which "overrides both the full and the abbreviated version of the string" (biblatex manual, section 3.8).

If I could use \DeclareBibliographyStrings in preamble, I could just write june = {{June}{Jun\adddot}}, as per english.lbx -- but I can't use it there, and I don't want to hack english.lbx; and so otherwise I'd have to use \DefineBibliographyStrings which overwrites both forms. What to do?

1 Answer 1

1

I think I got it; first, why are only those three months redeclared? If you look at english.lbx in the \DeclareBibliographyStrings - all abbreviated months are abbreviated to first three letters + dot, except for these three; and the IEEE style apparently requires abbreviation at three characters.

In terms of the fix: basically, I make a "shallow" copy of \DeclareBibliographyStrings skipping any checks called \ReDeclareBibliographyStringsEnglish; the trick here is that if \ReDeclareBibliographyStringsEnglish is ran in preamble, it will be overwritten by defferred biblatex setups - so any setup using \ReDeclareBibliographyStringsEnglish must run after begin document. Otherwise, locally changing dateabbrev works fine: for instance, the fixed MWE below now outputs:

Testing month: June;
Testing date: Jun. 2008;

\documentclass{article}
\usepackage[
  bibencoding=utf8,
  backend=biber,
  natbib,
  style=ieee, % this abbreviates month always!
  dateabbrev=true, % but this (alone) seems to have no effect on month abbreviation?
  isbn=true,
  url=true,
  defernumbers=true,
]{biblatex}
\usepackage{filecontents}
\usepackage{hyperref}

\begin{filecontents*}{\jobname.bib}
@article {jo-audm08,
  author = {Some Author},
  title = {{Testing the title of a paper}},
  url = {http://example.com/paper.pdf},
  journal={Proceedings of Some Conference},
  pages={123--127},
  publisher = {example.com},
  year={2008},
  month={jun},
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\makeatletter
\def\ReDeclareBibliographyStringsEnglish#1{% from \DeclareBibliographyStrings in \blx@lbxinput@ii, biblatex2.sty; skipping any checks
 %\begingroup % works if not wrapped in begin/end group!
 \let\blx@defstring\blx@lbx@defstring
 \blx@defbibstrings{english}{#1}%
 %\endgroup%
}%
\def\RunReDeclare{%
  \ReDeclareBibliographyStringsEnglish{% only in preamble!
    june             = {{June}{Jun\adddot}},
    july             = {{July}{Jul\adddot}},
    september        = {{September}{Sep\adddot}}, % orig english.lbx has Sept\adddot; IEEE is Sep\adddot
  }%
}%
\DeclareCiteCommand{\citemonth}
  {\usebibmacro{prenote}}
  {%
    \let\oldabx@bibmonth\abx@bibmonth%
    %\DefineBibliographyStrings{english}{% only in preamble!
    %  june      = June,%
    %  july      = July,%
    %  september = September,%
    %}%
    %\let\abx@bibmonth\blx@imc@biblstring\typeout{CHG: abx@bibmonth \meaning\abx@bibmonth}% false: not abbreviated; but nowork
    \setkeys{blx@opt@pre}{dateabbrev=false}% nowork; actually, work for true!
    \mkbibmonth{\thefield{month}}%
    \let\abx@bibmonth\oldabx@bibmonth% restore
  }
  {\multicitedelim}
  {\usebibmacro{postnote}}
\makeatother


\begin{document}

% NOTE: the \def of \ReDeclareBibliographyStringsEnglish can
% NOT sit in preamble; apparently its effect will be overridden
% by deferred setups of biblatex running at \begin{document}
% so must execute this after the \begin{document}!
\RunReDeclare

Testing month: \citemonth{jo-audm08};

Testing date: \citedate{jo-audm08};


% \printbibliography[sorting=none]

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .