0

Here is my code:

\documentclass[10pt]{beamer}
\usetheme{CambridgeUS}
\usepackage[backend=biber,style=ieee,citestyle=authoryear]{biblatex}

\bibliography{literature.bib}

\begin{document}
    network design\parencite{sb2016}
\end{document}

Now it produces something like this: enter image description here

Notice there is a space between the ( and the author's name.

I tried this: Biblatex[-chicago, authordate] footnote on first cite. Extra space put in parencite But it tells me that the cite:init is not defined.

I've never come across this question before. I even updated the required packages to see if it corrects the error. No it didn't work. Weird.

Update: bibentry

@article{sb2016,
  title={Strategic design of public bicycle sharing systems with service level constraints},
  author={Lin, Jenn-Rong and Yang, Ta-Hui},
  journal={Transportation research part E: logistics and transportation review},
  volume={47},
  number={2},
  pages={284--294},
  year={2011},
  publisher={Elsevier}
}

I am using biblatex package version 3.7. And biber 2.7.

Update: With article and its log file

\documentclass{article}

\usepackage[UTF8]{ctexcap}

%-------------------------------------------------------
% INCLUDE PACKAGES
%-------------------------------------------------------

\usepackage{extramarks} % Required for headers and footers
\usepackage{graphicx} % Required to insert images
\usepackage{tikz} % Required for tikz picture
\usetikzlibrary{fit,arrows,calc,positioning}
\usepackage{xcolor} % Required for color setting
\newcommand{\highlight}[1]{%
  \colorbox{red!20}{$\displaystyle#1$}}
\usepackage{amssymb} % Required for math fonts
\usepackage{amsmath} % Required for math notation
\usepackage{mathtools} % Required for math notation
\usepackage{float} % Stop float
\usepackage[timeinterval=1]{tdclock} % Required for clock
\usepackage{mdframed} % Required to change backgroud colour, but no floating support
\usepackage{pgfpages} % Required for split screen note
\usepackage[backend=biber,style=ieee,citestyle=authoryear,citetracker=true,ibidtracker=false]{biblatex} % Required for citation
\renewcommand\citesetup{\footnotesize}

\usepackage{hyperref}

%-------------------------------------------------------
% DRAWING FIGURES TIKZ
%-------------------------------------------------------

% tikz
\usepackage{tikz}
\usepackage{varwidth}
\usetikzlibrary{arrows,shapes,shapes.geometric,calc}
\tikzstyle{startstop} = [rectangle, rounded corners, minimum width=1.2cm, minimum height=0.7cm,text centered, draw=black, fill=red!30]
\tikzstyle{io} = [trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=1.2cm, minimum height=0.7cm, text centered, draw=black, fill=blue!30]
\tikzstyle{process} = [rectangle, minimum width=1.2cm, minimum height=0.7cm, text centered, draw=black, fill=orange!30]
\tikzstyle{decision} = [diamond, aspect=1.5, minimum width=0.7cm, minimum height=0.7cm, text centered, text width=1.5cm, draw=black, fill=green!30, execute at begin node={\begin{varwidth}{30em}}, execute at end node={\end{varwidth}}]
\tikzstyle{arrow} = [thick,->,>=stealth]

%-------------------------------------------------------
% DEFFINING AND REDEFINING COMMANDS
%-------------------------------------------------------

\renewcommand{\eqref}[1]{$Eq\ \ref{#1}$}

% citation
\ExecuteBibliographyOptions{firstinits=true, isbn=false, url=false, doi=false, uniquename=init}
\AtEveryCitekey{%
\ifentrytype{article}{
\clearfield{pages}%
\clearfield{volume}%
}{}
}

% font
% \setbeamerfont{footnote}{size=\tiny}

% math underline with color
\newsavebox\MBox
\newcommand\Cunderline[2][red]{{\sbox\MBox{$#2$}%
\rlap{\usebox\MBox}\color{#1}\rule[-1.2\dp\MBox]{\wd\MBox}{0.5pt}}}

% citation
% \setbeamertemplate{bibliography item}{\insertbiblabel}
\DeclareCiteCommand{\sfcite}[\cbx@superscript]%
  {\usebibmacro{cite:init}%
   \let\multicitedelim=\supercitedelim
   \iffieldundef{prenote}{}{\BibliographyWarning{Ignoring prenote argument}}%
   \iffieldundef{postnote}{}{\BibliographyWarning{Ignoring postnote argument}}}
  {\usebibmacro{citeindex}%
   \ifciteseen
     {\ifnumequal{\value{page}}{\csuse{cbx@page@\thefield{entrykey}}}
       {}
       {\ifnumequal{\value{framenumber}}{\csuse{cbx@frame@\thefield{entrykey}}}
          {\usebibmacro{sfcite}}
          {}}}
     {\usebibmacro{sfcite}}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}}

% remove the space in front of the parencite

% reference font
\renewcommand*{\bibfont}{\footnotesize}

\bibliography{literature.bib}

\begin{document}
    network design\parencite{lin2011strategic}
\end{document}
12
  • I don't have your literature.bib, so I tested with \addbibresource{biblatex-examples.bib} and sigfridsson. I could not reproduce the problem then. What version of biblatex are you running? (The current version is 3.7.) Note that the linked question is unlikely to help since it is about a vastly different style.
    – moewe
    Dec 16, 2016 at 15:18
  • And I am using biber 2.7
    – Finn
    Dec 16, 2016 at 15:42
  • Mhh, I can't reproduce the problem even with your .bib entry. Does the screenshot come from the exact MWE you posted or does it come from a larger document? Can you reproduce the problem with the MWE?
    – moewe
    Dec 16, 2016 at 15:45
  • biblatex version is 3.7
    – Finn
    Dec 16, 2016 at 15:45
  • 1
    With your MWE I only get 'Lin and Yang 2011'. The fact that in your screenshot we have 'T.-H. Yang' makes me suspect the screenshot is from the context of a larger document. Please try to isolate the problem from the larger document.
    – moewe
    Dec 16, 2016 at 15:47

1 Answer 1

4

The spurious spaces are caused by

\AtEveryCitekey{%
\ifentrytype{article}{
\clearfield{pages}%
\clearfield{volume}%
}{}
}

You need to protect (some) line ends by % so they don't cause spaces. See What is the use of percent signs (%) at the end of lines?.

With

\AtEveryCitekey{%
  \ifentrytype{article}{%
    \clearfield{pages}%
    \clearfield{volume}}
  {}%
}

the space should be gone.

4
  • Thank you so much! It did work! I didn't see it coming this way.. I must have somehow changed this when I rearrange my header.tex file. Thank you!
    – Finn
    Dec 16, 2016 at 16:27
  • @moewe Does this indicate that we cannot use inline comments for these macro-definitions?
    – llinfeng
    Oct 6, 2017 at 16:39
  • @llinfeng Absolutely not, you can use them if you want. Just make sure that there are no spaces before the %.
    – moewe
    Oct 6, 2017 at 18:54
  • @moewe, awesome! Thank you for clarifying! I created the trouble by trying to add inline comments for each field/option in the \AtEveryCitekey, and spaces were created, exactly, due to the multiple spaces that I put in front of the % sign.
    – llinfeng
    Oct 6, 2017 at 23:05

You must log in to answer this question.

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