%%
%% This is file `nwejm.cbx',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% nwejm.dtx  (with options: `citestyle')
%% -------:| -----------------------------------------------------------------
%%   nwejm:| Class for the journal "North-Western European Journal of Mathematics"
%%  Author:| Denis Bitouze
%%  E-mail:| denis.bitouze@univ-littoral.fr
%% License:| Released under the LaTeX Project Public License v1.3c or later
%%     See:| http://www.latex-project.org/lppl.txt
%% 
\ProvidesFile{nwejm.cbx}
[2016/04/01 v 0.1 nwejm citation style (DB)]

\RequireCitationStyle{authoryear-comp}

\ExecuteBibliographyOptions{giveninits,ibidtracker=constrict,pagetracker=page}

\renewrobustcmd{\blx@mkbibfootnote}[2]{%
  \iftoggle{blx@footnote}%
  {\blx@warning{Nested notes}%
    \addspace\mkbibparens{#2}}%
  {\unspace%
    \ifnum\blx@notetype=\tw@%
    \expandafter\@firstoftwo%
    \else%
    \expandafter\@secondoftwo%
    \fi%
    {\csuse{blx@theendnote#1}{\protecting{\blxmkbibnote{end}{#2}}}}%
    {%
      \patchcmd\@makefnmark%
      {\normalfont}%
      {\normalfont\bfseries}%
      {}{}%
      \csuse{footnote#1}{\protecting{\blxmkbibnote{foot}{#2}}}%
    }%
  }%
}
\renewcommand*{\mkcitation}[1]{%
  \patchcmd\@makefnmark%
  {\normalfont}%
  {\normalfont\bfseries}%
  {}{}%
  \footnote{#1}%
}
\newbibmacro*{cite:title}{%
    \printfield[citetitle]{labeltitle}}
\providecommand*{\mkibid}[1]{#1}
\newbibmacro*{cite:ibid}{%
  \printtext[bibhyperref]{\bibstring[\mkibid]{ibidem}}%
}
\newbibmacro*{nwejm:cite}{%
  \iffieldundef{shorthand}{%
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}%
      {\usebibmacro{cite:ibid}}%
      {%
        \ifthenelse{%
          \ifnameundef{labelname}%
        }{%
          \usebibmacro{cite:label}%
          \setunit{\addcomma\space}%
        }{%
          \ifthenelse{%
            \iffieldundef{labelyear}%
          }{%
            \printtext[bibhyperref]{\printnames{labelname}}%
          }{%
            \printtext[bibhyperref]{\printnames{labelname}%
            \setunit{\addcomma\space}%
            \usebibmacro{cite:labeldate+extradate}}%
            \ifthenelse{%
              \iffieldundef{labeltitle}%
            }{%
            }{%
              \setunit{\addcomma\space}%
              \usebibmacro{cite:title}%
            }%
          }%
        }%
      }%
    }%
  }{%
    \usebibmacro{cite:shorthand}%
  }%
}
\DeclareCiteCommand{\nwejmfootcite}[\mkbibfootnote]
{\usebibmacro{prenote}}%
{\usebibmacro{citeindex}%
  \usebibmacro{nwejm:cite}}
{%
  \ifcurrentbaselanguage{french}{%
    \parindent=\parindentFFN%
    \addtolength{\parindent}{\widthof{\dotFFN\kernFFN}}%
  }{%
    \parindent=\footnotemargin%
  }%
  \multicitedelim\newline\indent%
}
{\usebibmacro{postnote}}%
\DeclareMultiCiteCommand{\nwejmfootcites}[\mkbibfootnote]{\nwejmfootcite}
{%
  \ifcurrentbaselanguage{french}{%
    \parindent=\parindentFFN%
    \addtolength{\parindent}{\widthof{\dotFFN\kernFFN}}%
  }{%
    \parindent=\footnotemargin%
  }%
  \multicitedelim\newline\indent%
}
\DeclareAutoCiteCommand{nwejmfootcite}{\nwejmfootcite}{\nwejmfootcites}

\DeclareCiteCommand{\textcite}[\cbx@textcite@init\cbx@textcite]
  {\gdef\cbx@savedkeys{}%
   \citetrackerfalse%
   \pagetrackerfalse%
   \DeferNextCitekeyHook%
   \usebibmacro{cite:init}}
  {\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0}
     {\protected@xappto\cbx@savedcites{()(\thefield{multipostnote})}%
      \global\clearfield{multipostnote}}
     {}%
   \xappto\cbx@savedkeys{\thefield{entrykey},}%
   \iffieldequals{namehash}{\cbx@lasthash}
     {}
     {\stepcounter{textcitetotal}%
      \savefield{namehash}{\cbx@lasthash}}}
  {}
  {\protected@xappto\cbx@savedcites{%
     [\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}}

      % \DeclareCiteCommand{\textcite}
 %  {\boolfalse{cbx:parens}}
 %  {\usebibmacro{citeindex}%
 %   \iffirstcitekey
 %     {\setcounter{textcitetotal}{1}}
 %     {\stepcounter{textcitetotal}%
 %      \textcitedelim}%
 %    \iffootnote{\usebibmacro{nwejm:cite}}{\printtext[bibhyperref]{\usebibmacro{textcite}}}}
 %  {\ifbool{cbx:parens}
 %     {\bibcloseparen\global\boolfalse{cbx:parens}}
 %     {}}
 %  {\usebibmacro{textcite:postnote}}
\ExecuteBibliographyOptions{autocite=nwejmfootcite}
%% 
%% Copyright (C) 2015-2024 by Denis Bitouze <denis.bitouze@univ-littoral.fr>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
%% version 1.3c of this license or (at your option) any later
%% version.  The latest version of this license is in the file:
%% 
%% http://www.latex-project.org/lppl.txt
%% 
%% This work is "maintained" (as per LPPL maintenance status) by
%% Denis Bitouze.
%% 
%% This work consists of the file nwejm.dtx and a Makefile.
%% Running "make" generates the derived files README, nwejm.pdf and nwejm.cls.
%% Running "make inst" installs the files in the user's TeX tree.
%% Running "make install" installs the files in the local TeX tree.
%% 
%%
%% End of file `nwejm.cbx'.
