I need to color some text red (not color the cell background) in cell in a table to highlight it. The numbers in the column are aligned on the decimal using the dcolumn package. The problem is that


doesn't compile it's saying

} inserted at

and then saying that there is one too many }.

Can anyone help me with this?

  • 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. Feb 6, 2013 at 6:26
  • Also, \color{red} is a switch and does not take a paraeter, so you could try \color{red}0.044. Feb 6, 2013 at 6:30
  • @PeterGrill you could try that (it won't work though) Or at least it will only color the first bit. Feb 6, 2013 at 11:07

1 Answer 1


enter image description here

You just need to copy the definition of the D type and add colo(u)r:







  • I'd like to define a newcolumn type with one mandatory argument (the number of decimal places) and one optional argument (the text color) it aligns the period in the cell's contents on the decimal in the column. how would I do that. Also, can I have more than one \makeatletter ... \makeatother blocks
    – Keith
    Feb 6, 2013 at 22:51
  • you can have as many make ... as you want but you only ever need one, you can put ll redefinitions there (or better dont have one at all and put teh definitions in a local package you can reuse) Feb 6, 2013 at 22:56
  • newcolumntypes (as defined in array package) don't have optional arguments so you have to make it mandatory, but that;s OK you can just use D or E{red} rather than D and D[red] Feb 6, 2013 at 22:57
  • If I use D in the column specification, and E in the multicolumn with the cell I use E with line up on the decimals with the normal D cells in the same column also would \newcolumntype{E}[2]{>{\color{#2}\DC{.}{.}{#1}}c<{\DC@end}} be valid?
    – Keith
    Feb 6, 2013 at 23:22
  • I'm not sure I can parse that sentence but the answer is probably that yes it will work, the colour version doesn't affect the alignment so if you use the same alignment spec in the multicolumn{1} as in the preamble they will line up, or use the colour one in both with black as the color. yes your E spec looks OK to me except should be \DC@ not \DC (untested) Feb 6, 2013 at 23:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.