我不是以英语为母语的人,我经常犯一些语法错误,尤其是已经有和这个结合每个, 等等。
问:是否有某种方法可以自动突出显示文档中某些单词(来自我指定的列表)的所有出现?
答案1
您可以使用列表包这样做,虽然这并不理想,因为文本不会“正常”排版,并且大多数评论在环境中被禁用lstlisting
。如果您对这些限制感到满意,那么这可能没问题,至少对于草稿来说是这样。
以下是对您的问题的处理方式:
这是乳胶代码:
\documentclass{article}
\usepackage{listings}
\usepackage{xcolor}
\lstset{morekeywords={have,has,each,every}, % define the words to be highlighted
keywordstyle=\color{blue}, % define how they are highlighted
}
\begin{document}
\begin{lstlisting}% wrap your text inside a listings environment
I am not a native English speaker and there are some grammar mistakes
I do a lot, especially have/has in conjunction with each/every, and so
on.
Q: Is there some way to highlight all occurrences of some words (from
a list I specify) in a document automatically?
\end{lstlisting}
\end{document}
答案2
有了luatex
,您就可以使用包chickenize
,类似于:
\documentclass{article}
\usepackage{chickenize}
\addtosubstitutions{have}{HAVE}
\addtosubstitutions{has}{HAS}
\addtosubstitutions{each}{EACH}
\addtosubstitutions{every}{EVERY}
\begin{document}
\substitutewords
I am not a native English speaker and there are some grammar mistakes
I do a lot, especially have/has in conjunction with each/every, and so
on.
Is there some way to highlight all occurrences of some words (from a
list I specify) in a document automatically?
\end{document}
检查完所有出现的问题单词后,只需注释掉\substitutewords
,它们就会恢复为小写,而不是全部大写。