1

This is a follow-up question (see this question too for another follow-up question).

From the accepted answer, when I try to add note [not sure what the proper terminology is] to the citation (as in \cite[page 0]{mybibitem}), I observe that the note appears twice (see minimal working example below):

\documentclass{beamer}
\usepackage[style=numeric,citecounter=true,citetracker=true]{biblatex} 
\usepackage{filecontents}
\begin{filecontents*}{myreferences.bib}
    @online{bad,
        author = {{Bad Man}},
        year = {1313},
        title = {Bad Title},
        url = {http://badurl.com/},
    }
\end{filecontents*}
\addbibresource{myreferences.bib}

%https://tex.stackexchange.com/a/165016/38244
\hypersetup{
    colorlinks,
    citecolor=red,
    linkcolor=blue,
%   backref=true
}



\usepackage{algorithm}
\PassOptionsToPackage{noend}{algpseudocode}% comment out if want end's to show
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx
\usepackage{algorithmicx}


\let\svthefootnote\thefootnote

\makeatletter
% https://tex.stackexchange.com/a/29931/38244
\DeclareCiteCommand{\cite}
{\usebibmacro{prenote}}%
{%  
    \ifciteseen{}{%
        \usebibmacro{citeindex}%
        \let\thefootnote\relax%
        \footnotetext{%
            \blx@anchor
            \mkbibbrackets{\usebibmacro{cite}}%
            \setunit{\addnbspace}
            \printnames{labelname}%
            \setunit{\labelnamepunct}
            \printfield[citetitle]{title}%
            \newunit%
            \printfield[]{year}%
        }%
        \let\thefootnote\svthefootnote%
    }%
    \autocite{\thefield{entrykey}}%
  }
{\addsemicolon\space}
{\usebibmacro{postnote}}
\makeatother



\begin{document}


\begin{frame}{What I found}
    First time, \cite[page 99]{bad}   
\end{frame}

\begin{frame}{Again}
    Next time, \cite[page 1]{bad} only
\end{frame}



\end{document}

Here are the screen-shots (see the duplication of the notes): page 1 page 2

How can I get rid of the duplication?

1
+50

You should remove the prenote and postnote parts, and perhaps the associated punctation, in your definition of \cite as the \autocite call will take care of these:

Sample output

\documentclass{beamer}
\usepackage[style=numeric,citecounter=true,citetracker=true]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{myreferences.bib}
    @online{bad,
        author = {{Bad Man}},
        year = {1313},
        title = {Bad Title},
        url = {http://badurl.com/},
    }
\end{filecontents*}
\addbibresource{myreferences.bib}

%https://tex.stackexchange.com/a/165016/38244
\hypersetup{
    colorlinks,
    citecolor=red,
    linkcolor=blue,
%   backref=true
}



\usepackage{algorithm}
\PassOptionsToPackage{noend}{algpseudocode}% comment out if want end's to show
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx
\usepackage{algorithmicx}


\let\svthefootnote\thefootnote

\makeatletter
% https://tex.stackexchange.com/a/29931/38244
\DeclareCiteCommand{\cite}
{}%
{%
    \ifciteseen{}{%
        \usebibmacro{citeindex}%
        \let\thefootnote\relax%
        \footnotetext{%
            \blx@anchor
            \mkbibbrackets{\usebibmacro{cite}}%
            \setunit{\addnbspace}
            \printnames{labelname}%
            \setunit{\labelnamepunct}
            \printfield[citetitle]{title}%
            \newunit%
            \printfield[]{year}%
        }%
        \let\thefootnote\svthefootnote%
    }%
    \autocite{\thefield{entrykey}}%
  }
{}
{}
\makeatother



\begin{document}


\begin{frame}{What I found}
    First time, \cite[page 99]{bad}
\end{frame}

\begin{frame}{Again}
    Next time, \cite[page 1]{bad} only
\end{frame}

\end{document}

I have also removed the \addsemicolon\space, but you might want to retain this, it is the punctuation between multiple citations in the same call of \cite: \cite{one,two}.

In your comments you asked for removing the year from the output in the footnote. All you need to is remove the corresponding lines from the new cite command:

\makeatletter
\DeclareCiteCommand{\cite}
{}%
{%
    \ifciteseen{}{%
        \usebibmacro{citeindex}%
        \let\thefootnote\relax%
        \footnotetext{%
            \blx@anchor
            \mkbibbrackets{\usebibmacro{cite}}%
            \setunit{\addnbspace}
            \printnames{labelname}%
            \setunit{\labelnamepunct}
            \printfield[citetitle]{title}%
        }%
        \let\thefootnote\svthefootnote%
    }%
    \autocite{\thefield{entrykey}}%
  }
{}
{}
\makeatother

yearless sample

|improve this answer|||||
  • Probably a stupid question, but how can I remove the year field from the bibliography? – xxx--- Jun 7 '19 at 3:16
  • You can either delete the year line from the entry in the bib file, or you can dynamically delete this for all @online entries via \DeclareSourcemap{\maps[datatype=bibtex]{\map{\pertype{online}\step[fieldset=year,null]}}} – Andrew Swann Jun 7 '19 at 6:54
  • The second approach seems tangential to my head :-). Can we do something like deleting \newunit% and \printfield[]{year}%? – xxx--- Jun 7 '19 at 22:58
  • Yes, if you just want to remove it from that output of the citation command; but this won't affect the bibliography that you asked about. – Andrew Swann Jun 8 '19 at 8:26
  • OK, I mistyped the question... I wanted to remove the year from output of the citation command (so that year is not printed where the information on the cited entry is printed). – xxx--- Jun 8 '19 at 16:02
0

Here's an answer from the user samcarter (who is apparently suspended from this site):

\documentclass{beamer}
\usepackage[style=numeric,citecounter=true,citetracker=true]{biblatex} 
\usepackage{filecontents}
\begin{filecontents*}{myreferences.bib}
    @online{bad,
        author = {{Bad Man}},
        year = {1313},
        title = {Bad Title},
        url = {http://badurl.com/},
    }
\end{filecontents*}
\addbibresource{myreferences.bib}

%https://tex.stackexchange.com/a/165016/38244
\hypersetup{
    colorlinks,
    citecolor=red,
    linkcolor=blue,
%   backref=true
}



\usepackage{algorithm}
\PassOptionsToPackage{noend}{algpseudocode}% comment out if want end's to show
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx
\usepackage{algorithmicx}


\let\svthefootnote\thefootnote

\makeatletter
% https://tex.stackexchange.com/a/29931/38244
\DeclareCiteCommand{\cite}
{\usebibmacro{prenote}}%
{%  
    \ifciteseen{}{%
        \usebibmacro{citeindex}%
        \let\thefootnote\relax%
        \footnotetext{%
            \blx@anchor
            \mkbibbrackets{\usebibmacro{cite}}%
            \setunit{\addnbspace}
            \printnames{labelname}%
            \setunit{\labelnamepunct}
            \printfield[citetitle]{title}%
            \newunit%
            \printfield[]{year}%
        }%
        \let\thefootnote\svthefootnote%
    }%
    \autocite{\thefield{entrykey}}%
  }
{}
{}
\makeatother



\begin{document}


\begin{frame}{What I found}
    First time, \cite[page 99]{bad}   
\end{frame}

\begin{frame}{Again}
    Next time, \cite[page 1]{bad} only
\end{frame}

\end{document}
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.