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

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 '13 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) – David Carlisle Feb 6 '13 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] – David Carlisle Feb 6 '13 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 '13 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) – David Carlisle Feb 6 '13 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.