0

In a previous question, I asked about the possibility to create a custom "cited as" which related to the author names and a label when disambiguation is needed.

In some of the cases, I got the right citation in the bibliography, however there is an extra space between the label and the final ")." This creates a break, were the Author-Label is on one line and the ")." is on the next line.

By trial and errors, I've identified that this is due to the "\usebibmacro{cite}%", which is redefined in my custom CBX file. This would be something as:

Author First, Title and potential subtitle 3ed, Location year (cited as Author-Label
).

I'd prefer something similar to:

Author First, Title and potential subtitle 3ed, Location year (cited as 
Author-Label).

However, I don't see where the parenthesis is set and especially were it is ended. My guess is that it may be in the "labelname" part, but I'm kind of stuck to this point.

What should I surgically edit in which biblatex macro?

NB: a MWE is difficult to reproduce, at the moment, I circumvented the issue by adding and extra space in the title.

.bbx

\ProvidesFile{biblatex-xawi.bbx}[2018/04/18 v1.1]    
\RequireCitationStyle{authortitle}

\newbibmacro{citedas:cite}{%
  \begingroup
    \delimcontext{cite}%
    \DeclareFieldFormat{bibhyperref}{##1}%
    \csuse{blx@hook@cite}%
    \csuse{blx@hook@citekey}%
    \undef\cbx@lasthash
    \undef\cbx@lastyear
    \citetrackerfalse\pagetrackerfalse\backtrackerfalse
    \defcounter{maxnames}{\blx@maxcitenames}%
    \usebibmacro{cite}%
  \endgroup
}

\newbibmacro{citedas}{%
  \ifsingletitle
    {}{
        \printtext[parens] {%
            \bibstring{citedas}%
            \addcolon\space
            \usebibmacro{citedas:cite}
        }
    }
}

.cbx

\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\ifnameundef{labelname}
       {\usebibmacro{cite:title}}
       {\ifsingletitle
          {\printtext[bibhyperref]{\printnames{labelname}}}
          {\printnames{labelname}%
       \setunit{\nametitledelim}%
       \usebibmacro{cite:title}}}}%
    {\usebibmacro{cite:shorthand}}}
moewe
  • 175,683
XaWin
  • 483
  • 2
    It seems you are missing a trailing % after \usebibmacro{citedas:cite} in \newbibmacro{citedas}. Also after the whole \ifsingletitle. – gusbrs May 04 '18 at 15:23
  • 2
    Also after the whole \printtext[parens] {... – gusbrs May 04 '18 at 15:35
  • 1
    In particular the formatting of the macro in the linked answer does not have missing %s and does not risk producing unwanted space. – moewe May 04 '18 at 15:37
  • Ok, I'll change that and re-test ! But what's the extra purpose of the % in the code ? Isn't it supposed to be a comment ? I mean, this may be counterintuitive that the insertion of comment change the functionnality of code ! So is it safer to add a % after every command or would it also influence the code ? – XaWin May 04 '18 at 15:48
  • 2
    It's not a "comment", it's the suppression of a blank space introduced by the new line. Take a look at https://tex.stackexchange.com/q/7453/105447. It should be used when needed, not "after every command". – gusbrs May 04 '18 at 15:55
  • The issue was there : \usebibmacro{citedas:cite}% @gusbrs, do you want to make an answer out of your comment ? Moreover, I learnt something very important with your answer on the % – XaWin May 04 '18 at 16:05
  • That is indeed important! :) Don't forget that this particular space was introduced by the lacking % after \usebibmacro{citedas:cite}. But if you leave the other missing %, you may potentially cause other unwanted spaces, so they should be also included. As to this one, though didactic, I think it is best marked as a duplicate. – gusbrs May 04 '18 at 16:12
  • Was there any particular reason why you changed my formatting and indentation of the macro? I normally make sure not to introduce unwanted space while at the same time not adding unnecessary %s, so the formatting is also part of the answer. (There is a reason why I changed things back in my answers even if your questions had a different formatting.) – moewe May 04 '18 at 16:26
  • Well, a Tex beginner error combined with my experience in other language (C#, R, not to name them). I expanded the imbrication to better identify the statement order, and as it was looking good, I badly copy-pasted the wrong format. I'll not so it anymore, that's for sure! – XaWin May 04 '18 at 17:00

0 Answers0