-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstack-natbib.tex
36 lines (30 loc) · 1.06 KB
/
stack-natbib.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
%% \namestack support for natbib.sty
\usepackage{natbib}
\makeatletter
% When formatting the name part of a citation, wrap in \namestack
\def\NAT@nmfmt#1{%
\xdef\textstack@expand{#1}%
\expandafter\namestack\textstack@expand
}
% Remove links from names so that tooltips are visible.
% Code from https://tex.stackexchange.com/a/27311/2451040
\usepackage{etoolbox}
% Patch case where name and year are separated by aysep
\patchcmd{\NAT@citex}
{\@citea\NAT@hyper@{%
\NAT@nmfmt{\NAT@nm}%
\hyper@natlinkbreak{\NAT@aysep\NAT@spacechar}{\@citeb\@extra@b@citeb}%
\NAT@date}}
{\@citea\NAT@nmfmt{\NAT@nm}%
\NAT@aysep\NAT@spacechar\NAT@hyper@{\NAT@date}}{}{}
% Patch case where name and year are separated by opening bracket
\patchcmd{\NAT@citex}
{\@citea\NAT@hyper@{%
\NAT@nmfmt{\NAT@nm}%
\hyper@natlinkbreak{\NAT@spacechar\NAT@@open\if*#1*\else#1\NAT@spacechar\fi}%
{\@citeb\@extra@b@citeb}%
\NAT@date}}
{\@citea\NAT@nmfmt{\NAT@nm}%
\NAT@spacechar\NAT@@open\if*#1*\else#1\NAT@spacechar\fi\NAT@hyper@{\NAT@date}}
{}{}
\makeatother