如何将 `\iffalse \fi` 变成宏名 `\suppress`

如何将 `\iffalse \fi` 变成宏名 `\suppress`

在排除故障时,我经常使用\iffalse\fi来隐藏代码。但是,我想重新利用它以隐藏一些可以稍后更改的小段暂定文本。例如,在下面的文本中:

The quotes were sent last Wednesday, once we got the approval from the manager. However, it seems that they \iffalse were not very happy with the quote and wanted a lower price by 30 \%. \fi

我想要将\iffalse和对\fi组合成一个宏,比如说\suppress{}

因此,上面给出的代码可以重写为:

The quotes were sent last Wednesday, once we got the approval from the manager. However, it seems that they \suppress{were not very happy with the quote and wanted a lower price by 30 \%.}

我该如何做这样的事情?

答案1

@DavidCarlisle 提供了可能是最佳(也是最简单)的解决方案。我已经使用了类似的东西,但我称之为\memo而不是\suppress

例子:

那是特隆赫姆一个漆黑而又暴风雨的夜晚\备忘录{需要修改,因为这是在六月份设定的}。

的内容\memo{}将不会打印。后面的任何内容都会打印。请记住,如果您在前后放置空格,\memo{}那么两个空格都会打印(双倍空格),这可能不是您想要的。您可以在定义中执行\@gobble,但在宏的一侧省略空格也同样容易。

相关内容