0

In my latex code an unwanted space is appearing after the citation.

Error Quote

I am using \bibitem to put the referential information and \cite to cite the papers:

As the latex code is large I'll put the reader link:

Code: https://www.overleaf.com/read/ykgtbqvpkccz

5
  • 2
    Welcome to TeX. Could you please provide an MWE ([tex.meta.stackexchange.com/questions/228/…) of what you have tried already so you question may be better answered. Mar 31, 2022 at 14:10
  • 3
    you are adding space somewhere. but you have shown no code so we can not know where. Do you have \cite{lima2020} . Os coronavirus.... wih a space afer \cite ? Mar 31, 2022 at 14:35
  • 1
    It is possible that you add the space explicitly by leaving a space in the source between the citation and the full stop, but at the same time it is also entirely possible that you for some reason the code you are using adds these spaces automatically. We can only help you if you show us a small example document that reproduces the shown output with as little excess code as possible. Please double check that the code you post is compilable and shows the problem. See also tex.meta.stackexchange.com/q/228, tex.meta.stackexchange.com/q/4407, tex.meta.stackexchange.com/q/6255
    – moewe
    Mar 31, 2022 at 14:39
  • I added some images and made source code available. I think that the code I using adds these spaces automatically. Mar 31, 2022 at 16:02
  • 3
    Please do not post code as images. Images are almost unusable for people who want to actually run the code and more importantly they pose an accessibility issue for people using screen readers. Please reduce your example document so much that it can be posted as code here in one go (see the links in my previous comment).
    – moewe
    Mar 31, 2022 at 16:08

1 Answer 1

4

The class you are using is written quite badly and has dozens of such spurious spaces scattered throughout its code. The culprit of this specific issue is

% univasf.cls ll. 1445-1448
\renewcommand\@cite[2]{%
#1\ifthenelse{\boolean{@tempswa}}
{, \nolinebreak[3] #2}{}
}

which introduces the spurious space after every \cite. You can correct this by adding in your preamble

\makeatletter
\renewcommand\@cite[2]{%
  #1\ifthenelse{\boolean{@tempswa}}% <-- not necessary but doesn't hurt
  {, \nolinebreak[3] #2}{}% <-- this IS necessary
}
\makeatother

However, with that class you'll have a lot of similar issues.

1
  • It worked perfectly, thank you. Mar 31, 2022 at 19:48

You must log in to answer this question.

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