2

I'm writing a paper for one of my classes that is on the Catalan numbers and I wanted to include an example about how they match up with the number of ways to "legally" arrange n pairs of parenthesis. What I would like to do is to be able to change the color of just the first and last parenthesis in each set so that it is easier to see that each set starts with a "(" and ends with a ")." I have included the part of my code that deals with the case of 3 pairs of parenthesis, which has 5 valid pairings. In the paper I also have the case of 4 pairs of parenthesis which has 14 valid pairings. Is there an easy way, or any way at all, to change the color of just the first and last character in each of the sets? I'm still very new to Latex so I'm sure my code isn't very neat. If anyone has any suggestions of how I can accomplish this I would greatly appreciate it.

\begin{center}  
        ()()() \: \: ((())) \: \: ()(()) \: \: (())() \: \: (()())  
\end{center}
David Carlisle
  • 757,742

1 Answers1

5

add \usepackage{xcolor} then you can use

\textcolor{red}{(} (...) \textcolor{red}{)}

to have red () around black ()

David Carlisle
  • 757,742