是否可以创建一个包含包shownto
环境的环境multiaudience
?
使用以下 MWE 我得到了错误! LaTeX Error: \begin{shownto} on input line 26 ended by \end{cmcomment}.
\documentclass{book}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{multiaudience}
\SetNewAudience{others}
\SetNewAudience{onlyme}
\DefCurrentAudience{onlyme}
\newenvironment{cmcomment}{%
\begin{shownto}{onlyme}\textcolor{gray}\small\singlespacing%
}{\end{shownto}}
\usepackage{mwe}
\begin{document}
\doublespacing
Everyone read this \blindtext
\begin{cmcomment}
I read this \blindtext
\end{cmcomment}
\end{document}
答案1
除了使用之外,\newenvironment
您还可以使用\NewDocumentEnvironment
-typeb
参数:
\documentclass{book}
\usepackage{setspace}
\usepackage{xcolor}
\usepackage{multiaudience}
\SetNewAudience{others}
\SetNewAudience{onlyme}
\DefCurrentAudience{onlyme}
\NewDocumentEnvironment{cmcomment}{+b}
{%
\begin{shownto}{onlyme}%
\color{gray}\small
\singlespacing%
#1\par%
\end{shownto}%
}
{}
\NewDocumentEnvironment{otcomment}{+b}
{%
\begin{shownto}{others}%
\color{gray}\small
\singlespacing
#1\par
\end{shownto}%
}
{}
\usepackage{mwe}
\begin{document}
\doublespacing
Everyone read this \blindtext
\begin{cmcomment}
I read this \blindtext
\end{cmcomment}
Everyone read this \blindtext
\begin{otcomment}
Others read this \blindtext
\end{otcomment}
\end{document}