# Duplicating a new line in a new command

I'm trying to write a new command which will duplicate the last line. I don't want the content duplicated. I just want the template for the last line line duplicated so I can enter new data to the new line..

\newcommand{\cvproject}[4]{%
{\large\color{emphasis}#1\par}
\smallskip\normalsize
\ifstrequal{#2}{}{}{
\textbf{\color{accent}#2} \hspace{2em}{\faCalendar\hspace{0.5em}#3}\par
\smallskip}
\medskip
}


The above command works without a problem and gives an last line output similar to AAAAAAAAAAAAAAAAAAAAAAAAAAA {calendar icon} 2012

What I want to achieve is this

AAAAAAAAAAAAAAAAAAAAAAAAAAA {calendar icon} 2012

BBBbbbbbbbbbbbBBBBBBBBBBBB {calendar icon} 2013

ccccccccccccccccccccccccccc {calendar icon} 2013

The command I have written for this purpose is this :

\newcommand{\cvleader}[5]{%
{\large\color{emphasis}#1\par}
\smallskip\normalsize
\ifstrequal{#2}{}{}{}{
\textbf{\color{accent}#2} \hspace{2em}{\faCalendar\hspace{0.5em}#3}\par
\smallskip}%
\ifstrequal{#4}{}{}{}{
\textbf{\color{accent}#4} \hspace{2em}{\faCalendar\hspace{0.5em}#5}\par
\smallskip}
\medskip
}


But it give me the following error

./main.tex:207: Runaway argument? {\color {accent} Paragraph ended before \text@command was complete. \par l.207

How can I edit my new command to fix this issue?? Thanks!!!

• Welcome to TeX.SE. While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. For instance what is the accent color? – Peter Grill Sep 11 '18 at 19:19
• I have no idea what you mean by "I want the last line duplicated". Can you elaborate? – Werner Sep 11 '18 at 19:46
• The argument of \text..-commands like \textbf may not contain paragraph-breaks. Thus in case argument #2 and/or argument #4 of \cvleader (those arguments go into \textbf) contain(s) the token \par--LaTeX does insert this token also when encountering in the input an empty line/two consecutive linebreaks--, or contain(s) something that in turn at some stage of expansion yields a paragraph-break, you will get the observed error-message. Instead of \textbf{... you can probably try {\bfseries\selectfont... . – Ulrich Diez Sep 11 '18 at 20:43
• There might be other issues: 1. Do you at the end really wish both a \smallskip and a \bigskip? 2. The code of \cvleader's definition has lines that end with opening/closing braces. LaTeX will at the time of reading and tokenizing your .tex-input-file place space-tokens behind the brace-tokens that come from the braces in the code of your .tex-input. These space-tokens in turn may yield visible space/horizontal glue in the .pdf-output. For avoiding that, make sure such lines do not end with an opening/closing brace but with a comment-char % placed right behind the brace in question. – Ulrich Diez Sep 11 '18 at 20:58
• \tikzmark can give you width of the last line or any point within the last line, but it won't tell you how many characters were used. – John Kormylo Sep 12 '18 at 0:37