2

I just want to remove hyperlink for textcite. This a MWE from this question:

\documentclass{report}
\usepackage[style=authoryear]{biblatex}
\usepackage{hyperref}

% Just for demo
\ExecuteBibliographyOptions{maxcitenames=1}

\DeclareFieldFormat{citehyperref}{%
  \DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
  \bibhyperref{#1}}

\DeclareFieldFormat{textcitehyperref}{%
  \DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
  \bibhyperref{%
    #1%
    \ifbool{cbx:parens}
      {\bibcloseparen\global\boolfalse{cbx:parens}}
      {}}}

\savebibmacro{cite}
\savebibmacro{textcite}

\renewbibmacro*{cite}{%
  \printtext[citehyperref]{%
    \restorebibmacro{cite}%
    \usebibmacro{cite}}}

\renewbibmacro*{textcite}{%
  \ifboolexpr{
    ( not test {\iffieldundef{prenote}} and
      test {\ifnumequal{\value{citecount}}{1}} )
    or
    ( not test {\iffieldundef{postnote}} and
      test {\ifnumequal{\value{citecount}}{\value{citetotal}}} )
  }
    {\DeclareFieldAlias{textcitehyperref}{noformat}}
    {}%
  \printtext[textcitehyperref]{%
    \restorebibmacro{textcite}%
    \usebibmacro{textcite}}}

\renewcommand{\baselinestretch}{1.2}
\setlength{\parskip}{\smallskipamount}
\setlength{\parindent}{0pt}
\addbibresource{biblatex-examples.bib}
\begin{document}
\null\vfill
\textbf{Single citations}

Filler text \parencite{aristotle:poetics}. Filler text \parencite{kant:ku} \\
Filler text \parencite[See][23]{aristotle:poetics}.
Filler text \parencite[1--10]{kant:ku}. \\
\textcite{aristotle:poetics} and \textcite{kant:ku}.
\textcite[e.g.][]{aristotle:poetics} and \textcite[10]{kant:ku}. \\
Filler text.\footcite[23]{aristotle:poetics} Filler text.\footcite[1--10]{aristotle:rhetoric}
Filler text.\footnote{\smartcite[10--15]{companion}}

\textbf{Unqualified citation lists}

\textcite{aristotle:poetics,aristotle:rhetoric} \\
\textcite[e.g.][]{aristotle:poetics,aristotle:rhetoric} \\
\textcite[10--15]{aristotle:poetics,aristotle:rhetoric} \\
\textcite[e.g.][10--15]{aristotle:poetics,aristotle:rhetoric} \\
\parencite[See][for example]{aristotle:poetics,aristotle:rhetoric}

\textbf{Qualified citation lists}

\textcites{aristotle:poetics}{aristotle:rhetoric} \\
\textcites(See)(){aristotle:poetics}[cf.][]{aristotle:rhetoric} \\
\textcites(See)()[10]{aristotle:poetics}[10]{aristotle:rhetoric} \\
\textcites(See)()[10--15]{aristotle:poetics}[cf.][10]{aristotle:rhetoric} \\
\textcites(See)()[e.g.][10--15]{aristotle:poetics}[cf.][10]{aristotle:rhetoric} \\
\parencites(See)()[10--15]{aristotle:poetics}[cf.][10]{aristotle:rhetoric}

\textbf{Mix of qualified and unqualified citation lists}

\textcites(See)()[e.g.][]{aristotle:poetics}[10]{bertram,companion} \\
\textcites[e.g.][]{aristotle:poetics,aristotle:rhetoric}[10]{companion} \\
\textcites[10]{aristotle:poetics,aristotle:rhetoric}[cf.][]{bertram} \\
\textcites[15]{aristotle:poetics}[cf.][10]{bertram,companion}

\printbibliography
\end{document}
7
  • 1
    Actually, this is not a MWE, because biblatex-examples.bib is an external file which we do not have access to. You can use filecontents package within your example. Also, for it to be minimal you only need to have a few \textcite commands in the document (and maybe one or two \parencite etc.).
    – whatisit
    Dec 27, 2018 at 17:42
  • 1
    To clarify: you want to disable hyperlinking for only \textcite? But other linking commands, such as \parencite, \textcites, \parencites, etc. should retain hyperlinks?
    – whatisit
    Dec 27, 2018 at 17:44
  • @whatisit Yes. I just want this for \textcite. Dec 27, 2018 at 17:46
  • 6
    @whatisit biblatex-examples.bib is in every tex system and is a perfect bib for examples (much better than bib entries with filecontents which only add more junk to my test folder). Dec 27, 2018 at 17:47
  • @UlrikeFischer oops, yes you are correct! I actually was unaware and assumed it was a local file.
    – whatisit
    Dec 27, 2018 at 17:50

1 Answer 1

2

A simple solution is to just redefine the bibhyperref field format that usually sets the links locally for textcite. There are several ways to do this (for example with xpatch), but since the MWE already uses the \savebibmacro\restorebibmacro approach we might as well use that.

\documentclass{article}
\usepackage[style=authoryear]{biblatex}
\usepackage{hyperref}

% Just for demo
\ExecuteBibliographyOptions{maxcitenames=1}

\DeclareFieldFormat{citehyperref}{%
  \DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
  \bibhyperref{#1}}

\savebibmacro{cite}
\savebibmacro{textcite}

\renewbibmacro*{cite}{%
  \printtext[citehyperref]{%
    \restorebibmacro{cite}%
    \usebibmacro{cite}}}

\renewbibmacro*{textcite}{%
  \DeclareFieldAlias{bibhyperref}{noformat}% Remove all links
  \restorebibmacro{textcite}%
  \usebibmacro{textcite}}

\addbibresource{biblatex-examples.bib}
\begin{document}
\textcite{sigfridsson}

\cite{sigfridsson}

\printbibliography
\end{document}

Screenshot of the MWE: The citations show "Sigfridsson et al. (1998)" without link and a fully-linked "Sigfridsson et al. 1998"

3
  • @samcarter Thank you very much for the image upload.
    – moewe
    Dec 28, 2018 at 15:32
  • You're welcome! In the last few months there seems to be an increase of problems with image uploads -- it starts to get annoying ... Dec 28, 2018 at 15:45
  • @samcarter I'm pretty sure this is my internet connection, though. Usually it works fine, but I'm away from my flat.
    – moewe
    Dec 28, 2018 at 15:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .