我想在 LaTeX 中创建一个宏,使某些文本产生以下效果(灰色部分):
我想要一些类似的东西\gray{Hello}
,将文本放在括号中并使文本变灰。有人能帮我吗?
答案1
显示三种可能性:第一种如您所愿,第二种具有更好的语义,第三种不需要额外的宏,因为输入的内容并不多。
\documentclass{article}
\usepackage{xcolor}
\newcommand{\gray}[1]{\textcolor{gray}{#1}}
\newcommand\Edit[1]{\textcolor{gray}{(#1)}}
\begin{document}
``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
\end{document}