TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to create a macro in LaTeX to have the following effect (gray parts) on some text:

enter image description here

I would like to have something like \gray{Hello} which puts brackets and grays the text. Can someone help me?

share|improve this question
With the xcolor package, \textcolor{gray}{Hello}. If you want parens about the gray text, then \textcolor{gray}{(Hello)}. This can be placed in a macro of course. Here is a full MWE: \documentclass{article} \usepackage{xcolor} \def\gray#1{\textcolor{gray}{(#1)}} \begin{document} All writers \gray{will have to} edit their prose, but \gray{the} great. \end{document} – Steven B. Segletes Jul 15 '14 at 16:39
And to put brackets, simply load the xcolor package, and edit @StevenB.Segletes macro as \textcolor{gray}{(Hello)}. You can even put in your preamble \newcommand{\gray}[1]{\textcolor{gray}{(#1)}} and in your document use \gray{Hello}. – Clément Jul 15 '14 at 16:41
@Clément We both had the same idea... I was editing my comment as you posted. – Steven B. Segletes Jul 15 '14 at 16:42
In any case, I would strongly recommend using a more telling command name than simply \grey; perhaps \newcommand\Edit[1]{\textcolor{grey}{(#1)}}. – Sean Allred Jul 15 '14 at 17:02
The downside of \grey, as suggested by Sean Allred, is that, in case you later decide that the color is red while you could redefine the command, it woul look/feel much worse to see that \gray{hello} gives you red color. – Manuel Jul 15 '14 at 21:29
up vote 4 down vote accepted

Showing three possibilities: The first as you desired, the second with better semantic and the third without an extra macro, as it is not that much to type.


``All writers \gray{(will have to)} edit their prose, but \gray{(the)} great

``All writers \Edit{will have to} edit their prose, but \Edit{the} great

``All writers \textcolor{gray}{(will have to)} edit their prose, but \textcolor{gray}{(the)} great

enter image description here

share|improve this answer
Thanks a lot for your time. – minidiable Jul 18 '14 at 11:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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