3

When using numeric style the \citet{key} command outputs Lastname [n]. I'd like this to output Lastname F. [n] where F is a Firstname initial. p.s. Here is MWE code

\documentclass[a4paper]{article}
\usepackage{fontspec}
\setmainfont[
BoldFont={DeJavu Serif Bold},
ItalicFont={DeJavu Serif Italic},
BoldItalicFont={DeJavu Serif BoldItalic}
]{DeJavu Serif}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{baez/article,
    author       = {Baez, John C. and Lauda, Aaron D.},
    title        = {Higher-Dimensional Algebra {V}: 2-Groups},
    journaltitle = {Theory and Applications of Categories},
    date         = 2004,
    volume       = 12,
    pages        = {423-491},
    version      = 3,
    eprint       = {math/0307200v3},
    eprinttype   = {arxiv},
    langid       = {english},
    langidopts   = {variant=american},
    annotation   = {An \texttt{article} with \texttt{eprint} and
        \texttt{eprinttype} fields. Note that the arXiv reference is
        transformed into a clickable link if \texttt{hyperref} support
        has been enabled.  Compare \texttt{baez\slash online}, which
        is the same item given as an \texttt{online} entry},
    hyphenation={english},
}
@article{another,
    author       = {Another,Author and One more, Author},
    title        = {Title},
    journaltitle = {Journal},
    date         = 2004,
    volume       = 12,
    pages        = {423-491},
    version      = 3,
    eprint       = {math/0307200v3},
    eprinttype   = {arxiv},
    langid       = {english},
    langidopts   = {variant=american},
    hyphenation={english},
}
\end{filecontents*}

\usepackage[english]{babel}
\usepackage[natbib=true,
style=numeric,
isbn=true,
url=true,
defernumbers=false,
sorting=nyt, 
firstinits=true,
backend=biber,
language=auto,  
autolang=other]{biblatex}
\addbibresource{\jobname.bib}

\begin{document}
\citet{another} \\
Some text \\
\citet{baez/article} \\
\nocite{*}
\printbibliography
\end{document}

I'd like to have Baez,J.C. and Lauda,A.D. [2] italic shape is preferable :) p.s. It was noted to me in comments,that correct way to cite is J.C. Baez and A.D. Lauda [2] , but question remains :how to output name initials in numeric citation style

moewe
  • 175,683
  • It would be far preferable to include an MWE here. That way, if the other post is edited, this question will still remain meaningful to future readers. If you rely on a link, the content may change if the content of the link is deleted or updated. – cfr Sep 19 '15 at 19:59
  • The example given there is rather more complex than this question suggests. Do you really want something which also satisfies desiderata not specified in this question? Because you are likely to get answers which don't take account of such desiderata, as the question is currently given. – cfr Sep 19 '15 at 20:01
  • The \citet command is designed for use in text. Normally - at least in English - it would not make sense to say As Smith J. [18] proved in 1954.... If you used an initial you'd want As J. Smith [18] proved in 1954.... Do you want this for use with another language where the conventions are different? – cfr Sep 19 '15 at 20:27
  • Yes, you are right, but there is no 'J.' in output..for other language i an switch first-last/last-first right? – Levan Shoshiashvili Sep 19 '15 at 20:30
  • More general is how to output first names. When option will be firstinits=true, then output can be initials – Levan Shoshiashvili Sep 19 '15 at 23:16
  • 1
  • @WaldirLeoncio This is certainly not a duplicate of the question you suggested as a duplicate. Your question is concerned with unwanted initials or first names appearing, here the OP explicitly wants initials. He can't get initials all the time from the uniquename option. – moewe Mar 24 '17 at 13:30
  • Don't think, that after 5 month of initial post and answers marking post 'duplicate' is right – Levan Shoshiashvili Mar 24 '17 at 16:00
  • @WaldirLeoncio suggested post is how to turn off initials in author year style. This post is how to turn on initials in numeric style...I think those 2 are different – Levan Shoshiashvili Mar 24 '17 at 16:34
  • I have rolled back your edit about the duplicate question. That is better suited as a comment. Without context the comment just adds confusion to the question. – moewe Mar 24 '17 at 17:07

1 Answers1

2

It seems that

\DeclareNameAlias{labelname}{family-given}

would do the job. You get full names (if available) with giveninits=false and initials with giveninits=true.


With

\DeclareNameFormat{labelname}{%
  \ifnum\value{uniquename}<2
    \usebibmacro{name:family-given}
      {\namepartfamily}
      {\namepartgiveni}
      {\namepartprefix}
      {\namepartsuffix}%
  \or
    \usebibmacro{name:family-given}
      {\namepartfamily}
      {\namepartgiven}
      {\namepartprefix}
      {\namepartsuffix}%
  \fi
  \usebibmacro{name:andothers}}

you will always get initials, except if full names are needed to disambiguate. (That only applies to giveninits=false, with giveninits=true only initials are available at all times.) To enable that feature you need to set the uniquename option when loading.

See also firstinits for citations only


You can get a different order by replacing family-given by given-family in any of the above.

moewe
  • 175,683
  • Sorry I dont understand this :"To enable that feature you need to set the labelname option when loading." – Levan Shoshiashvili Sep 20 '15 at 15:18
  • @LevanShoshiashvili If you want to use that feature you will have to add labelname to the loading-time options, if you load biblatex with \usepackage[style=numeric, backend=biber]{biblatex} you will need \usepackage[style=numeric, backend=biber, labelname]{biblatex} instead. Or you just add \ExecuteBibliographyOptions{labelname} to your preamble. – moewe Sep 20 '15 at 16:19
  • added after biblatex package call declarenameformat command above and after it `\ExecuteBibliographyOptions{labelname}' and get error :Package keyval Error: labelname undefined. \ExecuteBibliographyOptions{labelname} – Levan Shoshiashvili Sep 20 '15 at 16:42
  • @LevanShoshiashvili Well this is pretty embarrassing: The option I'm talking about is actually called uniquename and not labelname. I'm really sorry. You can read up about it in the manual. Please replace all mentions of labelname above with uniquename. – moewe Sep 20 '15 at 16:49
  • 'firstinits=true,uniquename in option gives initials in both bibliography and in citation andfirstinits=false, uniquename' option full name in bibliography and initials in citation, but withiut 'uniquename' i get same – Levan Shoshiashvili Sep 20 '15 at 17:02
  • @LevanShoshiashvili If you have firstinits=true you will always get initials only. If you have firstinits=false and uniquename you will get initials only if the disambiguation features allows for that. That is if you have no other author with the same last name and first name initial (note that this includes other versions of the same name: Uthor, A. and Uthor, Anne are two different names as far as biblatex is concerned and so you will get the full name, same for Uthor, Anne E. and Uthor, Anne). Without an example, I don't know what exactly is going on at your end. – moewe Sep 20 '15 at 17:09
  • got it now...yes it expands to fullname if two different citations give same output with initials...nice feature – Levan Shoshiashvili Sep 20 '15 at 17:28