Unwanted space before commas in ModernCV

I am having some trouble to remove some space before commas.

For example, I have the following two definitions:

\newcommand*{\cvshortentry}[7][.25em]{}
\renewcommand*{\cvshortentry}[7][.25em]{%
\cvitem[#1]{#2}{%year
{\bfseries{#3}} %title
\ifthenelse{\equal{#4}{}}{}{, {#4}}
\ifthenelse{\equal{#5}{}}{}{, #5}
.\strut%
\ifx&#6&%
\else{\newline{}\begin{minipage}[t]{\linewidth}\small#6\end{minipage}}\fi
\ifx&#7&%
\else{\newline{}\begin{minipage}[t]{\linewidth}\small{\slshape#7}\end{minipage}}\fi
}
}

\newcommand{\publication}[6]{
\cvitem{#1}{%year
{#2} %authors
{, #3} %title
{\slshape, #4} %journal / status
{\small#5}
}
}


filled like this:

\section{Current Projects}
\cvshortentry{}{Poject Name}{Some description of the project}{\small \textcolor{bluee}{some more comments}}{}{}

\section{Selected Publications}
\publication{2018}{I.M. Lopez, J. Doe}{Title of article}{Journal}{\textcolor{bluee}{some comments}}{}


which produces the following outputs with undesired space before commas.

Probably I am doing something wrong with the \cvitem but I tried lots of different things and I couldn't solve it.

So, how do I remove the undesired space before the commas and the point.

Thank you.

• you are explicitly adding the space: {\bfseries #3}<space here> delete that space. and the space/neline after {, {#4}} should be removed or commented out, similaly all the spaces added at the end of every line in \publication Jan 7, 2019 at 23:23
• don't feel too bad: you are the 10000000th person to make that mistake. Jan 7, 2019 at 23:30

To get rid of the blanks before the comas you need to add some % or delete some blanks before the writen % in your definition of both commands.

You can ommit the first line (use \newcommand in the next line):

\newcommand*{\cvshortentry}[7][.25em]{}


Your definition for \publication}[6] is faulty, you defined only 5 arguments and should think about the case the argument is empty.

\newcommand*{\cvshortentry}[7][.25em]{%
\cvitem[#1]{#2}{%year
{\bfseries{#3}}% title
\ifthenelse{\equal{#4}{}}{}{, {#4}}%
\ifthenelse{\equal{#5}{}}{}{, #5}%
.\strut%
\ifx&#6&%
\else{\newline{}\begin{minipage}[t]{\linewidth}\small#6\end{minipage}}\fi%
\ifx&#7&%
\else{\newline{}\begin{minipage}[t]{\linewidth}\small{\slshape#7}\end{minipage}}\fi%
}%
}

\newcommand{\publication}[6]{%
\cvitem{#1}{% year
{#2}% authors
{, #3}% title
{\slshape, #4}% journal / status
{\ifthenelse{\equal{#5}{}}{}{\small, #5}}%
{\ifthenelse{\equal{#6}{}}{}{, #6}}%
.%
}%
}


With the following complete code

\documentclass[11pt,a4paper,sans]{moderncv}

\moderncvstyle{classic} % casual, classic, banking, oldstyle and fancy
\moderncvcolor{blue}

\usepackage[utf8]{inputenc}

\usepackage[scale=0.75]{geometry}

% personal data
\name{John}{Doe}
\title{Resumé title}
\phone[mobile]{+1~(234)~567~890}
\phone[fixed]{+2~(345)~678~901}
\phone[fax]{+3~(456)~789~012}
\email{john@doe.org}
\homepage{www.johndoe.com}
\social[github]{jdoe}
\photo[64pt][0.4pt]{example-image-a}
\quote{Some quote}

\setlength{\footskip}{66pt}

%\newcommand*{\cvshortentry}[7][.25em]{}
\newcommand*{\cvshortentry}[7][.25em]{%
\cvitem[#1]{#2}{%year
{\bfseries{#3}}% title
\ifthenelse{\equal{#4}{}}{}{, {#4}}%
\ifthenelse{\equal{#5}{}}{}{, #5}%
.\strut%
\ifx&#6&%
\else{\newline{}\begin{minipage}[t]{\linewidth}\small#6\end{minipage}}\fi%
\ifx&#7&%
\else{\newline{}\begin{minipage}[t]{\linewidth}\small{\slshape#7}\end{minipage}}\fi%
}%
}

\newcommand{\publication}[6]{%
\cvitem{#1}{% year
{#2}% authors
{, #3}% title
{\slshape, #4}% journal / status
{\ifthenelse{\equal{#5}{}}{}{\small, #5}}%
{\ifthenelse{\equal{#6}{}}{}{, #6}}%
.%
}%
}

\begin{document}

\makecvtitle

\section{Current Projects}
\cvshortentry{}{Poject Name}{Some description of the project}{\small \textcolor{blue}{some more comments}}{}{}

\section{Selected Publications}
\publication{2018}{I.M. Lopez, J. Doe}{Title of article}{Journal}{\textcolor{blue}{some comments}}{}

\section{Education}
\cventry{year--year}{Degree}{Institution--3}{City--4}{\textit{Grade}--5}{Description--6}  % arguments 3 to 6 can be left empty