Make specific author bold using biblatexMake specific author bold using biblatex without consistent author...
How are passwords stolen from companies if they only store hashes?
Do people actually use the word "kaputt" in conversation?
Did Nintendo change its mind about 68000 SNES?
Writing in a Christian voice
Does fire aspect on a sword, destroy mob drops?
PTIJ: Where did Achashverosh's years wander off to?
"Marked down as someone wanting to sell shares." What does that mean?
PTIJ: Which Dr. Seuss books should one obtain?
Turning a hard to access nut?
When did hardware antialiasing start being available?
Do I need an EFI partition for each 18.04 ubuntu I have on my HD?
Why does Surtur say that Thor is Asgard's doom?
How to test the sharpness of a knife?
How to find the largest number(s) in a list of elements, possibly non-unique?
Help with identifying unique aircraft over NE Pennsylvania
Is this Pascal's Matrix?
What is the reasoning behind standardization (dividing by standard deviation)?
The English Debate
How can a new country break out from a developed country without war?
Is xar preinstalled on macOS?
Air travel with refrigerated insulin
Imaginary part of expression too difficult to calculate
Should a narrator ever describe things based on a characters view instead of fact?
Exposing a company lying about themselves in a tightly knit industry: Is my career at risk on the long run?
Make specific author bold using biblatex
Make specific author bold using biblatex without consistent author formattingMake one author's name bold every time it shows up in the bibliography (when there are two author's with the same last name but different first name)Special format for an author's name in biblatex bibliographyAnother question about making the name of an author bold in the bibliographyMake one author's name bold every time it shows up in the bibliographyBiblatex 3.3 name formattingHow to emphasize some author names using BibTeX?biblatex: Is it possible to patch macros created with newbibmacro?BibLaTeX: prevent caps for some authorsHighlight an author in bibliography using biblatex allowing bibliography style to format itauthor year style with biblatexMake specific author bold using biblatex without consistent author formattingAuthors typeset in bold in the reference list using bibtexAuthor highlighting with biblatex-apaMake one author's name bold every time it shows up in the bibliography (when there are two author's with the same last name but different first name)Highlight an author in bibliography using biblatex allowing bibliography style to format itAnother question about making the name of an author bold in the bibliographyOverloading Author+an / highlighting more than one authorOne specific author bold with IEEEtran.bst bibliography styleMake specific author bold using fullcite
I am writing my CV in LaTeX. I am using biblatex
and want my name (and only my name) to be bold for every reference. Is there a magic way to do this?
A similar question Make one author's name bold every time it shows up in the bibliography was asked, but that answer used BibTeX. While I use the BibTeX backend, I use biblatex
.
Any suggestions?
biblatex bold
add a comment |
I am writing my CV in LaTeX. I am using biblatex
and want my name (and only my name) to be bold for every reference. Is there a magic way to do this?
A similar question Make one author's name bold every time it shows up in the bibliography was asked, but that answer used BibTeX. While I use the BibTeX backend, I use biblatex
.
Any suggestions?
biblatex bold
4
See: tex.stackexchange.com/questions/44200/… -- Of course this only one suggestion. You can also useDeclareSourcemap
-- see for example here: tex.stackexchange.com/questions/62779/…
– Marco Daniel
Sep 19 '12 at 5:09
2
For my own CV, I usemkbibbold
. So the author field looks like this:author={A. Lastname, mkbibbold{Your name}, A. Lastname}
You should use biber though.
– rowman
Sep 19 '12 at 19:10
The solution presented by @rowman wokrs great for me! Thanks!
– J_F
Apr 18 '18 at 12:11
I was using the solutions provided here, that worked for biblatex < 3.3, Now none of the solutions provided here works now (biblatex 3.11). The full code of my version is in a different thread: tex.stackexchange.com/questions/187181/…
– Matthias Pospiech
Sep 12 '18 at 19:49
add a comment |
I am writing my CV in LaTeX. I am using biblatex
and want my name (and only my name) to be bold for every reference. Is there a magic way to do this?
A similar question Make one author's name bold every time it shows up in the bibliography was asked, but that answer used BibTeX. While I use the BibTeX backend, I use biblatex
.
Any suggestions?
biblatex bold
I am writing my CV in LaTeX. I am using biblatex
and want my name (and only my name) to be bold for every reference. Is there a magic way to do this?
A similar question Make one author's name bold every time it shows up in the bibliography was asked, but that answer used BibTeX. While I use the BibTeX backend, I use biblatex
.
Any suggestions?
biblatex bold
biblatex bold
edited Apr 13 '17 at 12:36
Community♦
1
1
asked Sep 19 '12 at 5:03
jlconlinjlconlin
4,166102944
4,166102944
4
See: tex.stackexchange.com/questions/44200/… -- Of course this only one suggestion. You can also useDeclareSourcemap
-- see for example here: tex.stackexchange.com/questions/62779/…
– Marco Daniel
Sep 19 '12 at 5:09
2
For my own CV, I usemkbibbold
. So the author field looks like this:author={A. Lastname, mkbibbold{Your name}, A. Lastname}
You should use biber though.
– rowman
Sep 19 '12 at 19:10
The solution presented by @rowman wokrs great for me! Thanks!
– J_F
Apr 18 '18 at 12:11
I was using the solutions provided here, that worked for biblatex < 3.3, Now none of the solutions provided here works now (biblatex 3.11). The full code of my version is in a different thread: tex.stackexchange.com/questions/187181/…
– Matthias Pospiech
Sep 12 '18 at 19:49
add a comment |
4
See: tex.stackexchange.com/questions/44200/… -- Of course this only one suggestion. You can also useDeclareSourcemap
-- see for example here: tex.stackexchange.com/questions/62779/…
– Marco Daniel
Sep 19 '12 at 5:09
2
For my own CV, I usemkbibbold
. So the author field looks like this:author={A. Lastname, mkbibbold{Your name}, A. Lastname}
You should use biber though.
– rowman
Sep 19 '12 at 19:10
The solution presented by @rowman wokrs great for me! Thanks!
– J_F
Apr 18 '18 at 12:11
I was using the solutions provided here, that worked for biblatex < 3.3, Now none of the solutions provided here works now (biblatex 3.11). The full code of my version is in a different thread: tex.stackexchange.com/questions/187181/…
– Matthias Pospiech
Sep 12 '18 at 19:49
4
4
See: tex.stackexchange.com/questions/44200/… -- Of course this only one suggestion. You can also use
DeclareSourcemap
-- see for example here: tex.stackexchange.com/questions/62779/…– Marco Daniel
Sep 19 '12 at 5:09
See: tex.stackexchange.com/questions/44200/… -- Of course this only one suggestion. You can also use
DeclareSourcemap
-- see for example here: tex.stackexchange.com/questions/62779/…– Marco Daniel
Sep 19 '12 at 5:09
2
2
For my own CV, I use
mkbibbold
. So the author field looks like this: author={A. Lastname, mkbibbold{Your name}, A. Lastname}
You should use biber though.– rowman
Sep 19 '12 at 19:10
For my own CV, I use
mkbibbold
. So the author field looks like this: author={A. Lastname, mkbibbold{Your name}, A. Lastname}
You should use biber though.– rowman
Sep 19 '12 at 19:10
The solution presented by @rowman wokrs great for me! Thanks!
– J_F
Apr 18 '18 at 12:11
The solution presented by @rowman wokrs great for me! Thanks!
– J_F
Apr 18 '18 at 12:11
I was using the solutions provided here, that worked for biblatex < 3.3, Now none of the solutions provided here works now (biblatex 3.11). The full code of my version is in a different thread: tex.stackexchange.com/questions/187181/…
– Matthias Pospiech
Sep 12 '18 at 19:49
I was using the solutions provided here, that worked for biblatex < 3.3, Now none of the solutions provided here works now (biblatex 3.11). The full code of my version is in a different thread: tex.stackexchange.com/questions/187181/…
– Matthias Pospiech
Sep 12 '18 at 19:49
add a comment |
6 Answers
6
active
oldest
votes
You can patch the name:last
, name:first-last
and name:last-first
macros defined in biblatex.def
. These are used by all of the default name formatting directives and take four arguments:
{<last name>}{<first name>}{<name prefix>}{<name affix>}
or
{<last name>}{<first name (initials)>}{<name prefix>}{<name affix>}
In the following we match only on the first and last name parts.
documentclass{article}
usepackage{biblatex}
usepackage{xpatch}% or use http://tex.stackexchange.com/a/40705
makeatletter
newbibmacro*{name:bold}[2]{%
edefblx@tmp@name{expandonce#1, expandonce#2}%
defdo##1{ifdefstring{blx@tmp@name}{##1}{bfserieslistbreak}{}}%
dolistloop{boldnames}}
newcommand*{boldnames}{}
makeatother
xpretobibmacro{name:family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:given-family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:family-given}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:delim}{begingroupnormalfont}{}{}
xapptobibmacro{name:family}{endgroup}{}{}
xapptobibmacro{name:given-family}{endgroup}{}{}
xapptobibmacro{name:family-given}{endgroup}{}{}
xapptobibmacro{name:delim}{endgroup}{}{}
% just for demonstration
ExecuteBibliographyOptions{maxnames=99,giveninits}
DeclareNameAlias{default}{family-given/given-family}
addbibresource{biblatex-examples.bib}
forcsvlist{listaddboldnames}
{{Herrmann, Wolfgang~A.}, {Herrmann, W.~A.}, {Herrmann, Wolfgangbibnamedelima A.},
{Herrmann, Wbibinitperiodbibinitdelim Abibinitperiod}}
setlength{parindent}{0pt}
setlength{parskip}{baselineskip}
begin{document}
fullcite{herrmann}
forcsvlist{listaddboldnames}
{{{"{O}}fele, Karl}, {{"{O}}fele, K.}, {{"{O}}fele, Kbibinitperiod}}
fullcite{herrmann}
renewcommand*{boldnames}{}
forcsvlist{listaddboldnames}
{{Hoffmann, Stephan~D.}, {Hoffmann, S.~D.}, {Hoffmann, Stephanbibnamedelima D.},
{Hoffmann, Sbibinitperiodbibinitdelim Dbibinitperiod}}
fullcite{herrmann}
end{document}
Note that the name parts in the boldnames
etoolbox
internal list should follow the format of the bbl
file, which is backend-dependent. The example here covers both biber and BibTeX. With biber you can also perform matching using the hash
field:
iffieldequalstr{hash}{<hash string>}
where <hash string>
can also be found in the bbl
file.
If your name is consistently formatted in the bib
file an alternative approach is to normalize name punctuation before matching. This example allows you to specify your name in BibTeX's format regardless of the backend.
documentclass{article}
usepackage{biblatex}
usepackage{xpatch}% or use http://tex.stackexchange.com/a/40705
defmakenamesetup{%
defbibnamedelima{~}%
defbibnamedelimb{ }%
defbibnamedelimc{ }%
defbibnamedelimd{ }%
defbibnamedelimi{ }%
defbibinitperiod{.}%
defbibinitdelim{~}%
defbibinithyphendelim{.-}}
newcommand*{makename}[3]{begingroupmakenamesetupxdef#1{#2, #3}endgroup}
newbibmacro*{name:bold}[2]{%
makename{currname}{#1}{#2}%
makename{findname}{lastname}{firstname}%
makename{findinit}{lastname}{firstinit}%
ifboolexpr{ test {ifdefequal{currname}{findname}}
or test {ifdefequal{currname}{findinit}} }{bfseries}{}}
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
xpretobibmacro{name:family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:given-family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:family-given}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:delim}{begingroupnormalfont}{}{}
xapptobibmacro{name:family}{endgroup}{}{}
xapptobibmacro{name:given-family}{endgroup}{}{}
xapptobibmacro{name:family-given}{endgroup}{}{}
xapptobibmacro{name:delim}{endgroup}{}{}
% just for demonstration
ExecuteBibliographyOptions{maxnames=99,giveninits}
DeclareNameAlias{default}{family-given/given-family}
addbibresource{biblatex-examples.bib}
boldname{Herrmann}{Wolfgang~A.}{W.~A.}
setlength{parindent}{0pt}
setlength{parskip}{baselineskip}
begin{document}
fullcite{herrmann}
boldname{{"O}fele}{Karl}{K.}
fullcite{herrmann}
boldname{Hoffmann}{Stephan~D.}{S.~D.}
fullcite{herrmann}
end{document}
This answer was updated to work with versions >= 3.3 of
biblatex
. See the edit history for older versions ofbiblatex
. -- moewe
So this answer looks good (I haven't tried it yet, but I will). But now I have changed to using thebiber
backend. Will this make it easier?
– jlconlin
Sep 19 '12 at 21:39
@Jeremy Not really. You can do pattern matching with biber viaDeclareSourceMap
, but it's the processed data that really matters - initials, location in the name list, etc. Biber also creates a hash string to identify each name, but its value isn't very meaningful.
– Audrey
Sep 20 '12 at 13:52
2
@K.-MichaelAye Yes, it provides a quick method for identifying a name but the identifier carries no meaning to us. In the above examplenewbibmacro*{name:bold}[2]{iffieldequalstr{hash}{aa1a2c66bf52b23789b077a79ac34863}{bfseries}{}}
would bold the first author's name. I pulled this hash string from thebbl
file.
– Audrey
Nov 25 '12 at 22:30
1
@K.-MichaelAye With hash field matching all you need are the patches - prefix thename:*
macros withbegingroupiffieldequalstr{hash}{aa1a2c66bf52b23789b077a79ac34863}{bfseries}{}
and append withendgroup
.
– Audrey
Nov 26 '12 at 3:04
2
Shouldn't this answer be updated to reflect the fact thatfirst
andlast
were deprecated in favor ofgiven
andfamily
, respectively? Making the relevant changes fixes the second MWE in your answer, but even after making those changes, the first MWE no longer works for me.
– Adam Liter
Mar 26 '16 at 21:13
|
show 6 more comments
Since biblatex
3.4/biber
2.5, there is a general "annotation" functionality to do things like this, for example:
documentclass{article}
usepackage{biblatex}
usepackage{filecontents}
begin{filecontents}{jobname.bib}
@MISC{test,
AUTHOR = {Last1, First1 and Last2, First2 and Last3, First3},
AUTHOR+an = {2=highlight},
}
end{filecontents}
addbibresource{jobname.bib}
renewcommand*{mkbibnamegiven}[1]{%
ifitemannotation{highlight}
{textbf{#1}}
{#1}}
renewcommand*{mkbibnamefamily}[1]{%
ifitemannotation{highlight}
{textbf{#1}}
{#1}}
begin{document}
nocite{*}
printbibliography
end{document}
You can also annotate at the name part level and the top-level field level. See the biblatex PDF manual for details.
Interesting feature, indeed! Hope they also did something on the performance issues ofbiber
, which recently made me to switch back tobibtex8
.
– Daniel
Apr 18 '16 at 15:36
3
"They" is me ... I did indeed. I spent some time onbiber
performance and whilebiber
is never going to be as fast asbibtex
(partly because it does a lot more thanbibtex
in thebiblatex
use case), it currently shows, in version 2.5, 400% speed improvement in the large test cases I used for tuning compared with any previous versions.
– PLK
Apr 18 '16 at 16:17
1
This look really neat. Is there a way to use this to highlight a name without hard-coding that in the bibliography. I'd like to highlight my name in my CV but not in articles. Thank you!
– tmalsburg
Nov 15 '16 at 10:28
1
Great solution, thank you! I'm just wondering is it possible to use this only in the bibliography and not in the text? Currently citations also show text as bold
– Vitomir Kovanovic
May 15 '17 at 20:43
1
Yes, just wrap therenewcommand
macros inAtEveryBibitem
so that they only apply to bibliography items.
– PLK
May 15 '17 at 21:27
|
show 1 more comment
As I couldn't use https://tex.stackexchange.com/a/73246/7561 as well, and in case others stumble into this looking for a solution, I'm updating the answers. As pointed by Adam Liter, in the comments of that answer, the options used in the previous answer are deprecated and doesn't work (at least for me).
Solution
Instead, I redefined the mkbibnamegiven
and mkbibnamefamily
, and used the same ideas as before.
Basically, you use the boldname
to the define the name you want to mark as bold, like: boldname{Lastname}{Givenname}{G.}
.
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
Then, we redefine the macros that generate the given and family names. The main idea is to search for the named defined above, and if it is found (including the given and family name) it makes it bold (using mkbibbold
), if not it leaves it as is.
% Patch new definitions
renewcommand{mkbibnamegiven}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
renewcommand{mkbibnamefamily}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
Example
A full example:
% !BIB program = biber
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
begin{filecontents}{jobname.bib}
@InProceedings{identifier1,
Title = {Some Awesome Title},
Author = {Some Author and Another Author},
Booktitle = {Some Book about the Future},
Year = {2042},
Pages = {1--42}
}
@InProceedings{identifier2,
Title = {Some So-So Title},
Author = {First Author and Second Author},
Booktitle = {An okay Booktitle},
Year = {2000},
Pages = {1--100}
}
@Book{test1,
author = {Goossens, Michel and Mittelbach, Frank
and Samarin, Alexander},
title = {The LaTeX Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{test2,
author = {Mittelbach, F. and Goossens, Michel
and Samarin, Alexander},
title = {The LaTeX Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{test3,
author = {Mittelbach, Frank and Samarin, Alexander
and Goossens, Michel},
title = {The LaTeX Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
end{filecontents}
addbibresource{jobname.bib}
defmakenamesetup{%
defbibnamedelima{~}%
defbibnamedelimb{ }%
defbibnamedelimc{ }%
defbibnamedelimd{ }%
defbibnamedelimi{ }%
defbibinitperiod{.}%
defbibinitdelim{~}%
defbibinithyphendelim{.-}}
newcommand*{makename}[2]{begingroupmakenamesetupxdef#1{#2}endgroup}
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
% Patch new definitions
renewcommand{mkbibnamegiven}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
renewcommand{mkbibnamefamily}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
boldname{Author}{Some}{S.}
begin{document}
nocite{*}
printbibliography
boldname{Goossens}{Michel}{M.}
printbibliography
boldname{Mittelbach}{Frank}{F.}
printbibliography
end{document}
Update
Added support for checking given and family names before bolding the name.
2
Among solutions I found, only this one works for me (MikTex on Windows). Thanks.
– Duke
Nov 22 '16 at 3:19
I cannot get this to work with middle names the way the Audrey answer used to, eg. if the author were "Frank Allen Mittelbach." Any thoughts?
– dayne
May 14 '17 at 20:47
If you are using adn's solution for the moderncv class you need to change the firstname lastname commands to make it work (since they are in conflict with the classes commands)
– Ohjeah
Jun 9 '17 at 17:32
1
@Ohjeah could you provide a solution regarding to using this with moderncv?
– K.-Michael Aye
Nov 23 '17 at 0:59
add a comment |
There is still an issue with the last answer by adn: The sub macros that use the Strings in boldname{Goossens}{Michel}{M.}
only search for these strings (i.e., "Goossens", "Michel", and "M.") independently of each other. That is: any occurrence of "M." will be bold, no matter whether it belongs to a different author (like "M." for "Martin"). Improving the search scripts to only make the respective names bold if they are detected in a sequence would solve this behavior. In its current form, its usefulness is quite limited given there are more than just a couple of references.
Here a MWE that shows the problem:
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
begin{filecontents}{jobname.bib}
@InProceedings{identifier1,
Title = {Some Awesome Title},
Author = {Some Author and Another Author},
Booktitle = {Some Book about the Future},
Year = {2042},
Pages = {1--42}
}
@InProceedings{identifier2,
Title = {Some So-So Title},
Author = {First Author and Second Author},
Booktitle = {An okay Booktitle},
Year = {2000},
Pages = {1--100}
}
end{filecontents}
addbibresource{jobname.bib}
defmakenamesetup{%
defbibnamedelima{~}%
defbibnamedelimb{ }%
defbibnamedelimc{ }%
defbibnamedelimd{ }%
defbibnamedelimi{ }%
defbibinitperiod{.}%
defbibinitdelim{~}%
defbibinithyphendelim{.-}}
newcommand*{makename}[2]{begingroupmakenamesetupxdef#1{#2}endgroup}
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
% Patch new definitions
renewcommand{mkbibnamegiven}[1]{%
makename{currname}{#1}%
makename{findname}{firstname}%
makename{findinit}{firstinit}%
ifboolexpr{ test {ifdefequal{currname}{findname}}%
or test {ifdefequal{currname}{findinit}} }%
{mkbibbold{#1}}{#1}%
}
renewcommand{mkbibnamefamily}[1]{%
makename{currname}{#1}%
makename{findname}{lastname}%
ifboolexpr{ test {ifdefequal{currname}{findname}} }%
{mkbibbold{#1}}{#1}%
}
boldname{Author}{Some}{S.}
begin{document}
nocite{*}
printbibliography
end{document}
It produces the following PDF, in which:
(a) all occurrences of "S." are bold, although one stands for "Second", which does not belong to the name "Some Author" and
(b) all occurrences of "Author" are bold (i.e., all four authors!), although just one matches the desired author "Some Author"
I hence propose another solution, which does solve this problem (however, there are other problems with it - and I would be glad if someone would present a solution for it). The solution was mentioned in Make one author's name bold every time it shows up in the bibliography (this link is also given in the very first post here one that page). However, (a) it does work with biblatex
, although jlconlin says that it only works with bibtex
and (b) I have extended it a bit to provide some further functionalities that you would not get without it (but that are provided by the previous answer, given by adn).
That solution simply uses a macro in the bibtex
files instead of the actual authors' names. Then, the textbf{}
macro does work, while the document would not compile if textbf{}
would be inserted directly in the .bib file.
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
usepackage{filecontents}
begin{filecontents}{jobname.bib}
@InProceedings{identifier1,
Title = {Some Awesome Title},
Author = {MyName[someKey]{S. Author} and Another Author},
Booktitle = {Some Book about the Future},
Year = {2042},
Pages = {1--42}
}
@InProceedings{identifier2,
Title = {Some So-So Title},
Author = {First Author and Second Author},
Booktitle = {An okay Booktitle},
Year = {2000},
Pages = {1--100}
}
end{filecontents}
addbibresource{jobname.bib}
begin{document}
newcommand{MyName}[2][empty]{ % empty is default for the opt. argument
ifthenelse{equal{#1}{empty}} % test the opt. argument
{hspace*{-.75mm}#2} % it's empty! just show mand. argument
{hspace*{-.75mm}textbf{#2}} % it's not empty! make mand. argument (the name) bold
}
nocite{*}
printbibliography
end{document}
It produces the following PDF:
As can be seen: the problem is solved, as exactly those authors are shown bold that use the macro. To be more precise: the is now an optional argument, which can be instantiated by any String of the user's choice. This "key" can be used in the definition of MyName
to define more specific behavior. For instance, I use biblatex
to use keywords (given in an extra keywords fields - not given here) in order to give several reference sections, divided by the keywords. If making an author's name bold should depend on that keyword (which is the case for me), that logic can be put into the if-then statement. (In my example, the name in the MyName
macro is shown bold if there is any keyword given and non-bold, otherwise. This can be extended -- obviously -- to match any specific key.
It is important to know that this solution does not support to abbreviate the authors' names given in the macro. You will see that I passed "S. Author" to MyName
instead of "Some Author", because latex/bibtex cannot produce "S. Author" from it. However, this does not make this solution any less practical, I think.
Its problem: All names which are put into the MyName
macro appear more to the right than without using the macro. That is, there is a space of approx. 2mm on the left of any such name. This occurs independently of the matching if case, i.e., no matter whether it is bold or not. This is the reason why I have added a negative hspace
in front of it. However,
(a) this quiet dirty. Isn't there a (la)tex macro that eliminates the additional space? and
(b) it is impossible to find the correct space that needs to be subtracted, because it is different for different bibtex
entries (sometimes this automatically inserted space is larger, sometimes it is smaller)
1
Check the updated answer. Your approach is also a solution. But I wanted something that does not involve updating the bib files.
– adn
Nov 23 '16 at 17:36
add a comment |
This is more or less a copy of my answer to Highlight an author in bibliography using biblatex allowing bibliography style to format it.
The following implements Audrey's solution for name hashes. The advantage of using hashes is that you only have to give one version of the name, all normalisation will be performed by Biber. The great disadvantage of hashes is that they are not easy to handle for humans. biblatex
can't create the hashes on the fly, so that they need to be looked up in the .bbl
file. The following solution automates hash lookup from the .bbl
, so that you can use it more easily.
The solution works by writing all names you want in bold to a separate .bib
file called (jobname -boldnames.bib
Warning That file will be overwritten without warning. In the unlikely event you already have a file of that name, you can rename the file by changing hlblx@bibfile@name
.). The hash can then be extracted using a dummy cite command.
Usage is very simple. Use addboldnames
to add a list of names to be highlighted. addboldnames
accepts a comma-separated list of names in the same format as you would write them to the .bib
file. If a name contains a comma, the entire name must be wrapped in curly braces.
addboldnames{{Silva, Carlos F. M.},{Silva, Jr., José Mairton B.}}
or
addboldnames{Emma Sigfridsson}
addboldnames
can be used in the preamble and the document body.
To reset the list of names to be highlighted, use resetboldnames
.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[backend=biber,style=numeric]{biblatex}
addbibresource{biblatex-examples.bib}
usepackage{xpatch}
makeatletter
defhlblx@bibfile@name{jobname -boldnames.bib}
newwritehlblx@bibfile
immediateopenouthlblx@bibfile=hlblx@bibfile@name
newcounter{hlblx@name}
setcounter{hlblx@name}{0}
newcommand*{hlblx@writenametobib}[1]{%
stepcounter{hlblx@name}%
edefhlblx@tmp@nocite{%
noexpandAfterPreamble{%
noexpandsetbox0noexpandvbox{%
noexpandhlblx@getmethehash{hlblx@name@thevalue{hlblx@name}}}}%
}%
hlblx@tmp@nocite
immediatewritehlblx@bibfile{%
@misc{hlblx@name@thevalue{hlblx@name}, author = {unexpanded{#1}}, %
options = {dataonly=true},}%
}%
}
AtEndDocument{%
closeouthlblx@bibfile}
addbibresource{hlblx@bibfile@name}
newcommand*{hlbxl@boldhashes}{}
DeclareNameFormat{hlblx@hashextract}{%
xifinlist{thefield{hash}}{hlbxl@boldhashes}
{}
{listxadd{hlbxl@boldhashes}{thefield{fullhash}}}}
DeclareCiteCommand{hlblx@getmethehash}
{}
{printnames[hlblx@hashextract][1-999]{author}}
{}
{}
newcommand*{addboldnames}{forcsvlisthlblx@writenametobib}
newcommand*{resetboldnames}{defhlbxl@boldhashes{}}
newbibmacro*{name:bold}{%
defdo##1{iffieldequalstr{hash}{##1}{bfserieslistbreak}{}}%
dolistloop{hlbxl@boldhashes}%
}
makeatother
xpretobibmacro{name:family}{begingroupusebibmacro{name:bold}}{}{}
xpretobibmacro{name:given-family}{begingroupusebibmacro{name:bold}}{}{}
xpretobibmacro{name:family-given}{begingroupusebibmacro{name:bold}}{}{}
xpretobibmacro{name:delim}{begingroupnormalfont}{}{}
xapptobibmacro{name:family}{endgroup}{}{}
xapptobibmacro{name:given-family}{endgroup}{}{}
xapptobibmacro{name:family-given}{endgroup}{}{}
xapptobibmacro{name:delim}{endgroup}{}{}
addboldnames{{Sigfridsson, Emma},{Vizedom, Monika B.}}
begin{document}
fullcite{sigfridsson}
fullcite{knuth:ct:a}
fullcite{vizedom:related}
resetboldnamesaddboldnames{Donald E. Knuth}
fullcite{knuth:ct:a}
resetboldnamesaddboldnames{Philipp Jaff{'e}}
fullcite{jaffe}
end{document}
What about name variants such as D. E. Knuth and Donald E. Knuth?
– jlconlin
Feb 21 '18 at 10:18
@jlconlin Of course that does not work. As far as Biber/biblatex
are concerned these two are different people. How would they know differently?
– moewe
Feb 21 '18 at 10:20
add a comment |
Combining solution by adn, and suggestion by Audrey to use the "hash" field generated by biber, this works (texlive 2017.20170818-1):
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
addbibresource{biblatex-examples.bib}
% Run biber once, find the hash you want in the generated .bbl file
% (here, M. Goossens) and paste here:
edefauthorhash{detokenize{0743efb276e9219ee664a9b3dbd60619}}
renewcommand{mkbibnamegiven}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
renewcommand{mkbibnamefamily}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
renewcommand{mkbibnameprefix}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
renewcommand{mkbibnamesuffix}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
begin{document}
nocite{companion}
printbibliography
end{document}
Edit: Following moewe's good advices, fixes and verifications (thanks !) :
- switched to using the distrib’s .bib sample
- added support to prefix/suffix parts of the names
- used a macro to avoid copy-pasting hash 4 times
Patching name:
as suggested by Audrey would indeed be more efficient but apparently it does not work anymore for some reason (see comment Make specific author bold using biblatex).
1
Welcome to TeX.SX! You could make your answer more useful if you usedbiblatex-examples
, a file that is automatically available ifbiblatex
is installed, instead ofmybiblio.bib
, which we don't have. You can avoid having to paste the hash twice if you save it in a macro. Note also that if the name has a suffix or prefix that will not be printed in bold with your solution.
– moewe
Feb 8 '18 at 15:07
edefboldname{detokenize{0743efb276e9219ee664a9b3dbd60619}} renewcommand{mkbibnamegiven}[1]{% iffieldequals{hash}{boldname}{mkbibbold{#1}}{#1}% } renewcommand{mkbibnamefamily}[1]{% iffieldequals{hash}{boldname}{mkbibbold{#1}}{#1}% }
(modulo line breaks) works for me. The hashes are detokenized so we need to do the same.mkbibnamesuffix
andmkbibnameprefix
should work, not sure how you added the fields by hand. The great advantage of Audrey's patching thename:
macros instead ofmkbibname...
is that the entire name is processed in one go ...
– moewe
Feb 8 '18 at 20:16
... and not each name part separately.
– moewe
Feb 8 '18 at 20:16
Patchingname:
does still work, but you have to replacelast
byfamily
andfirst
bygiven
. There were some change in name handling in version 3.3, see tex.stackexchange.com/q/299036/35864
– moewe
Feb 9 '18 at 15:24
See tex.stackexchange.com/q/274436/35864 for a full solution withhashes
that works.
– moewe
Feb 9 '18 at 15:25
|
show 1 more comment
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f73136%2fmake-specific-author-bold-using-biblatex%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can patch the name:last
, name:first-last
and name:last-first
macros defined in biblatex.def
. These are used by all of the default name formatting directives and take four arguments:
{<last name>}{<first name>}{<name prefix>}{<name affix>}
or
{<last name>}{<first name (initials)>}{<name prefix>}{<name affix>}
In the following we match only on the first and last name parts.
documentclass{article}
usepackage{biblatex}
usepackage{xpatch}% or use http://tex.stackexchange.com/a/40705
makeatletter
newbibmacro*{name:bold}[2]{%
edefblx@tmp@name{expandonce#1, expandonce#2}%
defdo##1{ifdefstring{blx@tmp@name}{##1}{bfserieslistbreak}{}}%
dolistloop{boldnames}}
newcommand*{boldnames}{}
makeatother
xpretobibmacro{name:family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:given-family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:family-given}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:delim}{begingroupnormalfont}{}{}
xapptobibmacro{name:family}{endgroup}{}{}
xapptobibmacro{name:given-family}{endgroup}{}{}
xapptobibmacro{name:family-given}{endgroup}{}{}
xapptobibmacro{name:delim}{endgroup}{}{}
% just for demonstration
ExecuteBibliographyOptions{maxnames=99,giveninits}
DeclareNameAlias{default}{family-given/given-family}
addbibresource{biblatex-examples.bib}
forcsvlist{listaddboldnames}
{{Herrmann, Wolfgang~A.}, {Herrmann, W.~A.}, {Herrmann, Wolfgangbibnamedelima A.},
{Herrmann, Wbibinitperiodbibinitdelim Abibinitperiod}}
setlength{parindent}{0pt}
setlength{parskip}{baselineskip}
begin{document}
fullcite{herrmann}
forcsvlist{listaddboldnames}
{{{"{O}}fele, Karl}, {{"{O}}fele, K.}, {{"{O}}fele, Kbibinitperiod}}
fullcite{herrmann}
renewcommand*{boldnames}{}
forcsvlist{listaddboldnames}
{{Hoffmann, Stephan~D.}, {Hoffmann, S.~D.}, {Hoffmann, Stephanbibnamedelima D.},
{Hoffmann, Sbibinitperiodbibinitdelim Dbibinitperiod}}
fullcite{herrmann}
end{document}
Note that the name parts in the boldnames
etoolbox
internal list should follow the format of the bbl
file, which is backend-dependent. The example here covers both biber and BibTeX. With biber you can also perform matching using the hash
field:
iffieldequalstr{hash}{<hash string>}
where <hash string>
can also be found in the bbl
file.
If your name is consistently formatted in the bib
file an alternative approach is to normalize name punctuation before matching. This example allows you to specify your name in BibTeX's format regardless of the backend.
documentclass{article}
usepackage{biblatex}
usepackage{xpatch}% or use http://tex.stackexchange.com/a/40705
defmakenamesetup{%
defbibnamedelima{~}%
defbibnamedelimb{ }%
defbibnamedelimc{ }%
defbibnamedelimd{ }%
defbibnamedelimi{ }%
defbibinitperiod{.}%
defbibinitdelim{~}%
defbibinithyphendelim{.-}}
newcommand*{makename}[3]{begingroupmakenamesetupxdef#1{#2, #3}endgroup}
newbibmacro*{name:bold}[2]{%
makename{currname}{#1}{#2}%
makename{findname}{lastname}{firstname}%
makename{findinit}{lastname}{firstinit}%
ifboolexpr{ test {ifdefequal{currname}{findname}}
or test {ifdefequal{currname}{findinit}} }{bfseries}{}}
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
xpretobibmacro{name:family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:given-family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:family-given}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:delim}{begingroupnormalfont}{}{}
xapptobibmacro{name:family}{endgroup}{}{}
xapptobibmacro{name:given-family}{endgroup}{}{}
xapptobibmacro{name:family-given}{endgroup}{}{}
xapptobibmacro{name:delim}{endgroup}{}{}
% just for demonstration
ExecuteBibliographyOptions{maxnames=99,giveninits}
DeclareNameAlias{default}{family-given/given-family}
addbibresource{biblatex-examples.bib}
boldname{Herrmann}{Wolfgang~A.}{W.~A.}
setlength{parindent}{0pt}
setlength{parskip}{baselineskip}
begin{document}
fullcite{herrmann}
boldname{{"O}fele}{Karl}{K.}
fullcite{herrmann}
boldname{Hoffmann}{Stephan~D.}{S.~D.}
fullcite{herrmann}
end{document}
This answer was updated to work with versions >= 3.3 of
biblatex
. See the edit history for older versions ofbiblatex
. -- moewe
So this answer looks good (I haven't tried it yet, but I will). But now I have changed to using thebiber
backend. Will this make it easier?
– jlconlin
Sep 19 '12 at 21:39
@Jeremy Not really. You can do pattern matching with biber viaDeclareSourceMap
, but it's the processed data that really matters - initials, location in the name list, etc. Biber also creates a hash string to identify each name, but its value isn't very meaningful.
– Audrey
Sep 20 '12 at 13:52
2
@K.-MichaelAye Yes, it provides a quick method for identifying a name but the identifier carries no meaning to us. In the above examplenewbibmacro*{name:bold}[2]{iffieldequalstr{hash}{aa1a2c66bf52b23789b077a79ac34863}{bfseries}{}}
would bold the first author's name. I pulled this hash string from thebbl
file.
– Audrey
Nov 25 '12 at 22:30
1
@K.-MichaelAye With hash field matching all you need are the patches - prefix thename:*
macros withbegingroupiffieldequalstr{hash}{aa1a2c66bf52b23789b077a79ac34863}{bfseries}{}
and append withendgroup
.
– Audrey
Nov 26 '12 at 3:04
2
Shouldn't this answer be updated to reflect the fact thatfirst
andlast
were deprecated in favor ofgiven
andfamily
, respectively? Making the relevant changes fixes the second MWE in your answer, but even after making those changes, the first MWE no longer works for me.
– Adam Liter
Mar 26 '16 at 21:13
|
show 6 more comments
You can patch the name:last
, name:first-last
and name:last-first
macros defined in biblatex.def
. These are used by all of the default name formatting directives and take four arguments:
{<last name>}{<first name>}{<name prefix>}{<name affix>}
or
{<last name>}{<first name (initials)>}{<name prefix>}{<name affix>}
In the following we match only on the first and last name parts.
documentclass{article}
usepackage{biblatex}
usepackage{xpatch}% or use http://tex.stackexchange.com/a/40705
makeatletter
newbibmacro*{name:bold}[2]{%
edefblx@tmp@name{expandonce#1, expandonce#2}%
defdo##1{ifdefstring{blx@tmp@name}{##1}{bfserieslistbreak}{}}%
dolistloop{boldnames}}
newcommand*{boldnames}{}
makeatother
xpretobibmacro{name:family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:given-family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:family-given}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:delim}{begingroupnormalfont}{}{}
xapptobibmacro{name:family}{endgroup}{}{}
xapptobibmacro{name:given-family}{endgroup}{}{}
xapptobibmacro{name:family-given}{endgroup}{}{}
xapptobibmacro{name:delim}{endgroup}{}{}
% just for demonstration
ExecuteBibliographyOptions{maxnames=99,giveninits}
DeclareNameAlias{default}{family-given/given-family}
addbibresource{biblatex-examples.bib}
forcsvlist{listaddboldnames}
{{Herrmann, Wolfgang~A.}, {Herrmann, W.~A.}, {Herrmann, Wolfgangbibnamedelima A.},
{Herrmann, Wbibinitperiodbibinitdelim Abibinitperiod}}
setlength{parindent}{0pt}
setlength{parskip}{baselineskip}
begin{document}
fullcite{herrmann}
forcsvlist{listaddboldnames}
{{{"{O}}fele, Karl}, {{"{O}}fele, K.}, {{"{O}}fele, Kbibinitperiod}}
fullcite{herrmann}
renewcommand*{boldnames}{}
forcsvlist{listaddboldnames}
{{Hoffmann, Stephan~D.}, {Hoffmann, S.~D.}, {Hoffmann, Stephanbibnamedelima D.},
{Hoffmann, Sbibinitperiodbibinitdelim Dbibinitperiod}}
fullcite{herrmann}
end{document}
Note that the name parts in the boldnames
etoolbox
internal list should follow the format of the bbl
file, which is backend-dependent. The example here covers both biber and BibTeX. With biber you can also perform matching using the hash
field:
iffieldequalstr{hash}{<hash string>}
where <hash string>
can also be found in the bbl
file.
If your name is consistently formatted in the bib
file an alternative approach is to normalize name punctuation before matching. This example allows you to specify your name in BibTeX's format regardless of the backend.
documentclass{article}
usepackage{biblatex}
usepackage{xpatch}% or use http://tex.stackexchange.com/a/40705
defmakenamesetup{%
defbibnamedelima{~}%
defbibnamedelimb{ }%
defbibnamedelimc{ }%
defbibnamedelimd{ }%
defbibnamedelimi{ }%
defbibinitperiod{.}%
defbibinitdelim{~}%
defbibinithyphendelim{.-}}
newcommand*{makename}[3]{begingroupmakenamesetupxdef#1{#2, #3}endgroup}
newbibmacro*{name:bold}[2]{%
makename{currname}{#1}{#2}%
makename{findname}{lastname}{firstname}%
makename{findinit}{lastname}{firstinit}%
ifboolexpr{ test {ifdefequal{currname}{findname}}
or test {ifdefequal{currname}{findinit}} }{bfseries}{}}
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
xpretobibmacro{name:family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:given-family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:family-given}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:delim}{begingroupnormalfont}{}{}
xapptobibmacro{name:family}{endgroup}{}{}
xapptobibmacro{name:given-family}{endgroup}{}{}
xapptobibmacro{name:family-given}{endgroup}{}{}
xapptobibmacro{name:delim}{endgroup}{}{}
% just for demonstration
ExecuteBibliographyOptions{maxnames=99,giveninits}
DeclareNameAlias{default}{family-given/given-family}
addbibresource{biblatex-examples.bib}
boldname{Herrmann}{Wolfgang~A.}{W.~A.}
setlength{parindent}{0pt}
setlength{parskip}{baselineskip}
begin{document}
fullcite{herrmann}
boldname{{"O}fele}{Karl}{K.}
fullcite{herrmann}
boldname{Hoffmann}{Stephan~D.}{S.~D.}
fullcite{herrmann}
end{document}
This answer was updated to work with versions >= 3.3 of
biblatex
. See the edit history for older versions ofbiblatex
. -- moewe
So this answer looks good (I haven't tried it yet, but I will). But now I have changed to using thebiber
backend. Will this make it easier?
– jlconlin
Sep 19 '12 at 21:39
@Jeremy Not really. You can do pattern matching with biber viaDeclareSourceMap
, but it's the processed data that really matters - initials, location in the name list, etc. Biber also creates a hash string to identify each name, but its value isn't very meaningful.
– Audrey
Sep 20 '12 at 13:52
2
@K.-MichaelAye Yes, it provides a quick method for identifying a name but the identifier carries no meaning to us. In the above examplenewbibmacro*{name:bold}[2]{iffieldequalstr{hash}{aa1a2c66bf52b23789b077a79ac34863}{bfseries}{}}
would bold the first author's name. I pulled this hash string from thebbl
file.
– Audrey
Nov 25 '12 at 22:30
1
@K.-MichaelAye With hash field matching all you need are the patches - prefix thename:*
macros withbegingroupiffieldequalstr{hash}{aa1a2c66bf52b23789b077a79ac34863}{bfseries}{}
and append withendgroup
.
– Audrey
Nov 26 '12 at 3:04
2
Shouldn't this answer be updated to reflect the fact thatfirst
andlast
were deprecated in favor ofgiven
andfamily
, respectively? Making the relevant changes fixes the second MWE in your answer, but even after making those changes, the first MWE no longer works for me.
– Adam Liter
Mar 26 '16 at 21:13
|
show 6 more comments
You can patch the name:last
, name:first-last
and name:last-first
macros defined in biblatex.def
. These are used by all of the default name formatting directives and take four arguments:
{<last name>}{<first name>}{<name prefix>}{<name affix>}
or
{<last name>}{<first name (initials)>}{<name prefix>}{<name affix>}
In the following we match only on the first and last name parts.
documentclass{article}
usepackage{biblatex}
usepackage{xpatch}% or use http://tex.stackexchange.com/a/40705
makeatletter
newbibmacro*{name:bold}[2]{%
edefblx@tmp@name{expandonce#1, expandonce#2}%
defdo##1{ifdefstring{blx@tmp@name}{##1}{bfserieslistbreak}{}}%
dolistloop{boldnames}}
newcommand*{boldnames}{}
makeatother
xpretobibmacro{name:family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:given-family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:family-given}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:delim}{begingroupnormalfont}{}{}
xapptobibmacro{name:family}{endgroup}{}{}
xapptobibmacro{name:given-family}{endgroup}{}{}
xapptobibmacro{name:family-given}{endgroup}{}{}
xapptobibmacro{name:delim}{endgroup}{}{}
% just for demonstration
ExecuteBibliographyOptions{maxnames=99,giveninits}
DeclareNameAlias{default}{family-given/given-family}
addbibresource{biblatex-examples.bib}
forcsvlist{listaddboldnames}
{{Herrmann, Wolfgang~A.}, {Herrmann, W.~A.}, {Herrmann, Wolfgangbibnamedelima A.},
{Herrmann, Wbibinitperiodbibinitdelim Abibinitperiod}}
setlength{parindent}{0pt}
setlength{parskip}{baselineskip}
begin{document}
fullcite{herrmann}
forcsvlist{listaddboldnames}
{{{"{O}}fele, Karl}, {{"{O}}fele, K.}, {{"{O}}fele, Kbibinitperiod}}
fullcite{herrmann}
renewcommand*{boldnames}{}
forcsvlist{listaddboldnames}
{{Hoffmann, Stephan~D.}, {Hoffmann, S.~D.}, {Hoffmann, Stephanbibnamedelima D.},
{Hoffmann, Sbibinitperiodbibinitdelim Dbibinitperiod}}
fullcite{herrmann}
end{document}
Note that the name parts in the boldnames
etoolbox
internal list should follow the format of the bbl
file, which is backend-dependent. The example here covers both biber and BibTeX. With biber you can also perform matching using the hash
field:
iffieldequalstr{hash}{<hash string>}
where <hash string>
can also be found in the bbl
file.
If your name is consistently formatted in the bib
file an alternative approach is to normalize name punctuation before matching. This example allows you to specify your name in BibTeX's format regardless of the backend.
documentclass{article}
usepackage{biblatex}
usepackage{xpatch}% or use http://tex.stackexchange.com/a/40705
defmakenamesetup{%
defbibnamedelima{~}%
defbibnamedelimb{ }%
defbibnamedelimc{ }%
defbibnamedelimd{ }%
defbibnamedelimi{ }%
defbibinitperiod{.}%
defbibinitdelim{~}%
defbibinithyphendelim{.-}}
newcommand*{makename}[3]{begingroupmakenamesetupxdef#1{#2, #3}endgroup}
newbibmacro*{name:bold}[2]{%
makename{currname}{#1}{#2}%
makename{findname}{lastname}{firstname}%
makename{findinit}{lastname}{firstinit}%
ifboolexpr{ test {ifdefequal{currname}{findname}}
or test {ifdefequal{currname}{findinit}} }{bfseries}{}}
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
xpretobibmacro{name:family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:given-family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:family-given}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:delim}{begingroupnormalfont}{}{}
xapptobibmacro{name:family}{endgroup}{}{}
xapptobibmacro{name:given-family}{endgroup}{}{}
xapptobibmacro{name:family-given}{endgroup}{}{}
xapptobibmacro{name:delim}{endgroup}{}{}
% just for demonstration
ExecuteBibliographyOptions{maxnames=99,giveninits}
DeclareNameAlias{default}{family-given/given-family}
addbibresource{biblatex-examples.bib}
boldname{Herrmann}{Wolfgang~A.}{W.~A.}
setlength{parindent}{0pt}
setlength{parskip}{baselineskip}
begin{document}
fullcite{herrmann}
boldname{{"O}fele}{Karl}{K.}
fullcite{herrmann}
boldname{Hoffmann}{Stephan~D.}{S.~D.}
fullcite{herrmann}
end{document}
This answer was updated to work with versions >= 3.3 of
biblatex
. See the edit history for older versions ofbiblatex
. -- moewe
You can patch the name:last
, name:first-last
and name:last-first
macros defined in biblatex.def
. These are used by all of the default name formatting directives and take four arguments:
{<last name>}{<first name>}{<name prefix>}{<name affix>}
or
{<last name>}{<first name (initials)>}{<name prefix>}{<name affix>}
In the following we match only on the first and last name parts.
documentclass{article}
usepackage{biblatex}
usepackage{xpatch}% or use http://tex.stackexchange.com/a/40705
makeatletter
newbibmacro*{name:bold}[2]{%
edefblx@tmp@name{expandonce#1, expandonce#2}%
defdo##1{ifdefstring{blx@tmp@name}{##1}{bfserieslistbreak}{}}%
dolistloop{boldnames}}
newcommand*{boldnames}{}
makeatother
xpretobibmacro{name:family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:given-family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:family-given}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:delim}{begingroupnormalfont}{}{}
xapptobibmacro{name:family}{endgroup}{}{}
xapptobibmacro{name:given-family}{endgroup}{}{}
xapptobibmacro{name:family-given}{endgroup}{}{}
xapptobibmacro{name:delim}{endgroup}{}{}
% just for demonstration
ExecuteBibliographyOptions{maxnames=99,giveninits}
DeclareNameAlias{default}{family-given/given-family}
addbibresource{biblatex-examples.bib}
forcsvlist{listaddboldnames}
{{Herrmann, Wolfgang~A.}, {Herrmann, W.~A.}, {Herrmann, Wolfgangbibnamedelima A.},
{Herrmann, Wbibinitperiodbibinitdelim Abibinitperiod}}
setlength{parindent}{0pt}
setlength{parskip}{baselineskip}
begin{document}
fullcite{herrmann}
forcsvlist{listaddboldnames}
{{{"{O}}fele, Karl}, {{"{O}}fele, K.}, {{"{O}}fele, Kbibinitperiod}}
fullcite{herrmann}
renewcommand*{boldnames}{}
forcsvlist{listaddboldnames}
{{Hoffmann, Stephan~D.}, {Hoffmann, S.~D.}, {Hoffmann, Stephanbibnamedelima D.},
{Hoffmann, Sbibinitperiodbibinitdelim Dbibinitperiod}}
fullcite{herrmann}
end{document}
Note that the name parts in the boldnames
etoolbox
internal list should follow the format of the bbl
file, which is backend-dependent. The example here covers both biber and BibTeX. With biber you can also perform matching using the hash
field:
iffieldequalstr{hash}{<hash string>}
where <hash string>
can also be found in the bbl
file.
If your name is consistently formatted in the bib
file an alternative approach is to normalize name punctuation before matching. This example allows you to specify your name in BibTeX's format regardless of the backend.
documentclass{article}
usepackage{biblatex}
usepackage{xpatch}% or use http://tex.stackexchange.com/a/40705
defmakenamesetup{%
defbibnamedelima{~}%
defbibnamedelimb{ }%
defbibnamedelimc{ }%
defbibnamedelimd{ }%
defbibnamedelimi{ }%
defbibinitperiod{.}%
defbibinitdelim{~}%
defbibinithyphendelim{.-}}
newcommand*{makename}[3]{begingroupmakenamesetupxdef#1{#2, #3}endgroup}
newbibmacro*{name:bold}[2]{%
makename{currname}{#1}{#2}%
makename{findname}{lastname}{firstname}%
makename{findinit}{lastname}{firstinit}%
ifboolexpr{ test {ifdefequal{currname}{findname}}
or test {ifdefequal{currname}{findinit}} }{bfseries}{}}
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
xpretobibmacro{name:family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:given-family}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:family-given}{begingroupusebibmacro{name:bold}{#1}{#2}}{}{}
xpretobibmacro{name:delim}{begingroupnormalfont}{}{}
xapptobibmacro{name:family}{endgroup}{}{}
xapptobibmacro{name:given-family}{endgroup}{}{}
xapptobibmacro{name:family-given}{endgroup}{}{}
xapptobibmacro{name:delim}{endgroup}{}{}
% just for demonstration
ExecuteBibliographyOptions{maxnames=99,giveninits}
DeclareNameAlias{default}{family-given/given-family}
addbibresource{biblatex-examples.bib}
boldname{Herrmann}{Wolfgang~A.}{W.~A.}
setlength{parindent}{0pt}
setlength{parskip}{baselineskip}
begin{document}
fullcite{herrmann}
boldname{{"O}fele}{Karl}{K.}
fullcite{herrmann}
boldname{Hoffmann}{Stephan~D.}{S.~D.}
fullcite{herrmann}
end{document}
This answer was updated to work with versions >= 3.3 of
biblatex
. See the edit history for older versions ofbiblatex
. -- moewe
edited Feb 22 '18 at 12:19
moewe
94k10115354
94k10115354
answered Sep 19 '12 at 18:33
AudreyAudrey
25k291145
25k291145
So this answer looks good (I haven't tried it yet, but I will). But now I have changed to using thebiber
backend. Will this make it easier?
– jlconlin
Sep 19 '12 at 21:39
@Jeremy Not really. You can do pattern matching with biber viaDeclareSourceMap
, but it's the processed data that really matters - initials, location in the name list, etc. Biber also creates a hash string to identify each name, but its value isn't very meaningful.
– Audrey
Sep 20 '12 at 13:52
2
@K.-MichaelAye Yes, it provides a quick method for identifying a name but the identifier carries no meaning to us. In the above examplenewbibmacro*{name:bold}[2]{iffieldequalstr{hash}{aa1a2c66bf52b23789b077a79ac34863}{bfseries}{}}
would bold the first author's name. I pulled this hash string from thebbl
file.
– Audrey
Nov 25 '12 at 22:30
1
@K.-MichaelAye With hash field matching all you need are the patches - prefix thename:*
macros withbegingroupiffieldequalstr{hash}{aa1a2c66bf52b23789b077a79ac34863}{bfseries}{}
and append withendgroup
.
– Audrey
Nov 26 '12 at 3:04
2
Shouldn't this answer be updated to reflect the fact thatfirst
andlast
were deprecated in favor ofgiven
andfamily
, respectively? Making the relevant changes fixes the second MWE in your answer, but even after making those changes, the first MWE no longer works for me.
– Adam Liter
Mar 26 '16 at 21:13
|
show 6 more comments
So this answer looks good (I haven't tried it yet, but I will). But now I have changed to using thebiber
backend. Will this make it easier?
– jlconlin
Sep 19 '12 at 21:39
@Jeremy Not really. You can do pattern matching with biber viaDeclareSourceMap
, but it's the processed data that really matters - initials, location in the name list, etc. Biber also creates a hash string to identify each name, but its value isn't very meaningful.
– Audrey
Sep 20 '12 at 13:52
2
@K.-MichaelAye Yes, it provides a quick method for identifying a name but the identifier carries no meaning to us. In the above examplenewbibmacro*{name:bold}[2]{iffieldequalstr{hash}{aa1a2c66bf52b23789b077a79ac34863}{bfseries}{}}
would bold the first author's name. I pulled this hash string from thebbl
file.
– Audrey
Nov 25 '12 at 22:30
1
@K.-MichaelAye With hash field matching all you need are the patches - prefix thename:*
macros withbegingroupiffieldequalstr{hash}{aa1a2c66bf52b23789b077a79ac34863}{bfseries}{}
and append withendgroup
.
– Audrey
Nov 26 '12 at 3:04
2
Shouldn't this answer be updated to reflect the fact thatfirst
andlast
were deprecated in favor ofgiven
andfamily
, respectively? Making the relevant changes fixes the second MWE in your answer, but even after making those changes, the first MWE no longer works for me.
– Adam Liter
Mar 26 '16 at 21:13
So this answer looks good (I haven't tried it yet, but I will). But now I have changed to using the
biber
backend. Will this make it easier?– jlconlin
Sep 19 '12 at 21:39
So this answer looks good (I haven't tried it yet, but I will). But now I have changed to using the
biber
backend. Will this make it easier?– jlconlin
Sep 19 '12 at 21:39
@Jeremy Not really. You can do pattern matching with biber via
DeclareSourceMap
, but it's the processed data that really matters - initials, location in the name list, etc. Biber also creates a hash string to identify each name, but its value isn't very meaningful.– Audrey
Sep 20 '12 at 13:52
@Jeremy Not really. You can do pattern matching with biber via
DeclareSourceMap
, but it's the processed data that really matters - initials, location in the name list, etc. Biber also creates a hash string to identify each name, but its value isn't very meaningful.– Audrey
Sep 20 '12 at 13:52
2
2
@K.-MichaelAye Yes, it provides a quick method for identifying a name but the identifier carries no meaning to us. In the above example
newbibmacro*{name:bold}[2]{iffieldequalstr{hash}{aa1a2c66bf52b23789b077a79ac34863}{bfseries}{}}
would bold the first author's name. I pulled this hash string from the bbl
file.– Audrey
Nov 25 '12 at 22:30
@K.-MichaelAye Yes, it provides a quick method for identifying a name but the identifier carries no meaning to us. In the above example
newbibmacro*{name:bold}[2]{iffieldequalstr{hash}{aa1a2c66bf52b23789b077a79ac34863}{bfseries}{}}
would bold the first author's name. I pulled this hash string from the bbl
file.– Audrey
Nov 25 '12 at 22:30
1
1
@K.-MichaelAye With hash field matching all you need are the patches - prefix the
name:*
macros with begingroupiffieldequalstr{hash}{aa1a2c66bf52b23789b077a79ac34863}{bfseries}{}
and append with endgroup
.– Audrey
Nov 26 '12 at 3:04
@K.-MichaelAye With hash field matching all you need are the patches - prefix the
name:*
macros with begingroupiffieldequalstr{hash}{aa1a2c66bf52b23789b077a79ac34863}{bfseries}{}
and append with endgroup
.– Audrey
Nov 26 '12 at 3:04
2
2
Shouldn't this answer be updated to reflect the fact that
first
and last
were deprecated in favor of given
and family
, respectively? Making the relevant changes fixes the second MWE in your answer, but even after making those changes, the first MWE no longer works for me.– Adam Liter
Mar 26 '16 at 21:13
Shouldn't this answer be updated to reflect the fact that
first
and last
were deprecated in favor of given
and family
, respectively? Making the relevant changes fixes the second MWE in your answer, but even after making those changes, the first MWE no longer works for me.– Adam Liter
Mar 26 '16 at 21:13
|
show 6 more comments
Since biblatex
3.4/biber
2.5, there is a general "annotation" functionality to do things like this, for example:
documentclass{article}
usepackage{biblatex}
usepackage{filecontents}
begin{filecontents}{jobname.bib}
@MISC{test,
AUTHOR = {Last1, First1 and Last2, First2 and Last3, First3},
AUTHOR+an = {2=highlight},
}
end{filecontents}
addbibresource{jobname.bib}
renewcommand*{mkbibnamegiven}[1]{%
ifitemannotation{highlight}
{textbf{#1}}
{#1}}
renewcommand*{mkbibnamefamily}[1]{%
ifitemannotation{highlight}
{textbf{#1}}
{#1}}
begin{document}
nocite{*}
printbibliography
end{document}
You can also annotate at the name part level and the top-level field level. See the biblatex PDF manual for details.
Interesting feature, indeed! Hope they also did something on the performance issues ofbiber
, which recently made me to switch back tobibtex8
.
– Daniel
Apr 18 '16 at 15:36
3
"They" is me ... I did indeed. I spent some time onbiber
performance and whilebiber
is never going to be as fast asbibtex
(partly because it does a lot more thanbibtex
in thebiblatex
use case), it currently shows, in version 2.5, 400% speed improvement in the large test cases I used for tuning compared with any previous versions.
– PLK
Apr 18 '16 at 16:17
1
This look really neat. Is there a way to use this to highlight a name without hard-coding that in the bibliography. I'd like to highlight my name in my CV but not in articles. Thank you!
– tmalsburg
Nov 15 '16 at 10:28
1
Great solution, thank you! I'm just wondering is it possible to use this only in the bibliography and not in the text? Currently citations also show text as bold
– Vitomir Kovanovic
May 15 '17 at 20:43
1
Yes, just wrap therenewcommand
macros inAtEveryBibitem
so that they only apply to bibliography items.
– PLK
May 15 '17 at 21:27
|
show 1 more comment
Since biblatex
3.4/biber
2.5, there is a general "annotation" functionality to do things like this, for example:
documentclass{article}
usepackage{biblatex}
usepackage{filecontents}
begin{filecontents}{jobname.bib}
@MISC{test,
AUTHOR = {Last1, First1 and Last2, First2 and Last3, First3},
AUTHOR+an = {2=highlight},
}
end{filecontents}
addbibresource{jobname.bib}
renewcommand*{mkbibnamegiven}[1]{%
ifitemannotation{highlight}
{textbf{#1}}
{#1}}
renewcommand*{mkbibnamefamily}[1]{%
ifitemannotation{highlight}
{textbf{#1}}
{#1}}
begin{document}
nocite{*}
printbibliography
end{document}
You can also annotate at the name part level and the top-level field level. See the biblatex PDF manual for details.
Interesting feature, indeed! Hope they also did something on the performance issues ofbiber
, which recently made me to switch back tobibtex8
.
– Daniel
Apr 18 '16 at 15:36
3
"They" is me ... I did indeed. I spent some time onbiber
performance and whilebiber
is never going to be as fast asbibtex
(partly because it does a lot more thanbibtex
in thebiblatex
use case), it currently shows, in version 2.5, 400% speed improvement in the large test cases I used for tuning compared with any previous versions.
– PLK
Apr 18 '16 at 16:17
1
This look really neat. Is there a way to use this to highlight a name without hard-coding that in the bibliography. I'd like to highlight my name in my CV but not in articles. Thank you!
– tmalsburg
Nov 15 '16 at 10:28
1
Great solution, thank you! I'm just wondering is it possible to use this only in the bibliography and not in the text? Currently citations also show text as bold
– Vitomir Kovanovic
May 15 '17 at 20:43
1
Yes, just wrap therenewcommand
macros inAtEveryBibitem
so that they only apply to bibliography items.
– PLK
May 15 '17 at 21:27
|
show 1 more comment
Since biblatex
3.4/biber
2.5, there is a general "annotation" functionality to do things like this, for example:
documentclass{article}
usepackage{biblatex}
usepackage{filecontents}
begin{filecontents}{jobname.bib}
@MISC{test,
AUTHOR = {Last1, First1 and Last2, First2 and Last3, First3},
AUTHOR+an = {2=highlight},
}
end{filecontents}
addbibresource{jobname.bib}
renewcommand*{mkbibnamegiven}[1]{%
ifitemannotation{highlight}
{textbf{#1}}
{#1}}
renewcommand*{mkbibnamefamily}[1]{%
ifitemannotation{highlight}
{textbf{#1}}
{#1}}
begin{document}
nocite{*}
printbibliography
end{document}
You can also annotate at the name part level and the top-level field level. See the biblatex PDF manual for details.
Since biblatex
3.4/biber
2.5, there is a general "annotation" functionality to do things like this, for example:
documentclass{article}
usepackage{biblatex}
usepackage{filecontents}
begin{filecontents}{jobname.bib}
@MISC{test,
AUTHOR = {Last1, First1 and Last2, First2 and Last3, First3},
AUTHOR+an = {2=highlight},
}
end{filecontents}
addbibresource{jobname.bib}
renewcommand*{mkbibnamegiven}[1]{%
ifitemannotation{highlight}
{textbf{#1}}
{#1}}
renewcommand*{mkbibnamefamily}[1]{%
ifitemannotation{highlight}
{textbf{#1}}
{#1}}
begin{document}
nocite{*}
printbibliography
end{document}
You can also annotate at the name part level and the top-level field level. See the biblatex PDF manual for details.
edited Jan 30 '18 at 19:28
answered Apr 18 '16 at 13:52
PLKPLK
18.6k24987
18.6k24987
Interesting feature, indeed! Hope they also did something on the performance issues ofbiber
, which recently made me to switch back tobibtex8
.
– Daniel
Apr 18 '16 at 15:36
3
"They" is me ... I did indeed. I spent some time onbiber
performance and whilebiber
is never going to be as fast asbibtex
(partly because it does a lot more thanbibtex
in thebiblatex
use case), it currently shows, in version 2.5, 400% speed improvement in the large test cases I used for tuning compared with any previous versions.
– PLK
Apr 18 '16 at 16:17
1
This look really neat. Is there a way to use this to highlight a name without hard-coding that in the bibliography. I'd like to highlight my name in my CV but not in articles. Thank you!
– tmalsburg
Nov 15 '16 at 10:28
1
Great solution, thank you! I'm just wondering is it possible to use this only in the bibliography and not in the text? Currently citations also show text as bold
– Vitomir Kovanovic
May 15 '17 at 20:43
1
Yes, just wrap therenewcommand
macros inAtEveryBibitem
so that they only apply to bibliography items.
– PLK
May 15 '17 at 21:27
|
show 1 more comment
Interesting feature, indeed! Hope they also did something on the performance issues ofbiber
, which recently made me to switch back tobibtex8
.
– Daniel
Apr 18 '16 at 15:36
3
"They" is me ... I did indeed. I spent some time onbiber
performance and whilebiber
is never going to be as fast asbibtex
(partly because it does a lot more thanbibtex
in thebiblatex
use case), it currently shows, in version 2.5, 400% speed improvement in the large test cases I used for tuning compared with any previous versions.
– PLK
Apr 18 '16 at 16:17
1
This look really neat. Is there a way to use this to highlight a name without hard-coding that in the bibliography. I'd like to highlight my name in my CV but not in articles. Thank you!
– tmalsburg
Nov 15 '16 at 10:28
1
Great solution, thank you! I'm just wondering is it possible to use this only in the bibliography and not in the text? Currently citations also show text as bold
– Vitomir Kovanovic
May 15 '17 at 20:43
1
Yes, just wrap therenewcommand
macros inAtEveryBibitem
so that they only apply to bibliography items.
– PLK
May 15 '17 at 21:27
Interesting feature, indeed! Hope they also did something on the performance issues of
biber
, which recently made me to switch back to bibtex8
.– Daniel
Apr 18 '16 at 15:36
Interesting feature, indeed! Hope they also did something on the performance issues of
biber
, which recently made me to switch back to bibtex8
.– Daniel
Apr 18 '16 at 15:36
3
3
"They" is me ... I did indeed. I spent some time on
biber
performance and while biber
is never going to be as fast as bibtex
(partly because it does a lot more than bibtex
in the biblatex
use case), it currently shows, in version 2.5, 400% speed improvement in the large test cases I used for tuning compared with any previous versions.– PLK
Apr 18 '16 at 16:17
"They" is me ... I did indeed. I spent some time on
biber
performance and while biber
is never going to be as fast as bibtex
(partly because it does a lot more than bibtex
in the biblatex
use case), it currently shows, in version 2.5, 400% speed improvement in the large test cases I used for tuning compared with any previous versions.– PLK
Apr 18 '16 at 16:17
1
1
This look really neat. Is there a way to use this to highlight a name without hard-coding that in the bibliography. I'd like to highlight my name in my CV but not in articles. Thank you!
– tmalsburg
Nov 15 '16 at 10:28
This look really neat. Is there a way to use this to highlight a name without hard-coding that in the bibliography. I'd like to highlight my name in my CV but not in articles. Thank you!
– tmalsburg
Nov 15 '16 at 10:28
1
1
Great solution, thank you! I'm just wondering is it possible to use this only in the bibliography and not in the text? Currently citations also show text as bold
– Vitomir Kovanovic
May 15 '17 at 20:43
Great solution, thank you! I'm just wondering is it possible to use this only in the bibliography and not in the text? Currently citations also show text as bold
– Vitomir Kovanovic
May 15 '17 at 20:43
1
1
Yes, just wrap the
renewcommand
macros in AtEveryBibitem
so that they only apply to bibliography items.– PLK
May 15 '17 at 21:27
Yes, just wrap the
renewcommand
macros in AtEveryBibitem
so that they only apply to bibliography items.– PLK
May 15 '17 at 21:27
|
show 1 more comment
As I couldn't use https://tex.stackexchange.com/a/73246/7561 as well, and in case others stumble into this looking for a solution, I'm updating the answers. As pointed by Adam Liter, in the comments of that answer, the options used in the previous answer are deprecated and doesn't work (at least for me).
Solution
Instead, I redefined the mkbibnamegiven
and mkbibnamefamily
, and used the same ideas as before.
Basically, you use the boldname
to the define the name you want to mark as bold, like: boldname{Lastname}{Givenname}{G.}
.
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
Then, we redefine the macros that generate the given and family names. The main idea is to search for the named defined above, and if it is found (including the given and family name) it makes it bold (using mkbibbold
), if not it leaves it as is.
% Patch new definitions
renewcommand{mkbibnamegiven}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
renewcommand{mkbibnamefamily}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
Example
A full example:
% !BIB program = biber
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
begin{filecontents}{jobname.bib}
@InProceedings{identifier1,
Title = {Some Awesome Title},
Author = {Some Author and Another Author},
Booktitle = {Some Book about the Future},
Year = {2042},
Pages = {1--42}
}
@InProceedings{identifier2,
Title = {Some So-So Title},
Author = {First Author and Second Author},
Booktitle = {An okay Booktitle},
Year = {2000},
Pages = {1--100}
}
@Book{test1,
author = {Goossens, Michel and Mittelbach, Frank
and Samarin, Alexander},
title = {The LaTeX Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{test2,
author = {Mittelbach, F. and Goossens, Michel
and Samarin, Alexander},
title = {The LaTeX Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{test3,
author = {Mittelbach, Frank and Samarin, Alexander
and Goossens, Michel},
title = {The LaTeX Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
end{filecontents}
addbibresource{jobname.bib}
defmakenamesetup{%
defbibnamedelima{~}%
defbibnamedelimb{ }%
defbibnamedelimc{ }%
defbibnamedelimd{ }%
defbibnamedelimi{ }%
defbibinitperiod{.}%
defbibinitdelim{~}%
defbibinithyphendelim{.-}}
newcommand*{makename}[2]{begingroupmakenamesetupxdef#1{#2}endgroup}
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
% Patch new definitions
renewcommand{mkbibnamegiven}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
renewcommand{mkbibnamefamily}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
boldname{Author}{Some}{S.}
begin{document}
nocite{*}
printbibliography
boldname{Goossens}{Michel}{M.}
printbibliography
boldname{Mittelbach}{Frank}{F.}
printbibliography
end{document}
Update
Added support for checking given and family names before bolding the name.
2
Among solutions I found, only this one works for me (MikTex on Windows). Thanks.
– Duke
Nov 22 '16 at 3:19
I cannot get this to work with middle names the way the Audrey answer used to, eg. if the author were "Frank Allen Mittelbach." Any thoughts?
– dayne
May 14 '17 at 20:47
If you are using adn's solution for the moderncv class you need to change the firstname lastname commands to make it work (since they are in conflict with the classes commands)
– Ohjeah
Jun 9 '17 at 17:32
1
@Ohjeah could you provide a solution regarding to using this with moderncv?
– K.-Michael Aye
Nov 23 '17 at 0:59
add a comment |
As I couldn't use https://tex.stackexchange.com/a/73246/7561 as well, and in case others stumble into this looking for a solution, I'm updating the answers. As pointed by Adam Liter, in the comments of that answer, the options used in the previous answer are deprecated and doesn't work (at least for me).
Solution
Instead, I redefined the mkbibnamegiven
and mkbibnamefamily
, and used the same ideas as before.
Basically, you use the boldname
to the define the name you want to mark as bold, like: boldname{Lastname}{Givenname}{G.}
.
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
Then, we redefine the macros that generate the given and family names. The main idea is to search for the named defined above, and if it is found (including the given and family name) it makes it bold (using mkbibbold
), if not it leaves it as is.
% Patch new definitions
renewcommand{mkbibnamegiven}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
renewcommand{mkbibnamefamily}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
Example
A full example:
% !BIB program = biber
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
begin{filecontents}{jobname.bib}
@InProceedings{identifier1,
Title = {Some Awesome Title},
Author = {Some Author and Another Author},
Booktitle = {Some Book about the Future},
Year = {2042},
Pages = {1--42}
}
@InProceedings{identifier2,
Title = {Some So-So Title},
Author = {First Author and Second Author},
Booktitle = {An okay Booktitle},
Year = {2000},
Pages = {1--100}
}
@Book{test1,
author = {Goossens, Michel and Mittelbach, Frank
and Samarin, Alexander},
title = {The LaTeX Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{test2,
author = {Mittelbach, F. and Goossens, Michel
and Samarin, Alexander},
title = {The LaTeX Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{test3,
author = {Mittelbach, Frank and Samarin, Alexander
and Goossens, Michel},
title = {The LaTeX Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
end{filecontents}
addbibresource{jobname.bib}
defmakenamesetup{%
defbibnamedelima{~}%
defbibnamedelimb{ }%
defbibnamedelimc{ }%
defbibnamedelimd{ }%
defbibnamedelimi{ }%
defbibinitperiod{.}%
defbibinitdelim{~}%
defbibinithyphendelim{.-}}
newcommand*{makename}[2]{begingroupmakenamesetupxdef#1{#2}endgroup}
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
% Patch new definitions
renewcommand{mkbibnamegiven}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
renewcommand{mkbibnamefamily}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
boldname{Author}{Some}{S.}
begin{document}
nocite{*}
printbibliography
boldname{Goossens}{Michel}{M.}
printbibliography
boldname{Mittelbach}{Frank}{F.}
printbibliography
end{document}
Update
Added support for checking given and family names before bolding the name.
2
Among solutions I found, only this one works for me (MikTex on Windows). Thanks.
– Duke
Nov 22 '16 at 3:19
I cannot get this to work with middle names the way the Audrey answer used to, eg. if the author were "Frank Allen Mittelbach." Any thoughts?
– dayne
May 14 '17 at 20:47
If you are using adn's solution for the moderncv class you need to change the firstname lastname commands to make it work (since they are in conflict with the classes commands)
– Ohjeah
Jun 9 '17 at 17:32
1
@Ohjeah could you provide a solution regarding to using this with moderncv?
– K.-Michael Aye
Nov 23 '17 at 0:59
add a comment |
As I couldn't use https://tex.stackexchange.com/a/73246/7561 as well, and in case others stumble into this looking for a solution, I'm updating the answers. As pointed by Adam Liter, in the comments of that answer, the options used in the previous answer are deprecated and doesn't work (at least for me).
Solution
Instead, I redefined the mkbibnamegiven
and mkbibnamefamily
, and used the same ideas as before.
Basically, you use the boldname
to the define the name you want to mark as bold, like: boldname{Lastname}{Givenname}{G.}
.
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
Then, we redefine the macros that generate the given and family names. The main idea is to search for the named defined above, and if it is found (including the given and family name) it makes it bold (using mkbibbold
), if not it leaves it as is.
% Patch new definitions
renewcommand{mkbibnamegiven}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
renewcommand{mkbibnamefamily}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
Example
A full example:
% !BIB program = biber
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
begin{filecontents}{jobname.bib}
@InProceedings{identifier1,
Title = {Some Awesome Title},
Author = {Some Author and Another Author},
Booktitle = {Some Book about the Future},
Year = {2042},
Pages = {1--42}
}
@InProceedings{identifier2,
Title = {Some So-So Title},
Author = {First Author and Second Author},
Booktitle = {An okay Booktitle},
Year = {2000},
Pages = {1--100}
}
@Book{test1,
author = {Goossens, Michel and Mittelbach, Frank
and Samarin, Alexander},
title = {The LaTeX Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{test2,
author = {Mittelbach, F. and Goossens, Michel
and Samarin, Alexander},
title = {The LaTeX Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{test3,
author = {Mittelbach, Frank and Samarin, Alexander
and Goossens, Michel},
title = {The LaTeX Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
end{filecontents}
addbibresource{jobname.bib}
defmakenamesetup{%
defbibnamedelima{~}%
defbibnamedelimb{ }%
defbibnamedelimc{ }%
defbibnamedelimd{ }%
defbibnamedelimi{ }%
defbibinitperiod{.}%
defbibinitdelim{~}%
defbibinithyphendelim{.-}}
newcommand*{makename}[2]{begingroupmakenamesetupxdef#1{#2}endgroup}
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
% Patch new definitions
renewcommand{mkbibnamegiven}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
renewcommand{mkbibnamefamily}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
boldname{Author}{Some}{S.}
begin{document}
nocite{*}
printbibliography
boldname{Goossens}{Michel}{M.}
printbibliography
boldname{Mittelbach}{Frank}{F.}
printbibliography
end{document}
Update
Added support for checking given and family names before bolding the name.
As I couldn't use https://tex.stackexchange.com/a/73246/7561 as well, and in case others stumble into this looking for a solution, I'm updating the answers. As pointed by Adam Liter, in the comments of that answer, the options used in the previous answer are deprecated and doesn't work (at least for me).
Solution
Instead, I redefined the mkbibnamegiven
and mkbibnamefamily
, and used the same ideas as before.
Basically, you use the boldname
to the define the name you want to mark as bold, like: boldname{Lastname}{Givenname}{G.}
.
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
Then, we redefine the macros that generate the given and family names. The main idea is to search for the named defined above, and if it is found (including the given and family name) it makes it bold (using mkbibbold
), if not it leaves it as is.
% Patch new definitions
renewcommand{mkbibnamegiven}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
renewcommand{mkbibnamefamily}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
Example
A full example:
% !BIB program = biber
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
begin{filecontents}{jobname.bib}
@InProceedings{identifier1,
Title = {Some Awesome Title},
Author = {Some Author and Another Author},
Booktitle = {Some Book about the Future},
Year = {2042},
Pages = {1--42}
}
@InProceedings{identifier2,
Title = {Some So-So Title},
Author = {First Author and Second Author},
Booktitle = {An okay Booktitle},
Year = {2000},
Pages = {1--100}
}
@Book{test1,
author = {Goossens, Michel and Mittelbach, Frank
and Samarin, Alexander},
title = {The LaTeX Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{test2,
author = {Mittelbach, F. and Goossens, Michel
and Samarin, Alexander},
title = {The LaTeX Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{test3,
author = {Mittelbach, Frank and Samarin, Alexander
and Goossens, Michel},
title = {The LaTeX Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
end{filecontents}
addbibresource{jobname.bib}
defmakenamesetup{%
defbibnamedelima{~}%
defbibnamedelimb{ }%
defbibnamedelimc{ }%
defbibnamedelimd{ }%
defbibnamedelimi{ }%
defbibinitperiod{.}%
defbibinitdelim{~}%
defbibinithyphendelim{.-}}
newcommand*{makename}[2]{begingroupmakenamesetupxdef#1{#2}endgroup}
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
% Patch new definitions
renewcommand{mkbibnamegiven}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
renewcommand{mkbibnamefamily}[1]{%
ifboolexpr{ ( test {ifdefequal{firstname}{namepartgiven}} or test {ifdefequal{firstinit}{namepartgiven}} ) and test {ifdefequal{lastname}{namepartfamily}} }
{mkbibbold{#1}}{#1}%
}
boldname{Author}{Some}{S.}
begin{document}
nocite{*}
printbibliography
boldname{Goossens}{Michel}{M.}
printbibliography
boldname{Mittelbach}{Frank}{F.}
printbibliography
end{document}
Update
Added support for checking given and family names before bolding the name.
edited Apr 13 '17 at 12:34
Community♦
1
1
answered Aug 29 '16 at 16:43
adnadn
5,55653476
5,55653476
2
Among solutions I found, only this one works for me (MikTex on Windows). Thanks.
– Duke
Nov 22 '16 at 3:19
I cannot get this to work with middle names the way the Audrey answer used to, eg. if the author were "Frank Allen Mittelbach." Any thoughts?
– dayne
May 14 '17 at 20:47
If you are using adn's solution for the moderncv class you need to change the firstname lastname commands to make it work (since they are in conflict with the classes commands)
– Ohjeah
Jun 9 '17 at 17:32
1
@Ohjeah could you provide a solution regarding to using this with moderncv?
– K.-Michael Aye
Nov 23 '17 at 0:59
add a comment |
2
Among solutions I found, only this one works for me (MikTex on Windows). Thanks.
– Duke
Nov 22 '16 at 3:19
I cannot get this to work with middle names the way the Audrey answer used to, eg. if the author were "Frank Allen Mittelbach." Any thoughts?
– dayne
May 14 '17 at 20:47
If you are using adn's solution for the moderncv class you need to change the firstname lastname commands to make it work (since they are in conflict with the classes commands)
– Ohjeah
Jun 9 '17 at 17:32
1
@Ohjeah could you provide a solution regarding to using this with moderncv?
– K.-Michael Aye
Nov 23 '17 at 0:59
2
2
Among solutions I found, only this one works for me (MikTex on Windows). Thanks.
– Duke
Nov 22 '16 at 3:19
Among solutions I found, only this one works for me (MikTex on Windows). Thanks.
– Duke
Nov 22 '16 at 3:19
I cannot get this to work with middle names the way the Audrey answer used to, eg. if the author were "Frank Allen Mittelbach." Any thoughts?
– dayne
May 14 '17 at 20:47
I cannot get this to work with middle names the way the Audrey answer used to, eg. if the author were "Frank Allen Mittelbach." Any thoughts?
– dayne
May 14 '17 at 20:47
If you are using adn's solution for the moderncv class you need to change the firstname lastname commands to make it work (since they are in conflict with the classes commands)
– Ohjeah
Jun 9 '17 at 17:32
If you are using adn's solution for the moderncv class you need to change the firstname lastname commands to make it work (since they are in conflict with the classes commands)
– Ohjeah
Jun 9 '17 at 17:32
1
1
@Ohjeah could you provide a solution regarding to using this with moderncv?
– K.-Michael Aye
Nov 23 '17 at 0:59
@Ohjeah could you provide a solution regarding to using this with moderncv?
– K.-Michael Aye
Nov 23 '17 at 0:59
add a comment |
There is still an issue with the last answer by adn: The sub macros that use the Strings in boldname{Goossens}{Michel}{M.}
only search for these strings (i.e., "Goossens", "Michel", and "M.") independently of each other. That is: any occurrence of "M." will be bold, no matter whether it belongs to a different author (like "M." for "Martin"). Improving the search scripts to only make the respective names bold if they are detected in a sequence would solve this behavior. In its current form, its usefulness is quite limited given there are more than just a couple of references.
Here a MWE that shows the problem:
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
begin{filecontents}{jobname.bib}
@InProceedings{identifier1,
Title = {Some Awesome Title},
Author = {Some Author and Another Author},
Booktitle = {Some Book about the Future},
Year = {2042},
Pages = {1--42}
}
@InProceedings{identifier2,
Title = {Some So-So Title},
Author = {First Author and Second Author},
Booktitle = {An okay Booktitle},
Year = {2000},
Pages = {1--100}
}
end{filecontents}
addbibresource{jobname.bib}
defmakenamesetup{%
defbibnamedelima{~}%
defbibnamedelimb{ }%
defbibnamedelimc{ }%
defbibnamedelimd{ }%
defbibnamedelimi{ }%
defbibinitperiod{.}%
defbibinitdelim{~}%
defbibinithyphendelim{.-}}
newcommand*{makename}[2]{begingroupmakenamesetupxdef#1{#2}endgroup}
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
% Patch new definitions
renewcommand{mkbibnamegiven}[1]{%
makename{currname}{#1}%
makename{findname}{firstname}%
makename{findinit}{firstinit}%
ifboolexpr{ test {ifdefequal{currname}{findname}}%
or test {ifdefequal{currname}{findinit}} }%
{mkbibbold{#1}}{#1}%
}
renewcommand{mkbibnamefamily}[1]{%
makename{currname}{#1}%
makename{findname}{lastname}%
ifboolexpr{ test {ifdefequal{currname}{findname}} }%
{mkbibbold{#1}}{#1}%
}
boldname{Author}{Some}{S.}
begin{document}
nocite{*}
printbibliography
end{document}
It produces the following PDF, in which:
(a) all occurrences of "S." are bold, although one stands for "Second", which does not belong to the name "Some Author" and
(b) all occurrences of "Author" are bold (i.e., all four authors!), although just one matches the desired author "Some Author"
I hence propose another solution, which does solve this problem (however, there are other problems with it - and I would be glad if someone would present a solution for it). The solution was mentioned in Make one author's name bold every time it shows up in the bibliography (this link is also given in the very first post here one that page). However, (a) it does work with biblatex
, although jlconlin says that it only works with bibtex
and (b) I have extended it a bit to provide some further functionalities that you would not get without it (but that are provided by the previous answer, given by adn).
That solution simply uses a macro in the bibtex
files instead of the actual authors' names. Then, the textbf{}
macro does work, while the document would not compile if textbf{}
would be inserted directly in the .bib file.
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
usepackage{filecontents}
begin{filecontents}{jobname.bib}
@InProceedings{identifier1,
Title = {Some Awesome Title},
Author = {MyName[someKey]{S. Author} and Another Author},
Booktitle = {Some Book about the Future},
Year = {2042},
Pages = {1--42}
}
@InProceedings{identifier2,
Title = {Some So-So Title},
Author = {First Author and Second Author},
Booktitle = {An okay Booktitle},
Year = {2000},
Pages = {1--100}
}
end{filecontents}
addbibresource{jobname.bib}
begin{document}
newcommand{MyName}[2][empty]{ % empty is default for the opt. argument
ifthenelse{equal{#1}{empty}} % test the opt. argument
{hspace*{-.75mm}#2} % it's empty! just show mand. argument
{hspace*{-.75mm}textbf{#2}} % it's not empty! make mand. argument (the name) bold
}
nocite{*}
printbibliography
end{document}
It produces the following PDF:
As can be seen: the problem is solved, as exactly those authors are shown bold that use the macro. To be more precise: the is now an optional argument, which can be instantiated by any String of the user's choice. This "key" can be used in the definition of MyName
to define more specific behavior. For instance, I use biblatex
to use keywords (given in an extra keywords fields - not given here) in order to give several reference sections, divided by the keywords. If making an author's name bold should depend on that keyword (which is the case for me), that logic can be put into the if-then statement. (In my example, the name in the MyName
macro is shown bold if there is any keyword given and non-bold, otherwise. This can be extended -- obviously -- to match any specific key.
It is important to know that this solution does not support to abbreviate the authors' names given in the macro. You will see that I passed "S. Author" to MyName
instead of "Some Author", because latex/bibtex cannot produce "S. Author" from it. However, this does not make this solution any less practical, I think.
Its problem: All names which are put into the MyName
macro appear more to the right than without using the macro. That is, there is a space of approx. 2mm on the left of any such name. This occurs independently of the matching if case, i.e., no matter whether it is bold or not. This is the reason why I have added a negative hspace
in front of it. However,
(a) this quiet dirty. Isn't there a (la)tex macro that eliminates the additional space? and
(b) it is impossible to find the correct space that needs to be subtracted, because it is different for different bibtex
entries (sometimes this automatically inserted space is larger, sometimes it is smaller)
1
Check the updated answer. Your approach is also a solution. But I wanted something that does not involve updating the bib files.
– adn
Nov 23 '16 at 17:36
add a comment |
There is still an issue with the last answer by adn: The sub macros that use the Strings in boldname{Goossens}{Michel}{M.}
only search for these strings (i.e., "Goossens", "Michel", and "M.") independently of each other. That is: any occurrence of "M." will be bold, no matter whether it belongs to a different author (like "M." for "Martin"). Improving the search scripts to only make the respective names bold if they are detected in a sequence would solve this behavior. In its current form, its usefulness is quite limited given there are more than just a couple of references.
Here a MWE that shows the problem:
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
begin{filecontents}{jobname.bib}
@InProceedings{identifier1,
Title = {Some Awesome Title},
Author = {Some Author and Another Author},
Booktitle = {Some Book about the Future},
Year = {2042},
Pages = {1--42}
}
@InProceedings{identifier2,
Title = {Some So-So Title},
Author = {First Author and Second Author},
Booktitle = {An okay Booktitle},
Year = {2000},
Pages = {1--100}
}
end{filecontents}
addbibresource{jobname.bib}
defmakenamesetup{%
defbibnamedelima{~}%
defbibnamedelimb{ }%
defbibnamedelimc{ }%
defbibnamedelimd{ }%
defbibnamedelimi{ }%
defbibinitperiod{.}%
defbibinitdelim{~}%
defbibinithyphendelim{.-}}
newcommand*{makename}[2]{begingroupmakenamesetupxdef#1{#2}endgroup}
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
% Patch new definitions
renewcommand{mkbibnamegiven}[1]{%
makename{currname}{#1}%
makename{findname}{firstname}%
makename{findinit}{firstinit}%
ifboolexpr{ test {ifdefequal{currname}{findname}}%
or test {ifdefequal{currname}{findinit}} }%
{mkbibbold{#1}}{#1}%
}
renewcommand{mkbibnamefamily}[1]{%
makename{currname}{#1}%
makename{findname}{lastname}%
ifboolexpr{ test {ifdefequal{currname}{findname}} }%
{mkbibbold{#1}}{#1}%
}
boldname{Author}{Some}{S.}
begin{document}
nocite{*}
printbibliography
end{document}
It produces the following PDF, in which:
(a) all occurrences of "S." are bold, although one stands for "Second", which does not belong to the name "Some Author" and
(b) all occurrences of "Author" are bold (i.e., all four authors!), although just one matches the desired author "Some Author"
I hence propose another solution, which does solve this problem (however, there are other problems with it - and I would be glad if someone would present a solution for it). The solution was mentioned in Make one author's name bold every time it shows up in the bibliography (this link is also given in the very first post here one that page). However, (a) it does work with biblatex
, although jlconlin says that it only works with bibtex
and (b) I have extended it a bit to provide some further functionalities that you would not get without it (but that are provided by the previous answer, given by adn).
That solution simply uses a macro in the bibtex
files instead of the actual authors' names. Then, the textbf{}
macro does work, while the document would not compile if textbf{}
would be inserted directly in the .bib file.
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
usepackage{filecontents}
begin{filecontents}{jobname.bib}
@InProceedings{identifier1,
Title = {Some Awesome Title},
Author = {MyName[someKey]{S. Author} and Another Author},
Booktitle = {Some Book about the Future},
Year = {2042},
Pages = {1--42}
}
@InProceedings{identifier2,
Title = {Some So-So Title},
Author = {First Author and Second Author},
Booktitle = {An okay Booktitle},
Year = {2000},
Pages = {1--100}
}
end{filecontents}
addbibresource{jobname.bib}
begin{document}
newcommand{MyName}[2][empty]{ % empty is default for the opt. argument
ifthenelse{equal{#1}{empty}} % test the opt. argument
{hspace*{-.75mm}#2} % it's empty! just show mand. argument
{hspace*{-.75mm}textbf{#2}} % it's not empty! make mand. argument (the name) bold
}
nocite{*}
printbibliography
end{document}
It produces the following PDF:
As can be seen: the problem is solved, as exactly those authors are shown bold that use the macro. To be more precise: the is now an optional argument, which can be instantiated by any String of the user's choice. This "key" can be used in the definition of MyName
to define more specific behavior. For instance, I use biblatex
to use keywords (given in an extra keywords fields - not given here) in order to give several reference sections, divided by the keywords. If making an author's name bold should depend on that keyword (which is the case for me), that logic can be put into the if-then statement. (In my example, the name in the MyName
macro is shown bold if there is any keyword given and non-bold, otherwise. This can be extended -- obviously -- to match any specific key.
It is important to know that this solution does not support to abbreviate the authors' names given in the macro. You will see that I passed "S. Author" to MyName
instead of "Some Author", because latex/bibtex cannot produce "S. Author" from it. However, this does not make this solution any less practical, I think.
Its problem: All names which are put into the MyName
macro appear more to the right than without using the macro. That is, there is a space of approx. 2mm on the left of any such name. This occurs independently of the matching if case, i.e., no matter whether it is bold or not. This is the reason why I have added a negative hspace
in front of it. However,
(a) this quiet dirty. Isn't there a (la)tex macro that eliminates the additional space? and
(b) it is impossible to find the correct space that needs to be subtracted, because it is different for different bibtex
entries (sometimes this automatically inserted space is larger, sometimes it is smaller)
1
Check the updated answer. Your approach is also a solution. But I wanted something that does not involve updating the bib files.
– adn
Nov 23 '16 at 17:36
add a comment |
There is still an issue with the last answer by adn: The sub macros that use the Strings in boldname{Goossens}{Michel}{M.}
only search for these strings (i.e., "Goossens", "Michel", and "M.") independently of each other. That is: any occurrence of "M." will be bold, no matter whether it belongs to a different author (like "M." for "Martin"). Improving the search scripts to only make the respective names bold if they are detected in a sequence would solve this behavior. In its current form, its usefulness is quite limited given there are more than just a couple of references.
Here a MWE that shows the problem:
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
begin{filecontents}{jobname.bib}
@InProceedings{identifier1,
Title = {Some Awesome Title},
Author = {Some Author and Another Author},
Booktitle = {Some Book about the Future},
Year = {2042},
Pages = {1--42}
}
@InProceedings{identifier2,
Title = {Some So-So Title},
Author = {First Author and Second Author},
Booktitle = {An okay Booktitle},
Year = {2000},
Pages = {1--100}
}
end{filecontents}
addbibresource{jobname.bib}
defmakenamesetup{%
defbibnamedelima{~}%
defbibnamedelimb{ }%
defbibnamedelimc{ }%
defbibnamedelimd{ }%
defbibnamedelimi{ }%
defbibinitperiod{.}%
defbibinitdelim{~}%
defbibinithyphendelim{.-}}
newcommand*{makename}[2]{begingroupmakenamesetupxdef#1{#2}endgroup}
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
% Patch new definitions
renewcommand{mkbibnamegiven}[1]{%
makename{currname}{#1}%
makename{findname}{firstname}%
makename{findinit}{firstinit}%
ifboolexpr{ test {ifdefequal{currname}{findname}}%
or test {ifdefequal{currname}{findinit}} }%
{mkbibbold{#1}}{#1}%
}
renewcommand{mkbibnamefamily}[1]{%
makename{currname}{#1}%
makename{findname}{lastname}%
ifboolexpr{ test {ifdefequal{currname}{findname}} }%
{mkbibbold{#1}}{#1}%
}
boldname{Author}{Some}{S.}
begin{document}
nocite{*}
printbibliography
end{document}
It produces the following PDF, in which:
(a) all occurrences of "S." are bold, although one stands for "Second", which does not belong to the name "Some Author" and
(b) all occurrences of "Author" are bold (i.e., all four authors!), although just one matches the desired author "Some Author"
I hence propose another solution, which does solve this problem (however, there are other problems with it - and I would be glad if someone would present a solution for it). The solution was mentioned in Make one author's name bold every time it shows up in the bibliography (this link is also given in the very first post here one that page). However, (a) it does work with biblatex
, although jlconlin says that it only works with bibtex
and (b) I have extended it a bit to provide some further functionalities that you would not get without it (but that are provided by the previous answer, given by adn).
That solution simply uses a macro in the bibtex
files instead of the actual authors' names. Then, the textbf{}
macro does work, while the document would not compile if textbf{}
would be inserted directly in the .bib file.
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
usepackage{filecontents}
begin{filecontents}{jobname.bib}
@InProceedings{identifier1,
Title = {Some Awesome Title},
Author = {MyName[someKey]{S. Author} and Another Author},
Booktitle = {Some Book about the Future},
Year = {2042},
Pages = {1--42}
}
@InProceedings{identifier2,
Title = {Some So-So Title},
Author = {First Author and Second Author},
Booktitle = {An okay Booktitle},
Year = {2000},
Pages = {1--100}
}
end{filecontents}
addbibresource{jobname.bib}
begin{document}
newcommand{MyName}[2][empty]{ % empty is default for the opt. argument
ifthenelse{equal{#1}{empty}} % test the opt. argument
{hspace*{-.75mm}#2} % it's empty! just show mand. argument
{hspace*{-.75mm}textbf{#2}} % it's not empty! make mand. argument (the name) bold
}
nocite{*}
printbibliography
end{document}
It produces the following PDF:
As can be seen: the problem is solved, as exactly those authors are shown bold that use the macro. To be more precise: the is now an optional argument, which can be instantiated by any String of the user's choice. This "key" can be used in the definition of MyName
to define more specific behavior. For instance, I use biblatex
to use keywords (given in an extra keywords fields - not given here) in order to give several reference sections, divided by the keywords. If making an author's name bold should depend on that keyword (which is the case for me), that logic can be put into the if-then statement. (In my example, the name in the MyName
macro is shown bold if there is any keyword given and non-bold, otherwise. This can be extended -- obviously -- to match any specific key.
It is important to know that this solution does not support to abbreviate the authors' names given in the macro. You will see that I passed "S. Author" to MyName
instead of "Some Author", because latex/bibtex cannot produce "S. Author" from it. However, this does not make this solution any less practical, I think.
Its problem: All names which are put into the MyName
macro appear more to the right than without using the macro. That is, there is a space of approx. 2mm on the left of any such name. This occurs independently of the matching if case, i.e., no matter whether it is bold or not. This is the reason why I have added a negative hspace
in front of it. However,
(a) this quiet dirty. Isn't there a (la)tex macro that eliminates the additional space? and
(b) it is impossible to find the correct space that needs to be subtracted, because it is different for different bibtex
entries (sometimes this automatically inserted space is larger, sometimes it is smaller)
There is still an issue with the last answer by adn: The sub macros that use the Strings in boldname{Goossens}{Michel}{M.}
only search for these strings (i.e., "Goossens", "Michel", and "M.") independently of each other. That is: any occurrence of "M." will be bold, no matter whether it belongs to a different author (like "M." for "Martin"). Improving the search scripts to only make the respective names bold if they are detected in a sequence would solve this behavior. In its current form, its usefulness is quite limited given there are more than just a couple of references.
Here a MWE that shows the problem:
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
begin{filecontents}{jobname.bib}
@InProceedings{identifier1,
Title = {Some Awesome Title},
Author = {Some Author and Another Author},
Booktitle = {Some Book about the Future},
Year = {2042},
Pages = {1--42}
}
@InProceedings{identifier2,
Title = {Some So-So Title},
Author = {First Author and Second Author},
Booktitle = {An okay Booktitle},
Year = {2000},
Pages = {1--100}
}
end{filecontents}
addbibresource{jobname.bib}
defmakenamesetup{%
defbibnamedelima{~}%
defbibnamedelimb{ }%
defbibnamedelimc{ }%
defbibnamedelimd{ }%
defbibnamedelimi{ }%
defbibinitperiod{.}%
defbibinitdelim{~}%
defbibinithyphendelim{.-}}
newcommand*{makename}[2]{begingroupmakenamesetupxdef#1{#2}endgroup}
newcommand*{boldname}[3]{%
deflastname{#1}%
deffirstname{#2}%
deffirstinit{#3}}
boldname{}{}{}
% Patch new definitions
renewcommand{mkbibnamegiven}[1]{%
makename{currname}{#1}%
makename{findname}{firstname}%
makename{findinit}{firstinit}%
ifboolexpr{ test {ifdefequal{currname}{findname}}%
or test {ifdefequal{currname}{findinit}} }%
{mkbibbold{#1}}{#1}%
}
renewcommand{mkbibnamefamily}[1]{%
makename{currname}{#1}%
makename{findname}{lastname}%
ifboolexpr{ test {ifdefequal{currname}{findname}} }%
{mkbibbold{#1}}{#1}%
}
boldname{Author}{Some}{S.}
begin{document}
nocite{*}
printbibliography
end{document}
It produces the following PDF, in which:
(a) all occurrences of "S." are bold, although one stands for "Second", which does not belong to the name "Some Author" and
(b) all occurrences of "Author" are bold (i.e., all four authors!), although just one matches the desired author "Some Author"
I hence propose another solution, which does solve this problem (however, there are other problems with it - and I would be glad if someone would present a solution for it). The solution was mentioned in Make one author's name bold every time it shows up in the bibliography (this link is also given in the very first post here one that page). However, (a) it does work with biblatex
, although jlconlin says that it only works with bibtex
and (b) I have extended it a bit to provide some further functionalities that you would not get without it (but that are provided by the previous answer, given by adn).
That solution simply uses a macro in the bibtex
files instead of the actual authors' names. Then, the textbf{}
macro does work, while the document would not compile if textbf{}
would be inserted directly in the .bib file.
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
usepackage{filecontents}
begin{filecontents}{jobname.bib}
@InProceedings{identifier1,
Title = {Some Awesome Title},
Author = {MyName[someKey]{S. Author} and Another Author},
Booktitle = {Some Book about the Future},
Year = {2042},
Pages = {1--42}
}
@InProceedings{identifier2,
Title = {Some So-So Title},
Author = {First Author and Second Author},
Booktitle = {An okay Booktitle},
Year = {2000},
Pages = {1--100}
}
end{filecontents}
addbibresource{jobname.bib}
begin{document}
newcommand{MyName}[2][empty]{ % empty is default for the opt. argument
ifthenelse{equal{#1}{empty}} % test the opt. argument
{hspace*{-.75mm}#2} % it's empty! just show mand. argument
{hspace*{-.75mm}textbf{#2}} % it's not empty! make mand. argument (the name) bold
}
nocite{*}
printbibliography
end{document}
It produces the following PDF:
As can be seen: the problem is solved, as exactly those authors are shown bold that use the macro. To be more precise: the is now an optional argument, which can be instantiated by any String of the user's choice. This "key" can be used in the definition of MyName
to define more specific behavior. For instance, I use biblatex
to use keywords (given in an extra keywords fields - not given here) in order to give several reference sections, divided by the keywords. If making an author's name bold should depend on that keyword (which is the case for me), that logic can be put into the if-then statement. (In my example, the name in the MyName
macro is shown bold if there is any keyword given and non-bold, otherwise. This can be extended -- obviously -- to match any specific key.
It is important to know that this solution does not support to abbreviate the authors' names given in the macro. You will see that I passed "S. Author" to MyName
instead of "Some Author", because latex/bibtex cannot produce "S. Author" from it. However, this does not make this solution any less practical, I think.
Its problem: All names which are put into the MyName
macro appear more to the right than without using the macro. That is, there is a space of approx. 2mm on the left of any such name. This occurs independently of the matching if case, i.e., no matter whether it is bold or not. This is the reason why I have added a negative hspace
in front of it. However,
(a) this quiet dirty. Isn't there a (la)tex macro that eliminates the additional space? and
(b) it is impossible to find the correct space that needs to be subtracted, because it is different for different bibtex
entries (sometimes this automatically inserted space is larger, sometimes it is smaller)
edited Apr 13 '17 at 12:36
Community♦
1
1
answered Oct 16 '16 at 11:17
Prof.ChaosProf.Chaos
286210
286210
1
Check the updated answer. Your approach is also a solution. But I wanted something that does not involve updating the bib files.
– adn
Nov 23 '16 at 17:36
add a comment |
1
Check the updated answer. Your approach is also a solution. But I wanted something that does not involve updating the bib files.
– adn
Nov 23 '16 at 17:36
1
1
Check the updated answer. Your approach is also a solution. But I wanted something that does not involve updating the bib files.
– adn
Nov 23 '16 at 17:36
Check the updated answer. Your approach is also a solution. But I wanted something that does not involve updating the bib files.
– adn
Nov 23 '16 at 17:36
add a comment |
This is more or less a copy of my answer to Highlight an author in bibliography using biblatex allowing bibliography style to format it.
The following implements Audrey's solution for name hashes. The advantage of using hashes is that you only have to give one version of the name, all normalisation will be performed by Biber. The great disadvantage of hashes is that they are not easy to handle for humans. biblatex
can't create the hashes on the fly, so that they need to be looked up in the .bbl
file. The following solution automates hash lookup from the .bbl
, so that you can use it more easily.
The solution works by writing all names you want in bold to a separate .bib
file called (jobname -boldnames.bib
Warning That file will be overwritten without warning. In the unlikely event you already have a file of that name, you can rename the file by changing hlblx@bibfile@name
.). The hash can then be extracted using a dummy cite command.
Usage is very simple. Use addboldnames
to add a list of names to be highlighted. addboldnames
accepts a comma-separated list of names in the same format as you would write them to the .bib
file. If a name contains a comma, the entire name must be wrapped in curly braces.
addboldnames{{Silva, Carlos F. M.},{Silva, Jr., José Mairton B.}}
or
addboldnames{Emma Sigfridsson}
addboldnames
can be used in the preamble and the document body.
To reset the list of names to be highlighted, use resetboldnames
.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[backend=biber,style=numeric]{biblatex}
addbibresource{biblatex-examples.bib}
usepackage{xpatch}
makeatletter
defhlblx@bibfile@name{jobname -boldnames.bib}
newwritehlblx@bibfile
immediateopenouthlblx@bibfile=hlblx@bibfile@name
newcounter{hlblx@name}
setcounter{hlblx@name}{0}
newcommand*{hlblx@writenametobib}[1]{%
stepcounter{hlblx@name}%
edefhlblx@tmp@nocite{%
noexpandAfterPreamble{%
noexpandsetbox0noexpandvbox{%
noexpandhlblx@getmethehash{hlblx@name@thevalue{hlblx@name}}}}%
}%
hlblx@tmp@nocite
immediatewritehlblx@bibfile{%
@misc{hlblx@name@thevalue{hlblx@name}, author = {unexpanded{#1}}, %
options = {dataonly=true},}%
}%
}
AtEndDocument{%
closeouthlblx@bibfile}
addbibresource{hlblx@bibfile@name}
newcommand*{hlbxl@boldhashes}{}
DeclareNameFormat{hlblx@hashextract}{%
xifinlist{thefield{hash}}{hlbxl@boldhashes}
{}
{listxadd{hlbxl@boldhashes}{thefield{fullhash}}}}
DeclareCiteCommand{hlblx@getmethehash}
{}
{printnames[hlblx@hashextract][1-999]{author}}
{}
{}
newcommand*{addboldnames}{forcsvlisthlblx@writenametobib}
newcommand*{resetboldnames}{defhlbxl@boldhashes{}}
newbibmacro*{name:bold}{%
defdo##1{iffieldequalstr{hash}{##1}{bfserieslistbreak}{}}%
dolistloop{hlbxl@boldhashes}%
}
makeatother
xpretobibmacro{name:family}{begingroupusebibmacro{name:bold}}{}{}
xpretobibmacro{name:given-family}{begingroupusebibmacro{name:bold}}{}{}
xpretobibmacro{name:family-given}{begingroupusebibmacro{name:bold}}{}{}
xpretobibmacro{name:delim}{begingroupnormalfont}{}{}
xapptobibmacro{name:family}{endgroup}{}{}
xapptobibmacro{name:given-family}{endgroup}{}{}
xapptobibmacro{name:family-given}{endgroup}{}{}
xapptobibmacro{name:delim}{endgroup}{}{}
addboldnames{{Sigfridsson, Emma},{Vizedom, Monika B.}}
begin{document}
fullcite{sigfridsson}
fullcite{knuth:ct:a}
fullcite{vizedom:related}
resetboldnamesaddboldnames{Donald E. Knuth}
fullcite{knuth:ct:a}
resetboldnamesaddboldnames{Philipp Jaff{'e}}
fullcite{jaffe}
end{document}
What about name variants such as D. E. Knuth and Donald E. Knuth?
– jlconlin
Feb 21 '18 at 10:18
@jlconlin Of course that does not work. As far as Biber/biblatex
are concerned these two are different people. How would they know differently?
– moewe
Feb 21 '18 at 10:20
add a comment |
This is more or less a copy of my answer to Highlight an author in bibliography using biblatex allowing bibliography style to format it.
The following implements Audrey's solution for name hashes. The advantage of using hashes is that you only have to give one version of the name, all normalisation will be performed by Biber. The great disadvantage of hashes is that they are not easy to handle for humans. biblatex
can't create the hashes on the fly, so that they need to be looked up in the .bbl
file. The following solution automates hash lookup from the .bbl
, so that you can use it more easily.
The solution works by writing all names you want in bold to a separate .bib
file called (jobname -boldnames.bib
Warning That file will be overwritten without warning. In the unlikely event you already have a file of that name, you can rename the file by changing hlblx@bibfile@name
.). The hash can then be extracted using a dummy cite command.
Usage is very simple. Use addboldnames
to add a list of names to be highlighted. addboldnames
accepts a comma-separated list of names in the same format as you would write them to the .bib
file. If a name contains a comma, the entire name must be wrapped in curly braces.
addboldnames{{Silva, Carlos F. M.},{Silva, Jr., José Mairton B.}}
or
addboldnames{Emma Sigfridsson}
addboldnames
can be used in the preamble and the document body.
To reset the list of names to be highlighted, use resetboldnames
.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[backend=biber,style=numeric]{biblatex}
addbibresource{biblatex-examples.bib}
usepackage{xpatch}
makeatletter
defhlblx@bibfile@name{jobname -boldnames.bib}
newwritehlblx@bibfile
immediateopenouthlblx@bibfile=hlblx@bibfile@name
newcounter{hlblx@name}
setcounter{hlblx@name}{0}
newcommand*{hlblx@writenametobib}[1]{%
stepcounter{hlblx@name}%
edefhlblx@tmp@nocite{%
noexpandAfterPreamble{%
noexpandsetbox0noexpandvbox{%
noexpandhlblx@getmethehash{hlblx@name@thevalue{hlblx@name}}}}%
}%
hlblx@tmp@nocite
immediatewritehlblx@bibfile{%
@misc{hlblx@name@thevalue{hlblx@name}, author = {unexpanded{#1}}, %
options = {dataonly=true},}%
}%
}
AtEndDocument{%
closeouthlblx@bibfile}
addbibresource{hlblx@bibfile@name}
newcommand*{hlbxl@boldhashes}{}
DeclareNameFormat{hlblx@hashextract}{%
xifinlist{thefield{hash}}{hlbxl@boldhashes}
{}
{listxadd{hlbxl@boldhashes}{thefield{fullhash}}}}
DeclareCiteCommand{hlblx@getmethehash}
{}
{printnames[hlblx@hashextract][1-999]{author}}
{}
{}
newcommand*{addboldnames}{forcsvlisthlblx@writenametobib}
newcommand*{resetboldnames}{defhlbxl@boldhashes{}}
newbibmacro*{name:bold}{%
defdo##1{iffieldequalstr{hash}{##1}{bfserieslistbreak}{}}%
dolistloop{hlbxl@boldhashes}%
}
makeatother
xpretobibmacro{name:family}{begingroupusebibmacro{name:bold}}{}{}
xpretobibmacro{name:given-family}{begingroupusebibmacro{name:bold}}{}{}
xpretobibmacro{name:family-given}{begingroupusebibmacro{name:bold}}{}{}
xpretobibmacro{name:delim}{begingroupnormalfont}{}{}
xapptobibmacro{name:family}{endgroup}{}{}
xapptobibmacro{name:given-family}{endgroup}{}{}
xapptobibmacro{name:family-given}{endgroup}{}{}
xapptobibmacro{name:delim}{endgroup}{}{}
addboldnames{{Sigfridsson, Emma},{Vizedom, Monika B.}}
begin{document}
fullcite{sigfridsson}
fullcite{knuth:ct:a}
fullcite{vizedom:related}
resetboldnamesaddboldnames{Donald E. Knuth}
fullcite{knuth:ct:a}
resetboldnamesaddboldnames{Philipp Jaff{'e}}
fullcite{jaffe}
end{document}
What about name variants such as D. E. Knuth and Donald E. Knuth?
– jlconlin
Feb 21 '18 at 10:18
@jlconlin Of course that does not work. As far as Biber/biblatex
are concerned these two are different people. How would they know differently?
– moewe
Feb 21 '18 at 10:20
add a comment |
This is more or less a copy of my answer to Highlight an author in bibliography using biblatex allowing bibliography style to format it.
The following implements Audrey's solution for name hashes. The advantage of using hashes is that you only have to give one version of the name, all normalisation will be performed by Biber. The great disadvantage of hashes is that they are not easy to handle for humans. biblatex
can't create the hashes on the fly, so that they need to be looked up in the .bbl
file. The following solution automates hash lookup from the .bbl
, so that you can use it more easily.
The solution works by writing all names you want in bold to a separate .bib
file called (jobname -boldnames.bib
Warning That file will be overwritten without warning. In the unlikely event you already have a file of that name, you can rename the file by changing hlblx@bibfile@name
.). The hash can then be extracted using a dummy cite command.
Usage is very simple. Use addboldnames
to add a list of names to be highlighted. addboldnames
accepts a comma-separated list of names in the same format as you would write them to the .bib
file. If a name contains a comma, the entire name must be wrapped in curly braces.
addboldnames{{Silva, Carlos F. M.},{Silva, Jr., José Mairton B.}}
or
addboldnames{Emma Sigfridsson}
addboldnames
can be used in the preamble and the document body.
To reset the list of names to be highlighted, use resetboldnames
.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[backend=biber,style=numeric]{biblatex}
addbibresource{biblatex-examples.bib}
usepackage{xpatch}
makeatletter
defhlblx@bibfile@name{jobname -boldnames.bib}
newwritehlblx@bibfile
immediateopenouthlblx@bibfile=hlblx@bibfile@name
newcounter{hlblx@name}
setcounter{hlblx@name}{0}
newcommand*{hlblx@writenametobib}[1]{%
stepcounter{hlblx@name}%
edefhlblx@tmp@nocite{%
noexpandAfterPreamble{%
noexpandsetbox0noexpandvbox{%
noexpandhlblx@getmethehash{hlblx@name@thevalue{hlblx@name}}}}%
}%
hlblx@tmp@nocite
immediatewritehlblx@bibfile{%
@misc{hlblx@name@thevalue{hlblx@name}, author = {unexpanded{#1}}, %
options = {dataonly=true},}%
}%
}
AtEndDocument{%
closeouthlblx@bibfile}
addbibresource{hlblx@bibfile@name}
newcommand*{hlbxl@boldhashes}{}
DeclareNameFormat{hlblx@hashextract}{%
xifinlist{thefield{hash}}{hlbxl@boldhashes}
{}
{listxadd{hlbxl@boldhashes}{thefield{fullhash}}}}
DeclareCiteCommand{hlblx@getmethehash}
{}
{printnames[hlblx@hashextract][1-999]{author}}
{}
{}
newcommand*{addboldnames}{forcsvlisthlblx@writenametobib}
newcommand*{resetboldnames}{defhlbxl@boldhashes{}}
newbibmacro*{name:bold}{%
defdo##1{iffieldequalstr{hash}{##1}{bfserieslistbreak}{}}%
dolistloop{hlbxl@boldhashes}%
}
makeatother
xpretobibmacro{name:family}{begingroupusebibmacro{name:bold}}{}{}
xpretobibmacro{name:given-family}{begingroupusebibmacro{name:bold}}{}{}
xpretobibmacro{name:family-given}{begingroupusebibmacro{name:bold}}{}{}
xpretobibmacro{name:delim}{begingroupnormalfont}{}{}
xapptobibmacro{name:family}{endgroup}{}{}
xapptobibmacro{name:given-family}{endgroup}{}{}
xapptobibmacro{name:family-given}{endgroup}{}{}
xapptobibmacro{name:delim}{endgroup}{}{}
addboldnames{{Sigfridsson, Emma},{Vizedom, Monika B.}}
begin{document}
fullcite{sigfridsson}
fullcite{knuth:ct:a}
fullcite{vizedom:related}
resetboldnamesaddboldnames{Donald E. Knuth}
fullcite{knuth:ct:a}
resetboldnamesaddboldnames{Philipp Jaff{'e}}
fullcite{jaffe}
end{document}
This is more or less a copy of my answer to Highlight an author in bibliography using biblatex allowing bibliography style to format it.
The following implements Audrey's solution for name hashes. The advantage of using hashes is that you only have to give one version of the name, all normalisation will be performed by Biber. The great disadvantage of hashes is that they are not easy to handle for humans. biblatex
can't create the hashes on the fly, so that they need to be looked up in the .bbl
file. The following solution automates hash lookup from the .bbl
, so that you can use it more easily.
The solution works by writing all names you want in bold to a separate .bib
file called (jobname -boldnames.bib
Warning That file will be overwritten without warning. In the unlikely event you already have a file of that name, you can rename the file by changing hlblx@bibfile@name
.). The hash can then be extracted using a dummy cite command.
Usage is very simple. Use addboldnames
to add a list of names to be highlighted. addboldnames
accepts a comma-separated list of names in the same format as you would write them to the .bib
file. If a name contains a comma, the entire name must be wrapped in curly braces.
addboldnames{{Silva, Carlos F. M.},{Silva, Jr., José Mairton B.}}
or
addboldnames{Emma Sigfridsson}
addboldnames
can be used in the preamble and the document body.
To reset the list of names to be highlighted, use resetboldnames
.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[backend=biber,style=numeric]{biblatex}
addbibresource{biblatex-examples.bib}
usepackage{xpatch}
makeatletter
defhlblx@bibfile@name{jobname -boldnames.bib}
newwritehlblx@bibfile
immediateopenouthlblx@bibfile=hlblx@bibfile@name
newcounter{hlblx@name}
setcounter{hlblx@name}{0}
newcommand*{hlblx@writenametobib}[1]{%
stepcounter{hlblx@name}%
edefhlblx@tmp@nocite{%
noexpandAfterPreamble{%
noexpandsetbox0noexpandvbox{%
noexpandhlblx@getmethehash{hlblx@name@thevalue{hlblx@name}}}}%
}%
hlblx@tmp@nocite
immediatewritehlblx@bibfile{%
@misc{hlblx@name@thevalue{hlblx@name}, author = {unexpanded{#1}}, %
options = {dataonly=true},}%
}%
}
AtEndDocument{%
closeouthlblx@bibfile}
addbibresource{hlblx@bibfile@name}
newcommand*{hlbxl@boldhashes}{}
DeclareNameFormat{hlblx@hashextract}{%
xifinlist{thefield{hash}}{hlbxl@boldhashes}
{}
{listxadd{hlbxl@boldhashes}{thefield{fullhash}}}}
DeclareCiteCommand{hlblx@getmethehash}
{}
{printnames[hlblx@hashextract][1-999]{author}}
{}
{}
newcommand*{addboldnames}{forcsvlisthlblx@writenametobib}
newcommand*{resetboldnames}{defhlbxl@boldhashes{}}
newbibmacro*{name:bold}{%
defdo##1{iffieldequalstr{hash}{##1}{bfserieslistbreak}{}}%
dolistloop{hlbxl@boldhashes}%
}
makeatother
xpretobibmacro{name:family}{begingroupusebibmacro{name:bold}}{}{}
xpretobibmacro{name:given-family}{begingroupusebibmacro{name:bold}}{}{}
xpretobibmacro{name:family-given}{begingroupusebibmacro{name:bold}}{}{}
xpretobibmacro{name:delim}{begingroupnormalfont}{}{}
xapptobibmacro{name:family}{endgroup}{}{}
xapptobibmacro{name:given-family}{endgroup}{}{}
xapptobibmacro{name:family-given}{endgroup}{}{}
xapptobibmacro{name:delim}{endgroup}{}{}
addboldnames{{Sigfridsson, Emma},{Vizedom, Monika B.}}
begin{document}
fullcite{sigfridsson}
fullcite{knuth:ct:a}
fullcite{vizedom:related}
resetboldnamesaddboldnames{Donald E. Knuth}
fullcite{knuth:ct:a}
resetboldnamesaddboldnames{Philipp Jaff{'e}}
fullcite{jaffe}
end{document}
edited 54 secs ago
answered Feb 21 '18 at 10:15
moewemoewe
94k10115354
94k10115354
What about name variants such as D. E. Knuth and Donald E. Knuth?
– jlconlin
Feb 21 '18 at 10:18
@jlconlin Of course that does not work. As far as Biber/biblatex
are concerned these two are different people. How would they know differently?
– moewe
Feb 21 '18 at 10:20
add a comment |
What about name variants such as D. E. Knuth and Donald E. Knuth?
– jlconlin
Feb 21 '18 at 10:18
@jlconlin Of course that does not work. As far as Biber/biblatex
are concerned these two are different people. How would they know differently?
– moewe
Feb 21 '18 at 10:20
What about name variants such as D. E. Knuth and Donald E. Knuth?
– jlconlin
Feb 21 '18 at 10:18
What about name variants such as D. E. Knuth and Donald E. Knuth?
– jlconlin
Feb 21 '18 at 10:18
@jlconlin Of course that does not work. As far as Biber/
biblatex
are concerned these two are different people. How would they know differently?– moewe
Feb 21 '18 at 10:20
@jlconlin Of course that does not work. As far as Biber/
biblatex
are concerned these two are different people. How would they know differently?– moewe
Feb 21 '18 at 10:20
add a comment |
Combining solution by adn, and suggestion by Audrey to use the "hash" field generated by biber, this works (texlive 2017.20170818-1):
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
addbibresource{biblatex-examples.bib}
% Run biber once, find the hash you want in the generated .bbl file
% (here, M. Goossens) and paste here:
edefauthorhash{detokenize{0743efb276e9219ee664a9b3dbd60619}}
renewcommand{mkbibnamegiven}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
renewcommand{mkbibnamefamily}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
renewcommand{mkbibnameprefix}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
renewcommand{mkbibnamesuffix}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
begin{document}
nocite{companion}
printbibliography
end{document}
Edit: Following moewe's good advices, fixes and verifications (thanks !) :
- switched to using the distrib’s .bib sample
- added support to prefix/suffix parts of the names
- used a macro to avoid copy-pasting hash 4 times
Patching name:
as suggested by Audrey would indeed be more efficient but apparently it does not work anymore for some reason (see comment Make specific author bold using biblatex).
1
Welcome to TeX.SX! You could make your answer more useful if you usedbiblatex-examples
, a file that is automatically available ifbiblatex
is installed, instead ofmybiblio.bib
, which we don't have. You can avoid having to paste the hash twice if you save it in a macro. Note also that if the name has a suffix or prefix that will not be printed in bold with your solution.
– moewe
Feb 8 '18 at 15:07
edefboldname{detokenize{0743efb276e9219ee664a9b3dbd60619}} renewcommand{mkbibnamegiven}[1]{% iffieldequals{hash}{boldname}{mkbibbold{#1}}{#1}% } renewcommand{mkbibnamefamily}[1]{% iffieldequals{hash}{boldname}{mkbibbold{#1}}{#1}% }
(modulo line breaks) works for me. The hashes are detokenized so we need to do the same.mkbibnamesuffix
andmkbibnameprefix
should work, not sure how you added the fields by hand. The great advantage of Audrey's patching thename:
macros instead ofmkbibname...
is that the entire name is processed in one go ...
– moewe
Feb 8 '18 at 20:16
... and not each name part separately.
– moewe
Feb 8 '18 at 20:16
Patchingname:
does still work, but you have to replacelast
byfamily
andfirst
bygiven
. There were some change in name handling in version 3.3, see tex.stackexchange.com/q/299036/35864
– moewe
Feb 9 '18 at 15:24
See tex.stackexchange.com/q/274436/35864 for a full solution withhashes
that works.
– moewe
Feb 9 '18 at 15:25
|
show 1 more comment
Combining solution by adn, and suggestion by Audrey to use the "hash" field generated by biber, this works (texlive 2017.20170818-1):
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
addbibresource{biblatex-examples.bib}
% Run biber once, find the hash you want in the generated .bbl file
% (here, M. Goossens) and paste here:
edefauthorhash{detokenize{0743efb276e9219ee664a9b3dbd60619}}
renewcommand{mkbibnamegiven}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
renewcommand{mkbibnamefamily}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
renewcommand{mkbibnameprefix}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
renewcommand{mkbibnamesuffix}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
begin{document}
nocite{companion}
printbibliography
end{document}
Edit: Following moewe's good advices, fixes and verifications (thanks !) :
- switched to using the distrib’s .bib sample
- added support to prefix/suffix parts of the names
- used a macro to avoid copy-pasting hash 4 times
Patching name:
as suggested by Audrey would indeed be more efficient but apparently it does not work anymore for some reason (see comment Make specific author bold using biblatex).
1
Welcome to TeX.SX! You could make your answer more useful if you usedbiblatex-examples
, a file that is automatically available ifbiblatex
is installed, instead ofmybiblio.bib
, which we don't have. You can avoid having to paste the hash twice if you save it in a macro. Note also that if the name has a suffix or prefix that will not be printed in bold with your solution.
– moewe
Feb 8 '18 at 15:07
edefboldname{detokenize{0743efb276e9219ee664a9b3dbd60619}} renewcommand{mkbibnamegiven}[1]{% iffieldequals{hash}{boldname}{mkbibbold{#1}}{#1}% } renewcommand{mkbibnamefamily}[1]{% iffieldequals{hash}{boldname}{mkbibbold{#1}}{#1}% }
(modulo line breaks) works for me. The hashes are detokenized so we need to do the same.mkbibnamesuffix
andmkbibnameprefix
should work, not sure how you added the fields by hand. The great advantage of Audrey's patching thename:
macros instead ofmkbibname...
is that the entire name is processed in one go ...
– moewe
Feb 8 '18 at 20:16
... and not each name part separately.
– moewe
Feb 8 '18 at 20:16
Patchingname:
does still work, but you have to replacelast
byfamily
andfirst
bygiven
. There were some change in name handling in version 3.3, see tex.stackexchange.com/q/299036/35864
– moewe
Feb 9 '18 at 15:24
See tex.stackexchange.com/q/274436/35864 for a full solution withhashes
that works.
– moewe
Feb 9 '18 at 15:25
|
show 1 more comment
Combining solution by adn, and suggestion by Audrey to use the "hash" field generated by biber, this works (texlive 2017.20170818-1):
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
addbibresource{biblatex-examples.bib}
% Run biber once, find the hash you want in the generated .bbl file
% (here, M. Goossens) and paste here:
edefauthorhash{detokenize{0743efb276e9219ee664a9b3dbd60619}}
renewcommand{mkbibnamegiven}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
renewcommand{mkbibnamefamily}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
renewcommand{mkbibnameprefix}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
renewcommand{mkbibnamesuffix}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
begin{document}
nocite{companion}
printbibliography
end{document}
Edit: Following moewe's good advices, fixes and verifications (thanks !) :
- switched to using the distrib’s .bib sample
- added support to prefix/suffix parts of the names
- used a macro to avoid copy-pasting hash 4 times
Patching name:
as suggested by Audrey would indeed be more efficient but apparently it does not work anymore for some reason (see comment Make specific author bold using biblatex).
Combining solution by adn, and suggestion by Audrey to use the "hash" field generated by biber, this works (texlive 2017.20170818-1):
documentclass{article}
usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}
addbibresource{biblatex-examples.bib}
% Run biber once, find the hash you want in the generated .bbl file
% (here, M. Goossens) and paste here:
edefauthorhash{detokenize{0743efb276e9219ee664a9b3dbd60619}}
renewcommand{mkbibnamegiven}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
renewcommand{mkbibnamefamily}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
renewcommand{mkbibnameprefix}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
renewcommand{mkbibnamesuffix}[1]{%
iffieldequals{hash}{authorhash}{mkbibbold{#1}}{#1}}
begin{document}
nocite{companion}
printbibliography
end{document}
Edit: Following moewe's good advices, fixes and verifications (thanks !) :
- switched to using the distrib’s .bib sample
- added support to prefix/suffix parts of the names
- used a macro to avoid copy-pasting hash 4 times
Patching name:
as suggested by Audrey would indeed be more efficient but apparently it does not work anymore for some reason (see comment Make specific author bold using biblatex).
edited Feb 9 '18 at 15:13
answered Feb 8 '18 at 14:33
fmeynafmeyna
113
113
1
Welcome to TeX.SX! You could make your answer more useful if you usedbiblatex-examples
, a file that is automatically available ifbiblatex
is installed, instead ofmybiblio.bib
, which we don't have. You can avoid having to paste the hash twice if you save it in a macro. Note also that if the name has a suffix or prefix that will not be printed in bold with your solution.
– moewe
Feb 8 '18 at 15:07
edefboldname{detokenize{0743efb276e9219ee664a9b3dbd60619}} renewcommand{mkbibnamegiven}[1]{% iffieldequals{hash}{boldname}{mkbibbold{#1}}{#1}% } renewcommand{mkbibnamefamily}[1]{% iffieldequals{hash}{boldname}{mkbibbold{#1}}{#1}% }
(modulo line breaks) works for me. The hashes are detokenized so we need to do the same.mkbibnamesuffix
andmkbibnameprefix
should work, not sure how you added the fields by hand. The great advantage of Audrey's patching thename:
macros instead ofmkbibname...
is that the entire name is processed in one go ...
– moewe
Feb 8 '18 at 20:16
... and not each name part separately.
– moewe
Feb 8 '18 at 20:16
Patchingname:
does still work, but you have to replacelast
byfamily
andfirst
bygiven
. There were some change in name handling in version 3.3, see tex.stackexchange.com/q/299036/35864
– moewe
Feb 9 '18 at 15:24
See tex.stackexchange.com/q/274436/35864 for a full solution withhashes
that works.
– moewe
Feb 9 '18 at 15:25
|
show 1 more comment
1
Welcome to TeX.SX! You could make your answer more useful if you usedbiblatex-examples
, a file that is automatically available ifbiblatex
is installed, instead ofmybiblio.bib
, which we don't have. You can avoid having to paste the hash twice if you save it in a macro. Note also that if the name has a suffix or prefix that will not be printed in bold with your solution.
– moewe
Feb 8 '18 at 15:07
edefboldname{detokenize{0743efb276e9219ee664a9b3dbd60619}} renewcommand{mkbibnamegiven}[1]{% iffieldequals{hash}{boldname}{mkbibbold{#1}}{#1}% } renewcommand{mkbibnamefamily}[1]{% iffieldequals{hash}{boldname}{mkbibbold{#1}}{#1}% }
(modulo line breaks) works for me. The hashes are detokenized so we need to do the same.mkbibnamesuffix
andmkbibnameprefix
should work, not sure how you added the fields by hand. The great advantage of Audrey's patching thename:
macros instead ofmkbibname...
is that the entire name is processed in one go ...
– moewe
Feb 8 '18 at 20:16
... and not each name part separately.
– moewe
Feb 8 '18 at 20:16
Patchingname:
does still work, but you have to replacelast
byfamily
andfirst
bygiven
. There were some change in name handling in version 3.3, see tex.stackexchange.com/q/299036/35864
– moewe
Feb 9 '18 at 15:24
See tex.stackexchange.com/q/274436/35864 for a full solution withhashes
that works.
– moewe
Feb 9 '18 at 15:25
1
1
Welcome to TeX.SX! You could make your answer more useful if you used
biblatex-examples
, a file that is automatically available if biblatex
is installed, instead of mybiblio.bib
, which we don't have. You can avoid having to paste the hash twice if you save it in a macro. Note also that if the name has a suffix or prefix that will not be printed in bold with your solution.– moewe
Feb 8 '18 at 15:07
Welcome to TeX.SX! You could make your answer more useful if you used
biblatex-examples
, a file that is automatically available if biblatex
is installed, instead of mybiblio.bib
, which we don't have. You can avoid having to paste the hash twice if you save it in a macro. Note also that if the name has a suffix or prefix that will not be printed in bold with your solution.– moewe
Feb 8 '18 at 15:07
edefboldname{detokenize{0743efb276e9219ee664a9b3dbd60619}} renewcommand{mkbibnamegiven}[1]{% iffieldequals{hash}{boldname}{mkbibbold{#1}}{#1}% } renewcommand{mkbibnamefamily}[1]{% iffieldequals{hash}{boldname}{mkbibbold{#1}}{#1}% }
(modulo line breaks) works for me. The hashes are detokenized so we need to do the same. mkbibnamesuffix
and mkbibnameprefix
should work, not sure how you added the fields by hand. The great advantage of Audrey's patching the name:
macros instead of mkbibname...
is that the entire name is processed in one go ...– moewe
Feb 8 '18 at 20:16
edefboldname{detokenize{0743efb276e9219ee664a9b3dbd60619}} renewcommand{mkbibnamegiven}[1]{% iffieldequals{hash}{boldname}{mkbibbold{#1}}{#1}% } renewcommand{mkbibnamefamily}[1]{% iffieldequals{hash}{boldname}{mkbibbold{#1}}{#1}% }
(modulo line breaks) works for me. The hashes are detokenized so we need to do the same. mkbibnamesuffix
and mkbibnameprefix
should work, not sure how you added the fields by hand. The great advantage of Audrey's patching the name:
macros instead of mkbibname...
is that the entire name is processed in one go ...– moewe
Feb 8 '18 at 20:16
... and not each name part separately.
– moewe
Feb 8 '18 at 20:16
... and not each name part separately.
– moewe
Feb 8 '18 at 20:16
Patching
name:
does still work, but you have to replace last
by family
and first
by given
. There were some change in name handling in version 3.3, see tex.stackexchange.com/q/299036/35864– moewe
Feb 9 '18 at 15:24
Patching
name:
does still work, but you have to replace last
by family
and first
by given
. There were some change in name handling in version 3.3, see tex.stackexchange.com/q/299036/35864– moewe
Feb 9 '18 at 15:24
See tex.stackexchange.com/q/274436/35864 for a full solution with
hashes
that works.– moewe
Feb 9 '18 at 15:25
See tex.stackexchange.com/q/274436/35864 for a full solution with
hashes
that works.– moewe
Feb 9 '18 at 15:25
|
show 1 more comment
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f73136%2fmake-specific-author-bold-using-biblatex%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
See: tex.stackexchange.com/questions/44200/… -- Of course this only one suggestion. You can also use
DeclareSourcemap
-- see for example here: tex.stackexchange.com/questions/62779/…– Marco Daniel
Sep 19 '12 at 5:09
2
For my own CV, I use
mkbibbold
. So the author field looks like this:author={A. Lastname, mkbibbold{Your name}, A. Lastname}
You should use biber though.– rowman
Sep 19 '12 at 19:10
The solution presented by @rowman wokrs great for me! Thanks!
– J_F
Apr 18 '18 at 12:11
I was using the solutions provided here, that worked for biblatex < 3.3, Now none of the solutions provided here works now (biblatex 3.11). The full code of my version is in a different thread: tex.stackexchange.com/questions/187181/…
– Matthias Pospiech
Sep 12 '18 at 19:49