summaryrefslogtreecommitdiff
path: root/info/examples/tlc3/example-sources/A-1-17.ltx
blob: 80c85759da265a7950c5a90a9d6a2c8999dbd7e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
%%
%% 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}