1

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.

enter image description here

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.

2
  • 1
    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
  • 1
    don't feel too bad: you are the 10000000th person to make that mistake. Jan 7, 2019 at 23:30

1 Answer 1

1

Can you please add next time a short compilable code instead your given code snippets?

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.

So please change your definitions to:

\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}
\address{street and number}{postcode city}{country}
\phone[mobile]{+1~(234)~567~890}
\phone[fixed]{+2~(345)~678~901}
\phone[fax]{+3~(456)~789~012}
\email{[email protected]}
\homepage{www.johndoe.com}
\social[linkedin]{john.doe}
\social[twitter]{jdoe}
\social[github]{jdoe}
\extrainfo{additional information}
\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
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\section{Master thesis}
\cvitem{title}{\emph{Title}}
\cvitem{supervisors}{Supervisors}
\cvitem{description}{Short thesis abstract}

\end{document}

you get the wished result:

enter image description here

You must log in to answer this question.

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