答案1
我已经创建了伪环境\hidemost
......。如果您不想要\endhidemost
星号,可以从定义中删除它们。\mycommand
\documentclass{article}
\usepackage{tokcycle}
\newcommand{\mycommand}[1]{*#1*}
\def\z{F}
\tokcycleenvironment\hidemost
{}
{\tctestifcon{\if T\z}{\addcytoks{{##1}}}{\processtoks{##1}}\gdef\z{F}}
{\ifx\mycommand##1\addcytoks{##1}\gdef\z{T}\fi}
{}
\begin{document}
\hidemost
hide \mycommand{show} hide and {test}
much other {and inside a group \mycommand{other stuff}}
\section{Blah}
and finally \mycommand{last things} and we are done
\endhidemost
\end{document}