Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm setting up my bibliography and I have a very small isue. I'm using the authoryear bibstyle and it provides a "." after the (year). So automatically, the "in" is written "In:". It very ugly...

I'm trying to get rid of that "." to be replace by a "," and have a small "in". Otherwise, I'm also trying to get of the ":" after the in. To have something like:

MHONE, Guy (1992). "The political... Malawi", in MHONE, Guy, (éd.). Malawi at ...

Here is the MWE:

\documentclass[a4paper,12pt]{book}



% these is the full list of the packages I use if ever the is conflict...
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage[french]{babel} % my french setting
\usepackage{csquotes}
\usepackage[T1]{fontenc}
\usepackage[pdftex]{graphicx}
\usepackage[top=2.5cm, bottom=2.5cm, right=1.5cm, left=1.5cm, headheight = 20pt]{geometry}
\usepackage{pifont}
\usepackage{xspace}
\usepackage{setspace}
\usepackage{mathptmx}
\usepackage{parskip}
\usepackage{titlesec}
\usepackage[titletoc]{appendix}
\usepackage[hidelinks]{hyperref}
\usepackage{tocloft}
\usepackage{calc}
\usepackage{tocbibind}
\usepackage{pdfpages}
\usepackage{emptypage}
\usepackage{bookmark}
\usepackage{quoting}
\quotingsetup{vskip=0em}
\usepackage[font=footnotesize,labelfont=bf]{caption}
\usepackage{microtype}


%************************************************
%                                               *
%       MISE EN PAGE DE LÀ BIBLIOGRAPHIE        *
%                                               *
%************************************************
\usepackage[backend=biber,language=auto,sorting=nyt,bibstyle=authoryear,citestyle=authortitle-icomp]{biblatex}



%commandes de citation journal & revue
\renewbibmacro*{date}{\printdate}

\DeclareCiteCommand{\citejournal}
      {\usebibmacro{prenote}}
      {\usebibmacro{citeindex}%
        \usebibmacro{journal}
        \setunit{\addspace}
         \usebibmacro{date}
         \setunit{\addspace}
           \usebibmacro{title}}
      {\multicitedelim}
      {\usebibmacro{postnote}}

    \DeclareCiteCommand{\footcitejournal}[\mkbibfootnote]
      {\usebibmacro{prenote}}
      {\usebibmacro{citeindex}%
        \usebibmacro{journal}
        \setunit{\addspace}
         \usebibmacro{date}
         \setunit{\addspace}
           \usebibmacro{title}}
      {\multicitedelim}
      {\usebibmacro{postnote}}  

 \DeclareCiteCommand{\citerevue}
      {\usebibmacro{prenote}}
      {\usebibmacro{citeindex}%
        \usebibmacro{title}
        \setunit{\addspace}
         \usebibmacro{journal+issuetitle}
         \setunit{\addspace}
         \usebibmacro{date}}
      {\multicitedelim}
      {\usebibmacro{postnote}}

    \DeclareCiteCommand{\footciterevue}[\mkbibfootnote]
      {\usebibmacro{prenote}}
      {\usebibmacro{citeindex}%
        \usebibmacro{title}
        \setunit{\addspace}
         \usebibmacro{journal+issuetitle}
         \setunit{\addspace}
         \usebibmacro{date}}
      {\multicitedelim}
      {\usebibmacro{postnote}}  





% Put editor string in parentheses
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}

% Obtenir le nom de l'éditeur pour les @incollection entre le 'in' et le titre
\renewbibmacro*{in:}{%
  \printtext{\bibstring{in}\intitlepunct}%
 \ifentrytype{article}{}{}%
 \ifentrytype{incollection}{%
  \ifnameundef{bookauthor}
    {\ifnameundef{editor}
       {\printnames{translator}%
        \setunit{\addcomma\space}%
        \usebibmacro{translator+othersstrg}%
        \clearname{translator}}
       {\printnames{editor}%
        \setunit{\addcomma\space}%
        \usebibmacro{editor+othersstrg}%
        \clearname{editor}}}
    {\ifnamesequal{author}{bookauthor}
       {}
       {\printnames{bookauthor}%
        \clearname{bookauthor}}}}%
       \setunit{\addspace} 
  \newunit\newblock}

% mettre entre parenthèses le numéro de la revue dans un volume en comportant plusieurs 
 \renewbibmacro*{volume+number+eid}{%
  \printfield{volume}%
  \setunit*{\addnbspace}% 
  \printfield{number}%
  \setunit{\addcomma\space}%
  \printfield{eid}}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}


%new toggle pour sources primaires
\newtoggle{blx@bibdriver@article:journalyear}%new toggle to set which driver is to use
\togglefalse{blx@bibdriver@article:journalyear}

%redefine author-macro so it only prints the year in the default bibdriver
\renewbibmacro*{author}{%also modified
  \ifboolexpr{
    test \ifuseauthor
    and
    not test {\ifnameundef{author}}
  }
    {\usebibmacro{bbx:dashcheck}
       {\bibnamedash}
       {\usebibmacro{bbx:savehash}%
        \printnames{author}%
        \iffieldundef{authortype}
          {\setunit{\addspace}}
          {\setunit{\addcomma\space}}}%
     \iffieldundef{authortype}
       {}
       {\usebibmacro{authorstrg}%
        \setunit{\addspace}}}%
    {\global\undef\bbx@lasthash
     \usebibmacro{labeltitle}%
     \setunit*{\addspace}}%
  \iftoggle{blx@bibdriver@article:journalyear}{}{%added
  \usebibmacro{date+extrayear}}}%modified

%new bibdriver for article in the second bibliography
\newbibmacro*{article:journalyear}{%modified bibdriver for article
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{journal+issuetitle}%
  \newunit
  \usebibmacro{date}
  \newunit
  \usebibmacro{title}%
  \newunit
  \usebibmacro{author/translator+others}%
  \newunit
  \usebibmacro{note+pages}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}


%redeclare the existing bibdriver for article
\DeclareBibliographyDriver{article}{%from standard.bbx
\iftoggle{blx@bibdriver@article:journalyear}{\usebibmacro{article:journalyear}}{%added
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{bytranslator+others}%
  \newunit\newblock
  \printfield{version}%
  \newunit\newblock
  \usebibmacro{in:}%
  \usebibmacro{journal+issuetitle}%
  \newunit
  \usebibmacro{byeditor+others}%
  \newunit
  \usebibmacro{note+pages}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{issn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}
}






\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}



@incollection{mhone_crossroads_1992,
     title = {The Political Economy of Malawi - An Overview},
     chapter = {1},
     author = {Guy Mhone},
     year = {1992},
     booktitle = {Malawi At The Crossroads. The Post-Colonial Political Economy},
     editor = {Guy Mone},
     publisher = {\textsc{SAPES} Books},
     address = {Harare},
     pages = {1--34},
     keywords = {malawi_histoire},
},



\end{filecontents}

\bibliography{\jobname}

\begin{document}


\nocite{*}


\printbibliography[keyword=malawi_histoire,heading=subbibliography,title={Malawi: histoire sociale}]

\end{document}
share|improve this question
    
To get rid of the colon, try \renewcommand*{\intitlepunct}{\addspace\nopunct}\renewbibmacro{in:}{\printtext{‌​\bibstring{in}\intitlepunct}}. –  cfr Jun 11 at 0:03
    
Not working I get an error message saying ut8 encoding issue with title={Malawi: histoire sociale}. Anyway I found a solution here: tex.stackexchange.com/questions/12806/… It proposes to add: \renewcommand*{\newunitpunct}{\addcomma\space}. But it changes all the points into commas. I can say it almsot perfect but if somenone has another solution. For the "in:" into "in", I've just replaced \printtext{\bibstring{in}\intitlepunct} by \printtext{\bibstring{in}\addspace} –  ElNikopol Jun 11 at 8:11
    
Make sure your files really are UTF-8 encoded if that's what you tell TeX you are using. The encoding issue is distinct from the format issue. I believe I used to use \printtext{\bibstring{in}\addspace} but it caused problems in certain cases. (Maybe in cases where there is no distinct editor but I cannot now remember the details.) And, yes, \addcomma will add commas! –  cfr Jun 11 at 15:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.