%%
%% The LaTeX Companion, 3ed
%%
%% Example A-1-17 on page II-645 in "Changing arguments to command names".
%%
%% Copyright (C) 2022 Frank Mittelbach
%%
%% It may be distributed and/or modified under the conditions
%% of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%%
%% See https://www.latex-project.org/lppl.txt for details.
%%

\documentclass{tlc3exa}
\pagestyle{empty}
\setcounter{page}{6}
\setlength\textwidth{423.0pt}

 \setlength\marginparwidth{72pt}
 \addtolength\textwidth{-\marginparwidth}
 \addtolength\textwidth{-\marginparsep}

%StartShownPreambleCommands
\usepackage{kantlipsum,todonotes}
\NewDocumentCommand\newcopyedit{O{blue} m}                         % l.1
 {\newcounter{todo#2}%                                            % l.2
  \ExpandArgs{c}\NewDocumentCommand{#2}{s m}%                     % l.3
    {\stepcounter{todo#2}%                                        % l.4
     \IfBooleanTF {##1}%                                          % l.5
        {\todo[inline,color=#1!20]{#2 \UseName{thetodo#2}: ##2}}% % l.6
        {\todo[color=#1!20]{#2 \UseName{thetodo#2}: ##2}}}}%      % l.7
\newcopyedit{fmi} \newcopyedit[red]{ufi}                           % l.8
%StopShownPreambleCommands

\begin{document}
Kant:\fmi{correct} \kant*[1][1]\fmi{use a different phrase}
\kant[1][2]\ufi*{Add another paragraph!}
\end{document}