2

I have an issue I was not able to solve by now. When I use the \textcite command in combination with a page number, the year is enclosed in square brackets. How can I delete them?

\documentclass[
    a4paper,
    bibliography=totoc,
    toc=listof,
    chapterentrydots=on,
    captions=tableheading,
    headings=small,
]{scrbook}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{lmodern}
\usepackage[headsepline]{scrlayer-scrpage}
\usepackage{microtype}
\usepackage{ragged2e}
\usepackage[
    format=hang,
    skip=2.5pt,
    justification=RaggedRight,
    singlelinecheck=false,
    labelfont=bf,
]{caption}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{fp}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{etoolbox}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage[babel]{csquotes}
\usepackage[
    backend=biber,
    citetracker=true,
    autolang=other,
    style=authoryear,
    maxcitenames=2,
    maxbibnames=99,
    uniquename=false,
    uniquelist=true,
    isbn=false,
    doi=false
]{biblatex}
\AtEveryCitekey{\ifciteseen{}{\defcounter{maxnames}{99}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% --- Backslash Authors --- % \newcommand*{\citerevsdnamedelim}{}
\newcommand*{\citemultinamedelim}{\slash}
\newcommand*{\citefinalnamedelim}{\slash}
\AtBeginDocument{%
    \let\revsdnamedelim\citerevsdnamedelim
    \let\multinamedelim\citemultinamedelim%
    \let\finalnamedelim\citefinalnamedelim%
}

% --- Semikolon --- %
\renewcommand*{\multilistdelim}{\addsemicolon\space}
\renewcommand*{\finallistdelim}{\addsemicolon\space}


% --- () footnotes % --- () year footnotes
\DeclareFieldFormat{bibhyperrefparens}{\bibhyperref{\mkbibparens{#1}}}

% --- () year text \renewbibmacro*{cite:labelyear+extrayear}{% \iffieldundef{labelyear} {}% {\printtext[bibhyperrefparens]{%
\printfield[]{labelyear}% \printfield[]{extrayear}% }% }% }

% --- authors footnotes / small caps text --- %
\renewcommand*{\mkbibnamefamily}[1]{\textsc{#1}}

\AtBeginBibliography{%
\renewcommand*{\mkbibnamefamily}[1]{\textrm{#1}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bibliography{Master}
\usepackage{filecontents}
\begin{filecontents*}{Master.bib}

@article{Beasley.2008,
    author = {Beasley, Mark and Pagach, Don and  Warr, Richard},
    year = {2008},
    title = {Information conveyed in hiring announcements of senior
             executives overseeing enterprise-wide risk management processes},
    pages = {311--332},
    pagination = {page},
    volume = {23},
    journaltitle = {Journal of Accounting, Auditing {\&} Finance},
    abstract = {},
    note = {}
}
\end{filecontents*}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\noindent Here I use the \textit{cite} command:
\cite[][311]{Beasley.2008} \\ Here the \textit{footcite} command: See
footnote\footcite[][311]{Beasley.2008} \\ And finally the
\textit{textcite} command:
\textcolor{red}{\textcite[][311]{Beasley.2008}}  \\ \noindent But it
should look like that: \textcolor{green}{\textsc{Beasley} et al.
(2008, p. 311)}

\end{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

enter image description here

  • 1
    Remove the \renewbibmacro*{cite:labelyear+extrayear}... definition. – Ulrike Fischer Aug 18 '16 at 11:36
  • Thank you Ulrike, but then my footcites change. The year is not enclosed in brackets anymore. Before: Beasley et al. (2008), p. 311. After Beasley et al. 2008, p. 311. – TRJW Aug 18 '16 at 12:52
  • 1
    Then change the bibhyperrefparens format (needs a current biblatex): \DeclareFieldFormat{bibhyperrefparens}{\ifcsstring{blx@delimcontext}{textcite} {\bibhyperref{#1}} {\bibhyperref{\mkbibparens{#1}}}} – Ulrike Fischer Aug 18 '16 at 13:08
  • % --- () footnotes % --- () year footnotes %\DeclareFieldFormat{bibhyperrefparens}{\bibhyperref{\mkbibparens{#1}}} \DeclareFieldFormat{bibhyperrefparens}{\ifcsstring{blx@delim‌​context}{textcite}{\bibhyperref{#1}}{\bibhyperref{\mkbibparens{#1}}}} % --- () year text \renewbibmacro*{cite:labelyear+extrayear}{% \iffieldundef{labelyear} {}% {\printtext[bibhyperrefparens]{% \printfield[]{labelyear}% \printfield[]{extrayear}% }% }% } – TRJW Aug 18 '16 at 14:38
  • I have modified my TEX file as you can see above. Unfortunately I get an ERROR: "! Missing \endcsname inserted." When (Sorry for the format - how can I insert a code properly?)) :( – TRJW Aug 18 '16 at 14:44
1

Since both the cite and textcite bibmacros use cite:labelyear+extrayear you should not insert the parentheses there.

An easy solution is to define a new macro with parentheses and use that in cite

\DeclareFieldFormat{bibhyperrefparens}{\bibhyperref{\mkbibparens{#1}}}

\newbibmacro*{cite:parens:labelyear+extrayear}{%
  \iffieldundef{labelyear}
    {}
    {\printtext[bibhyperrefparens]{%
       \printfield{labelyear}%
       \printfield{extrayear}}}}

\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:label}%
        \setunit{\printdelim{nonameyeardelim}}}
       {\printnames{labelname}%
        \setunit{\printdelim{nameyeardelim}}}%
     \usebibmacro{cite:parens:labelyear+extrayear}}
    {\usebibmacro{cite:shorthand}}}

In total

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{lmodern}
\usepackage[babel]{csquotes}
\usepackage[
    backend=biber,
    citetracker=true,
    autolang=other,
    style=authoryear,
    maxcitenames=2,
    maxbibnames=99,
    uniquename=false,
    uniquelist=true,
    isbn=false,
    doi=false
]{biblatex}
\usepackage{xcolor}
\usepackage{hyperref}

\AtEveryCitekey{\ifciteseen{}{\defcounter{maxnames}{99}}}

\renewcommand*{\revsdnamedelim}{}
\renewcommand*{\multinamedelim}{\slash}
\renewcommand*{\finalnamedelim}{\multinamedelim}

\renewcommand*{\multilistdelim}{\addsemicolon\space}
\renewcommand*{\finallistdelim}{\multilistdelim}

\DeclareFieldFormat{bibhyperrefparens}{\bibhyperref{\mkbibparens{#1}}}

\newbibmacro*{cite:parens:labelyear+extrayear}{%
  \iffieldundef{labelyear}
    {}
    {\printtext[bibhyperrefparens]{%
       \printfield{labelyear}%
       \printfield{extrayear}}}}

\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:label}%
        \setunit{\printdelim{nonameyeardelim}}}
       {\printnames{labelname}%
        \setunit{\printdelim{nameyeardelim}}}%
     \usebibmacro{cite:parens:labelyear+extrayear}}
    {\usebibmacro{cite:shorthand}}}


\renewcommand*{\mkbibnamefamily}[1]{\textsc{#1}}
\AtBeginBibliography{%
  \renewcommand*{\mkbibnamefamily}[1]{#1}}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}

@article{Beasley.2008,
    author = {Beasley, Mark and Pagach, Don and  Warr, Richard},
    year = {2008},
    title = {Information conveyed in hiring announcements of senior
             executives overseeing enterprise-wide risk management processes},
    pages = {311--332},
    pagination = {page},
    volume = {23},
    journaltitle = {Journal of Accounting, Auditing {\&} Finance},
    abstract = {},
    note = {}
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}

\noindent Here I use the \textit{cite} command:
\cite[][311]{Beasley.2008} \\ Here the \textit{footcite} command: See
footnote\footcite[][311]{Beasley.2008} \\ And finally the
\textit{textcite} command:
\textcolor{red}{\textcite[][311]{Beasley.2008}}  \\ \noindent But it
should look like that: \textcolor{green}{\textsc{Beasley} et al.
(2008, p. 311)}

\printbibliography
\end{document}

please note how I simplified your code, especially the \citemultinamedelim bit.

example output

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.