1

OK. I read What's the difference between \newcommand and \newcommand*?. However, when I try using

\definecolor{cincinnati-red}{RGB}{190,0,0}

\newcommand{\authorA}[1]{\textcolor{cincinnati-red}{[A: #1]}}

in this form:

\authorA{
    Hi Guys:

    (more stuff)
}

I get the error

Runaway argument?
{[A:  Hi Guys: 
! Paragraph ended before \@textcolor was complete.
<to be read again> 
                   \par 
l.166 }

How do I set up this macro so that the textcolor extends over the entire scope of the argument? (Simply changing \textcolor to \color, as suggested when reading Writing paragraphs in \textcolor, does not work for me. (The color does not show up.)

2
  • 3
    Don't use \textcolor. It doesn't accept a paragraph in its argument. Use \color. If if doesn't work for you: Make a complete example that demonstrates the problem. Aug 15, 2016 at 13:53
  • 2
    Welcome to TeX - LaTeX! \color is the correct command to use. Aug 15, 2016 at 13:54

1 Answer 1

3

The correct command here is \color as \textcolor is not long. The syntax for your command would then be

\newcommand{\authorA}[1]{{\color{cincinnati-red}[A: #1]}}

not that that \color and the text it applies to is enclosed in an extra group of braces, so the color does not affect the text following the command.

Sample output

\documentclass{article}

\usepackage{xcolor}

\definecolor{cincinnati-red}{RGB}{190,0,0}

\newcommand{\authorA}[1]{{\color{cincinnati-red}[A: #1]}}

\begin{document}

Text before

\authorA{
    Hi Guys:

    (more stuff)
}

Text after
\end{document}

You must log in to answer this question.

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