summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/coop-writing/coop-writing.dtx
blob: ce30b4f64ca041df72fe782bf471da5beec292b7 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
% \iffalse meta-comment
%
% Copyright (C) 2022 by Geraldo Xexéo
%
% This file may be distributed and/or modified under the
% conditions of the MIT License
%
% \fi
%
%
%\iffalse
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\def\cw@version{v1.2.4}
%<package>\ProvidesPackage{coop-writing}[2022/01/13 \cw@version dtx version of coop-writing]
%<*driver>
\documentclass{ltxdoc}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage[brazilian,english]{babel}
\usepackage{datetime}
\usepackage{indentfirst}
\usepackage{enumitem}
\usepackage{graphicx}
\setlist{noitemsep}
\setlength{\parskip}{0.5em}
\usepackage{marvosym}
\usepackage[backend=biber,style=alphabetic,natbib]{biblatex}
\addbibresource{coop-writing.bib}
\usepackage[editing]{coop-writing}
%%\usepackage{textcomp,url,a4wide,array}
%%\usepackage[eso-foot,today,draft]{svninfo}
%%\usepackage{xcolor}
\usepackage{marvosym}
\usepackage{hyperref}
\cwnamedef{xexeo}{red}{Xexéo}
%
%
%
%
\EnableCrossrefs
\CodelineIndex
\RecordChanges
%
\DoNotIndex{\def,\long,\edef,\xdef,\gdef,\let,\global}
\DoNotIndex{\begin,\AtEndDocument,\newcommand,\newcounter,\stepcounter}
\DoNotIndex{\immediate,\openout,\closeout,\message,\typeout}
\DoNotIndex{\section,\scshape,\arabic}
%
%
%
\title{coop-writing \coopwritingversion}
\author{Geraldo Xexéo}
\date{\today\ - \ \currenttime}
\GetFileInfo{coop-writing.sty}
%
\makeindex
\MakeShortVerb{\|}
\begin{document}
    \DocInput{coop-writing.dtx}
    \printbibliography
    \newpage
    \PrintChanges
    \newpage
    \PrintIndex
    \newpage
    \listofcomments
    \newpage
    \listofcitationneeds
    \newpage
    \listofsubjects
\end{document}
%</driver>
% \fi
%
% \CheckSum{798}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \changes{v1.0}{2021/05/29}{First version}
% \changes{v1.1}{2021/05/30}{You can put an aditional symbol before the comment superscript number}
% \changes{v1.1.1}{2021/05/30}{Fix some bugs, anonymization back on manual}
% \changes{v1.1.2}{2021/05/30}{PDF bookmarks can't handle full UTF}
% \changes{v1.2.0}{2021/05/30}{New command cwmain and configuration for it}
% \changes{v1.2.1}{2021/06/05}{Fixing problems with footnote mark color and also recovering \LaTeX\ command (at-sign)makefnmark}
% \changes{v1.2.2}{2021/06/06}{Memoir class, used by abnetex2, used by my department,  ``emulates'' tocloft, but not correctly. Many IFs were necessary}
% \changes{v1.2.3}{2021/06/09}{CoppeTex class asks for LoF and etc... to appear in ToC. This is an option in tocloft, but Book does not behave like that}
% \changes{v1.2.4}{2022/01/13}{Corrections for CTAN}
%\maketitle
%
% \tableofcontents
%
%\section{Introduction}
%
% This package supports editorial comments and gives some extra support for writing papers, or any document that involves more than one author or editor.
%
% Usually, a final version of a  document would be printed with the |publish| option turned on, and no editorial comments would appear.
% In this document \xexeo[the reader will see some uses]{This is an exemple of using this package to make a comment with highlighted text} of the package, since it is distributted with the |editing| option turned on.
% This is done to provide the examples of use.
%
%
% \subsection{A bit of context}
%
% |coop-writing| was written to support my way of working, and received
% suggestions from my students. The starting goal was to build only a front-end to put together other packages, mostly |ed| and |todonotes|, but with time, and the difficulty to make different packages with commands that have the same name to work together, it grow in scope.
%
% It picks ideas from different packages, such as |ed|\citep{ed}, |color-edits|\citep{color-edits}, and |todonotes|\citep{todonotes}, and from my practice writing papers and supervising thesis.
% As it is my first package, \TeX\  and \LaTeX\  programming is sometimes naive. However, due to the large amount of available code, and sites as StackExchange, this is not a rule.
%
% \subsection{The Brazilian origin}
%
% Originally, |coop-writing| was written in Portuguese. The Portuguese commands are still available. Typos and others errors can appear in this text, please use GitHub issues to warn me any errors that you find.
%
%\section{How to use coop-writing}
%
% |coop-writing| is available as open source at \url{https://github.com/xexeo/coop-writing}, using a MIT License. The stable distribution is in the folder |dist|, while the lastest, and unstable, will be in the root folder. A CTAN folder now contains the current submitted CTAN distribution.
%
% The only file you really need, besides this manual, is
% |coop-writing.sty|. This should be in your \LaTeX\   path, such as in the same folder that your main |.tex| file.
%
% If you are new to \LaTeX, just put one of these 3 lines in the preamble part of you document, i.e., before |\begin{document}|:
%
% |\usepackage[editing]{coop-writing}|
%
% |\usepackage[submit]{coop-writing}|
%
% |\usepackage[publish]{coop-writing}|
%
% After that, you can use |\cwauthor| or |\cweditor| to make commentaries, but you must
% look at the many options available that are described in section \ref{sec:edcom}. You will probably want to define authors as described in subsection \ref{sec:create}.
%
%\subsection{How to complain or make suggestions}
%
% You can make suggestions, complain about bugs, and request features using GitHub's ``Issues'' feature, in
% \url{https://github.com/xexeo/coop-writing/issues}.
%
% \subsection{Using from Overleaf}
%
% The best way to use |coop-writing| inside Overleaf is to link
% the distributed style file through its URL. To do that, inside your project, select first ``Upload''. An ``Add files'' window will appear, then select ``From External URL'' and enter \url{https://raw.githubusercontent.com/xexeo/coop-writing/main/dist/coop-writing.sty} as ``URL to fetch the file from'' and ``coop-writing'' as ``File Name in This Project'', as in Figure \ref{fig:overleaffileurl}.
%
%\begin{figure}[tbh]
%    \centering
%    \includegraphics[width=0.9\linewidth]{images/overleaffileurl}
%    \caption{How to link a coop-writing.sty file in your project folder in Overleaf to the official distribution.}
%    \label{fig:overleaffileurl}
%\end{figure}
%
%
%\section{Package Options}
%
%
% Using the package allows the use of all macros and environments described in this manual, however, \textbf{if the options are not turned on, there will be no effect on the generated |pdf|}, since, by default, all options are false.
%
% There are three types of options. The first type enables the visualization of the result of specific macros or environments, such as
% the |cwdraft| environment. They are named \textit{command oriented options}. You can use many of them in the same time.
%
% The second type  represents a state
% of the text, which can be |editing|, |submit|, or |publish|, and some minor variations. They are named \textit{state oriented options}.
%
% The third type control other behaviors. They are named
% \textit{behavior oriented options}
%
%
% If they appear together, state oriented commands have precedence over the others. However, the user should avoid mixing command and state oriented options. Also, you should \textbf{use only one of the state oriented options.}
%
% It should be clear that the options have no impact on the availability of the macros and enviroments, they will be there for you to use, but the deeply affect their behavior. A macro that is very complex, such as |\cwauthor|, if one of the options |comments| or |editing| is selected, is replaced by a simple version that do almost nothing.
%
% \subsection{Command oriented options}
% \begin{itemize}
%    \item |subjects|, \DescribeMacro{subjects}  enables the use of |\subject|, which is proposed as a paragraph heading describing its subject;
%    \item |comments|, \DescribeMacro{comments}  enables all editorial comments and the command |\pleasecite|;
%    \item |drafts|, \DescribeMacro{drafts}  enables the |\cwdraft| command;
%    \item |suggestions|, \DescribeMacro{suggestions}  enables the comments definided in the suggestion section of this text.
%    \item |anonymize|, \DescribeMacro{anonymize}   enables anonymization commands, and
%    \item |todos|, \DescribeMacro{todos}  enables the to do family of  commands.
%\end{itemize}
%
%\subsection{State oriented options}
% \begin{itemize}
% \item |submit|, \DescribeMacro{submit} enables the |submit| state. |anonymize| is on, |subjects|, |comments|, |drafts| and |suggestions| are off.
% \item |noanonymize|, \DescribeMacro{noanonymize} disables |anonymize| even in |submit| and |editing| options.
% \item |publish|, \DescribeMacro{publish} disables all command oriented options, ignore suggestions.
% \item |acceptingpublish|, \DescribeMacro{acceptingpublish}  disables all command oriented options, accept suggestions
% \item |editing|, \DescribeMacro{editing}  enables |subjects|, |comments|, |drafts|, |anonymize|, and |suggestions|.
% \end{itemize}
%
%\subsection{Behavior oriented options}
%
% Some of this option are inherited from |ed|.
%
%
% \begin{itemize}
%    \item |nopdfbookmarks| will avoid adding bookmarks in the |pdf| file for all comments. The default behavior of |coop-writing| is adding them.
%
%   \item |toclofttitles| toggles the option |titles| in |tocloft|, that avoid the redefinition of |\listoffigures| and |\listoftables|. This fix the bug with |CoppeTeX| package, identified as |coppe|.
%\end{itemize}
%
% \subsection{General behavior}
%
% The general behavior of this package is to provide different
% ways of marking your text, for example, with comments or to do notes, which can be totally supressed when desired. Mostly, this can be easilly done using one the the 3 main option states: |editing|, |submit|, and |publish|.
%
%
% Users should use the |editing| state most of the time. In this state, all
% markings will appear and the anonymization will be off.
%
% When submitting, the |submit| state will provide
% a clean article, without any markings. Most of the times the article should be anonymized,
% but if this is not enforced by a conference or journal, it is possible to use the options |submit| and |noanonymize| together. |publish| will never anonymize.
%
% The goal is to make the |submit| and |publish| documents states minimally
% invasive, to avoid any clash with publishers' styles. A clash will be considered a bug, and should be reported to the authors.
% Most of the time, using these options will simply create dummy commands.
%
% If you use |comments|, there will be a lot of ``Marginpar moved'' warnings.
% This is normal behavior, caused by the margin notes. It will not happen when |submit| or |publish| is active.
%
%
%\section{Version}
%
% It is possible that the user wants to know the version
% being used. We provide two commands for it.
%
% \DescribeMacro{\coopwritingversion}
% Provides the current version
%
% \DescribeMacro{\printcoopwritingversion}
% Provides name and version
%
%
% |\coopwritingversion| was used in the title of this article. The current version is \coopwritingversion.
%
% If needed, the second macro prints also the name of the
% package:
%
%|\printcoopwritingversion|
%
% will result in:
%
%\printcoopwritingversion
%
% Please state the version when reporting bugs.
%
%\section{Editorial comments}
%\label{sec:edcom}
%
% This is the main reason of this package.
%
% The idea is that not only users can make editorial comments on the
% text they are writing, but they can also establish a dialog through those comments.
% In this package an editorial comment has 3 visual parts: an intervention in the
% text, a margin note indicating this intervention, and a footnote explaining it\xexeo{This is the simplest form of an editorial note.}. Figure \ref{fig:editorialnotes} illustrate this behavior.
%
%
%\begin{figure}[tbh]
%    \centering
%    \includegraphics[width=0.8\linewidth]{images/editorialnotes}
%    \caption{How comments appear in the document when \texttt{editing} option is on.}
%    \label{fig:editorialnotes}
%\end{figure}
%
%
%
%\subsection{Creating authors}
%\label{sec:create}
% \DescribeMacro{\cwnamedef}
% This macro creates a series of commands based on a desired base command name. The command name is, usually, the name of the author, of the editor, or a function in the work being done.
%
%  This macro must be used in the preamble of the \LaTeX document, i.e., before the |\begin{document}| declaration. It is usually done just after the |\usepackage{coop-writing}| line.
% Its syntax is:
%
%|\cwnamedef| \marg{name}\marg{color}\marg{author-name}
%
%
% Where \meta{name} will be the base command name, which generates different commands, by receiving sufixes, \meta{color} is the color to be used by all
% comments and suggestions made by this author, and \meta{author-name} is the string to be used to represent the collaborator.
%
% As an example, I usually declare myself as:
%
% |\cwnamedef{xexeo}{red}{Xexéo}|
%
% And, among other commands, |\xexeo| will be defined in such a way that it generates
% a footnote written in red, with a indicative margin note in the same color. Both will
% be identified with ``Xexéo''\xexeo{This is the example of the minimal use of an editorial command}.
%
%
% The \meta{name} and \meta{author-name} are different to support short command names and characters not supported in \LaTeX\  macros. Therefore, if you name is \textit{Gutemberg} you can create a family of commenting macros based on |\gut|, but use ``Gutemberg'' as your identifier.
%
%
% \DescribeMacro{\cwauthor}\DescribeMacro{\cweditor}
% Two authors are pre-defined in the style, |cwauthor| and |cweditor|, to represent an author and an editor. They can be freely used.
%
%\subsection{Available commands}
%
% For each user created with command name \meta{name}, such as |cwauthor| and |cweditor|, used as example, the following commands are available.
%
%\subsubsection{Comments}
%
% \DescribeMacro{\<name>}
% \DescribeMacro{\cwauthor}
% \DescribeMacro{\cweditor}
% |\<name>| \oarg{selection}\marg{footnote comment}
%
% |\cwauthor| \oarg{selection}\marg{footnote comment}
%
% |\cweditor| \oarg{selection}\marg{footnote comment}
%
% These are the simplest commands, and will make a comment in the form of a identified footnote\cwauthor{Simplest footnote comment}. The optional \meta{selection} parameter allows to \cweditor[highlight some text]{Comment with highlighting}.
%
%\subsubsection{Labeled Comments}
%
% \DescribeMacro{\<name>r}
% \DescribeMacro{\cwauthorr}
% \DescribeMacro{\cweditorr}
% |\<name>r| \oarg{selection}\marg{footnote comment}\marg{label}
%
% |\cwauthorr| \oarg{selection}\marg{footnote comment}\marg{label}
%
% |\cweditorr| \oarg{selection}\marg{footnote comment}\marg{label}
%
% This command will make a comment in the form of a labeled footnote\cwauthorr{labeled footnote comment}{FirstLabel}. It can also be used to \cwauthorr[highlight some text]{labeled
% comment with highlighting}{OtherLabel}. The label must be unique, and usually a single word, since it is used as a \LaTeX\  |\label| too. You can refer to this command using |\ref{cw:|\meta{label}|}|. For example, the comment \ref{cw:FirstLabel} would
% be referenced as |\ref{cw:FirstLabel}|, as in here \autoref{cw:FirstLabel}.
%
%
%\subsection{Striked-throught comments}
%
% After using the editorial comments for a time we started to delete the old ones that
% represented fixed problems. However, we notice that some comments should be kept,
% even if solved.
% The solution was to create the striked-trought comments. They are easy to
% use, just put an |x| after the command name.
%
%
% \DescribeMacro{\<name>x}
% \DescribeMacro{\cwauthorx}
% \DescribeMacro{\cweditorx}
% |\<name>x| \oarg{selection}\marg{footnote comment}
%
% |\cwauthorx| \oarg{selection}\marg{footnote comment}
%
% |\cweditorx| \oarg{selection}\marg{footnote comment}
%
% This command will make a comment in the form of a footnote\cweditorx{Simplest footnote
% comment}, however the comment is striked through. It can also be used to \cwauthorx[highlight some text]{Comment with highlighting}.
%
% \DescribeMacro{\<name>rx}
% \DescribeMacro{\cwauthorrx}
% \DescribeMacro{\cweditorrx}
% |\<name>rx| \oarg{selection}\marg{footnote comment}\marg{label}
%
% |\cwauthorrx| \oarg{selection}\marg{footnote comment}\marg{label}
%
% |\cweditorrx| \oarg{selection}\marg{footnote comment}\marg{label}
%
%
% This command will make a comment in the form of a labeled footnote\cwauthorrx{labeled footnote comment}{Second label}, however the comment is striked through. It can also be used to \cwauthorrx[highlight some text]{labeled comment with highlighting}{New label}. The label must be unique, since it is used as a \LaTeX\  |label| too.
%
%\subsection{Text Modification - Suggestions}
% Sometimes one of the authors wants to insert, remove or edit some
% text, but he or she is not sure that every one will agree, therefore
% he or she can make a suggestion, that will appear with his or her color.
%
% \DescribeMacro{\<name>sug}
% \DescribeMacro{\cwauthorsug}
% \DescribeMacro{\cweditorsug}
% |\<name>sug|\oarg{comment}\marg{suggested text}
%
% |\cwauthorsug|\oarg{comment}\marg{suggested text}
%
% |\cweditorsug|\oarg{comment}\marg{suggested text}
%
%  This macro supports making a suggestion. It inserts text, using the color chosen
% by the author. It is also possible to make a comment, but in this command the command
% is the optional argument.
%
% As example, in this paragraph the following text:
%
% \begin{verbatim}
%  \cwauthorsug{inserted text} will appears in the red, and it is
% possible to \cweditorsug[I want to insert this]{use a comment}.
% \end{verbatim}
%
% generates:
%
%  \cwauthorsug{inserted text} will appears in the red, and it is
% possible to \cweditorsug[I want to insert this]{use a comment}.
%
% \DescribeMacro{\<name>rem}
% \DescribeMacro{\cwauthorrem}
% \DescribeMacro{\cweditorrem}
% |\<name>rem|\oarg{comment}\marg{suggested removal}
%
% |\cwauthorrem|\oarg{comment}\marg{suggested removal}
%
% |\cweditorrem|\oarg{comment}\marg{suggested removal}
%
% This macro is used to suggest removals.
%
% For example:
%
% \begin{verbatim}
% This is an example \cwauthorrem{that is quite good}.
% Again, it is also possible to comment
% the \cwauthorrem[Repeated words]{the removal} removal.
%\end{verbatim}
%
% generates:
%
% This is an example \cwauthorrem{that is quite good}.
% Again, it is also possible to comment
% the \cwauthorrem[Repeated words]{the removal} removal.
%
%
% \DescribeMacro{\<name>swap}
% \DescribeMacro{\cwauthorswap}
% \DescribeMacro{\cweditorswap}
% |\<name>swap|\oarg{comment}\marg{suggested removal}\marg{suggested insertion}
%
% |\cwauthorswap|\oarg{comment}\marg{suggested removal}\marg{suggested insertion}
%
% |\cweditorwap|\oarg{comment}\marg{suggested removal}\marg{suggested insertion}
%
%
% This will work as the union of a removal and a suggestion. Actually, both are simplified forms of this command.
%
% For example:
%
% \begin{verbatim}
% \cwauthorswap{This should work like this.}%
% {This is an example of how the command should work.}%
% The following text is not a suggestion.
%\end{verbatim}
%
%
% generates:
%
% \cwauthorswap{This should work like this.}%
% {This is an example of how the command should work.}%
% The following text is not a suggestion.%
%
%
%\subsection{Putting more warning in text}
%
% It is possible to define a symbol, or any other thing, to appear
% before the superscript number that indicates the comment.
%
% This is done using \DescribeMacro{\cwsetcommwarn} the following command
% and syntax:
%
% |\cwsetcommwarn|\marg{symbol}
%
% Using package |marvosym|, the example:
%
% |\cwsetcommwarn{\Lightning}|
% \cwsetcommwarn{\Lightning}
%
% will change the behavior of editorial\xexeo{This comment superscript number should be preceeded by a \Lightning} comments to include the \Lightning\  symbol.
%
% You can remove the symbol by simply using |\cwsetcommwarn{}|
%
% \cwsetcommwarn{}
%
% It should be clear that |coop-writing| does not provide any font for these symbols. If
% users want to use a certain font, like |marvosym|, they  import it with |\usepackage|.
%
%\subsection{A tip for using comments}
%
% A student asked me to give a priority to my demands. This would
% make me add yet another set of commands, with more arguments.
% labels don't work because they must be unique to allow for being used as
% references.
%
% The solution, however, is simple, special characters, such as $\star$, |$\star$|
% can be used and are highly efficient to communicate
% priority\xexeo{$\star\star$ Two stars are still low priority}.
%
% Using other fonts, more can be acomplished. For example, package
%|marvosym| offers |\HollowBox|, \HollowBox,
%|\Checkedbox|, \Checkedbox,
%|\CrossedBox|, \CrossedBox, which can be
% used to indicate that something should be done, is done or will not be
% done.
%
%\section{Anonymization}
%
% Anonymization will provide commands to replace
% names and references by anonymous names and references.
% It will, by default, be enable only in the |submit| option
%
% There are 4 anonymization commands:
%
% \begin{itemize}
%   \item |\cwanon|\marg{text} \DescribeMacro{\cwanon}
%   \item |\cwanoncite|\oarg{cite-compatible-oarg}\marg{cite-compatible-arg} \DescribeMacro{\cwanoncite}
%   \item |\cwanoncitet|\oarg{citet-compatible-oarg}\marg{citet-compatible-arg} \DescribeMacro{\cwanoncitet}
%   \item |\cwanoncitep|\oarg{citep-compatible-oarg}\marg{citep-compatible-arg} \DescribeMacro{\cwanoncitep}
%\end{itemize}
%
% The alternative text used by anonymization commands can be configured with other commands:
%\begin{itemize}
%    \item |\cwdefanontext|\marg{replacement-text} \DescribeMacro{\cwdefanontext}
%    \item |\cwdefanoncitetext|\marg{replacement-text} \DescribeMacro{\cwdefanoncitetext}%
%    \item |\cwdefanoncitettext|\marg{replacement-text} \DescribeMacro{\cwdefanoncitettext}
%\item|\cwdefanonciteptext|\marg{replacement-text} \DescribeMacro{\cwdefanonciteptext}
%\end{itemize}
%
% The example:
%
% \begin{verbatim}
% My name is \cwanon{Geraldo Xexéo}, and I read \cwanoncite{ed},
% \cwanoncitep[pags 1]{todonotes}, % \cwanoncitet{xcolor}.
% \end{verbatim}
%
% generates:
%
% My name is \cwanon{Geraldo Xexéo}, and I read \cwanoncite{ed},
% \cwanoncitep[pags 1]{todonotes}, % \cwanoncitet{xcolor}.
%
% Changing values, as in:
%
% \begin{verbatim}
% \cwdefanontext{Can't say}
% \cwdefanoncitetext{[0]}
% \cwdefanonciteptext{[X]}
% \cwdefanoncitettext{[Anon]}
% My name is \cwanon{Geraldo Xexéo}, and I read \cwanoncite{ed},
% \cwanoncitep[pags 1]{todonotes}, % \cwanoncitet{xcolor}.
% \end{verbatim}
% generates:
%
% \cwdefanontext{Can't say}
% \cwdefanoncitetext{[0]}
% \cwdefanonciteptext{[X]}
% \cwdefanoncitettext{[Anon]}
% My name is \cwanon{Geraldo Xexéo}, and I read \cwanoncite{ed},
% \cwanoncitep[pags 1]{todonotes}, % \cwanoncitet{xcolor}.
%
%
%\section{Draft environment}
%
% \DescribeEnv{cwdraft}
% The |cwdraft| environment aims to allow writers to include text that is marked somehow as a draft\footnote{This was motivated because my students liked to hide text from me because ``it was only a draft'', but I need to have some way to measure if they were advancing. Marking text as a draft allowed them to be free of the fear of showing errors to me. I see it most as a psychological support to writing without fear of making mistakes. And, yes, you can still use footnotes and they will be correcly numbered}
%
% This environment is evolving, looking for a good way to signal the draft status, due to the different interactions with the packages it uses and user's packages.
% It has one optional parameter that names the draft. Its default value is ``Draft''
% If the |draft| option is not enabled, the text inside the title and the text inside the environment will not appear. The user should remember that some options will automatically turn on the |draft| option, such as the option |editing|.
%
% The color of the title highlight can be changed with
%% \DescribeMacro{\cssetdraftcolor}
%
% |\cssetdraftcolor|\marg{color}
%
% The example:
%
%\begin{verbatim}
%\begin{cwdraft}[A draft title]
%This is the example of a draft.
%The title must be highlighted
%There must be a box around it.
%\end{cwdraft}
%
%\cwsetdraftcolor{blue}
%\begin{cwdraft}
%This draft has the default title.
%\end{cwdraft}
%\end{verbatim}
%
% generates:
%
%\begin{cwdraft}[A draft title]
% This is the example of a draft.
%
% The title must be highlighted
%
% There must be a box around it.
%\end{cwdraft}
%
%\cwsetdraftcolor{blue}
%\begin{cwdraft}
% This draft has the default title.
%\end{cwdraft}%
%
%
%\section{Subjects}
%
% \DescribeMacro{\cwsubject}
% \DescribeMacro{\cwmain}
%
% |\cwsubject|\oarg{color}\marg{text}
%
% These are alternatives supposed to help organizing a text.
%
% |\cwsubject| provides a header or title for a paragraph.
%
% |\cwmain| provides an emphasis (yellow highlight by default) for any text. It should be used in the main message of the paragraph
%
% The idea here is that each paragraph should be about one and only one subject,
% and that reading these paragraph title will allow the authors to better understand
% what is being written and in which sequence.
%
% This feature was inspired by \citet{minto2009pyramid}.
%
% The example:
%
%\begin{verbatim}
% \cwsubject{Example of a subject}
% A subject is the main subject of a paragraph
%
% \cwsubject[pink]{A pink colored subject}
% You can use other colors, such as pink.
%
% \cwsetsubjectcolor{cyan}
% \cwsubject{All subjects will be cyan.}
% You can use other colors, such as pink.
%\end{verbatim}
%
%
% generates:
%
% \cwsubject{Example of a subject}
% A subject is the main subject of a paragraph
%
% \cwsubject[pink]{A pink colored subject}
% You can use other colors, such as pink.
%
% \cwsetsubjectcolor{cyan}
% \cwsubject{All subjects will be cyan.}
% You can use other colors, such as pink.
%
% While the example:
%
%\begin{verbatim}
% \cwmain{This is the main idea}. This is the explanation. These are examples.
%
% \cwmain[pink]{This is another main idea}. This is the explanation. These are examples.
%
% \cwsetmaincolor{cyan}
% \cwmain{This is the main idea}. This is the explanation. These are examples.
%\end{verbatim}
%
% generates:
%
% \cwmain{This is the main idea}. This is the explanation. These are examples.
%
% \cwmain[pink]{This is another main idea}. This is the explanation. These are examples.
%
% \cwsetmaincolor{cyan}
% \cwmain{This is the main idea}. This is the explanation. These are examples.
%
% Intentionally, entries in |\cwsubject| and |\cwmain| go both for the list of
% subjects, since users should use one or another for each paragraph.
%
%\subsection{Reconfiguring the behavior of \texttt{cwmain}}
%
% It is possible to reconfigure partially the behavior of |\cwmain| by
% using the standard \LaTeX\ macro |\renewcommand| on the command |\cwmainemphasis|.
%
% Its standard definition is:
%
% |\newcommand{\cwmainemphasis}[1]{\hl{#1}}|
%
% And this will highlight it with the current highlight color, which can be easily defined with |\cwsetmaincolor|.
%
% However, suppose if you want the text to be in bold, you must redefine this
% command, like in:
%
% |\renewcommand{\cwmainemphasis}[1]{\textbf{#1}}|
%
% This is easy to do, but an error can always cause mayhem.
%
% Therefore, the example:
%
%\begin{verbatim}
% \renewcommand{\cwmainemphasis}[1]{\textbf{#1}}
% \cwmain{This is the main idea}. This is the explanation. These are examples.
%\end{verbatim}
%
% generates.
%
% \renewcommand{\cwmainemphasis}[1]{\textbf{#1}}
% \cwmain{This is the main idea}. This is the explanation. These are examples.
%
% \renewcommand{\cwmainemphasis}[1]{\hl{#1}}
% \cwsetmaincolor{yellow}
% \cwsetsubjectcolor{green}
%
% \section{Lists}
%
% \DescribeMacro{\listofcomments}
% \DescribeMacro{\listofcitationneeds}
% \DescribeMacro{\listofsubjects}
% Comments, citation demands and subjects can be list with these commands.
%
% The lists will only appear if their commands are enable (or in the all-enabling editing option).
%
% They are usually put in the end of the file.
%
% \section{To dos}
%
% The |todo| command \DescribeMacro{\todo} is a much simpler version than
% the one available in |todonotes|\xexeo{But it will grow in power with time}. It´s syntax is:
%
% |\todo|[inline]\marg{text}
%
% A todo without a inline option is equivent to a comment of
% author ``To do''\todo{This is how it works without the inline option}. With the option, the text will appear inside an orange box, as in the example below.
%
%
% The example:
%
%\begin{verbatim}
% \todo[inline]{This command can have other options,
%based on other implementations of to do in different packages.}
%\end{verbatim}
%
% generates:
%
% \todo[inline]{This command can have other options, based on other implementations of to do in different packages}.
%
% It is possible to change the background color of the box using this macro \DescribeMacro{\cwdefinetodocolor}.
% The idea, however, is that all to-dos should have the same color.
%
%  |\cwdefinetodocolor|\marg{color}.
%
%
%
% The example:
%
%\begin{verbatim}
% \cwdefinetodocolor{yellow}
% \todo[inline]{This command can have other options,
%based on other implementations of to do in different packages.}
%\end{verbatim}
%
% generates:
%
% \cwdefinetodocolor{yellow}
% \todo[inline]{This command can have other options,
% based on other implementations of to do in different packages.}
%
%
%
% \section{Language Support}
%
% This style supports the following |babel| defined languages:
% \begin{itemize}
%    \item brazil,
%    \item brazilian,
%    \item portuguese, and
%    \item english.
%\end{itemize}
%
% \DescribeMacro{\cwcommentstitle}
% \DescribeMacro{\cwdrafttitle}
% \DescribeMacro{\cwsubjtitle}
% \DescribeMacro{\cwcitationstitle}
% \DescribeMacro{\cwpleasecitetext}
% \DescribeMacro{\cwpleasecitemessage}
% \DescribeMacro{\cwpleasecitemarginnote}
%% To use other language, or to use other texts instead of the standard ones, you should define these macros, as in:
%
%    |\def\cwdrafttitle{Draft}|%
%
%    |\def\cwcommentstitle{List of Comments}|%
%
%    |\def\cwsubjtitle{List of Subjects}|%
%
%    |\def\cwcitationstitle{List of Citation Needs}|%
%
%    |\def\cwpleasecitetext{Plese cite}|%
%
%    |\def\cwpleasecitemessage{something to support this information}|%
%
%    |\def\cwpleasecitemarginnote{Cite}|%
%
%
%\section{Warnings}
% This package uses another package that changes \LaTeX's standard behavior for summary and lists. When you use it, you must explicitly change pages with |\newpage|
% before |\tableofcontents| or similar commands.
%
%
% \section{The commands in Portuguese}
% This section is in Brazilian Portuguese.
%
%\selectlanguage{brazilian}
% A Tabela \ref{tab:e2p} Mostra o mapeamento em inglês e português.
%
% \begin{table}[htb]
% \caption{Tradução dos comandos para português.}
%\begin{tabular}{ccc}
%    \hline
%    Tipo & Inglês & Português \\
%    \hline
%    environment & |cwdraft| &|rascunho|\\
%    macro & |\cwnamedef| &|\cwautor|  \\
%    macro & |\cwsubject| & |\cwassunto|\\
%    macro & |\listofcomments| & |\listofcomentario|\\
%    macro & |\listofsubjects| & |\listofassunto|\\
%    macro & |\listofcitationneeds| & |\listofcomentarioref|\\
%    macro & |\todo| & |\todo| \\
%    \hline
%\end{tabular}
% \label{tab:e2p}
% \end{table}
%
% \subsection{Opções em Português}
%
% As seguintes opções são aceitas em português, todas sem acentos ou cedilha: anonimizar, naoanonimizar, rascunhos, assuntos, comentarios, edicao, submeter, publicar, sugestoes, publicaraceitando.
%\selectlanguage{english}
%\section{Comparision with other packages}
%
% It is interesting to compare this package with other 3:
% \begin{itemize}
%    \item |ed| has more features for commenting, and is more configurable, however it does not have colors.
% \item |todonotes| it does not have the identification of the commentator, which must be put by hand. It has more options too.
% \item |color-edits| does not support to do notes and drafts.
% \end{itemize}
%
%
% \section{Interaction with other packages}
%
% This packages uses other packages, and this can cause
% interaction with them and even other packages. \LaTeX\  is
% a harsh mistress.
%
% |tocloft| seems to be the main agressor and it is a candidate
% to be removed, since its function in the code is mostly
% secondary, generate lists of the comments, etc.
%
% |tocloft| interacts with |memoir|. At this point, I
% blame |memoir|, since it \textbf{emulates} |tocloft|,
% but change syntax and behavior. This is a crazy idea
% for me, and show the need for namespaces in \LaTeX.
%
% |tocloft| also interacts with |coppe|, the class for the
% CoppeTeX package, which I am one of the mainteiners,
% both redefine LoF and LoT. More IFs, that detect
% coppe and turn on |titles| option in |tocloft|, and
% a new option |toclofttitles| to solve the general problem
% of |tocloft| changing LoF and LoT definitions.
%
% \StopEventually{End of Code}
%
% \section{Implementation}
% This package was initially written in Portuguese. As it become more
% useful, it was translated to English. There are still some signs
% of this in the code.
%
% \subsection{Access to the current version}
% We provide some macros for the user to know the version being used.
% \begin{macro}{\coopwritingversion}
% Provides current version of coop-writing
%    \begin{macrocode}
\newcommand{\coopwritingversion}{\cw@version}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\printcoopwritingversion}
% Provides package name and version
%    \begin{macrocode}
\newcommand{\printcoopwritingversion}{coop-writing v. \coopwritingversion}%
%    \end{macrocode}
% \end{macro}
%%
%%
% \subsection{Option Processing}
% \subsubsection{Creating Options Variables used in ed}
% Some come from ed code and are being cleaned
% \label{code:option}
%    \begin{macrocode}
\newif\ifshowednotes\showednotestrue%
\newif\ifmargins\marginstrue%
\newif\ifednotebookmarks\ednotebookmarkstrue%
% \subsubsection{Creating Original Options Variables}
\newif\if@showcomentario\@showcomentariofalse%
\newif\if@naoanonimizar\@naoanonimizarfalse%
\newif\if@showdraft\@showdraftfalse%
\newif\if@showsubjects\@showsubjectsfalse%
\newif\if@showsugestao\@showsugestaofalse%
\newif\if@beanonymous\@beanonymousfalse%
\newif\if@showtodo\@showtodofalse%
\newif\if@modoedicao\@modoedicaofalse%
\newif\if@modosubmeter\@modosubmeterfalse%
\newif\if@modopublicar\@modopublicarfalse%
\newif\if@modopublicaraceitando\@modopublicaraceitandofalse%
\newif\if@cwtoclofttitles\@cwtoclofttitlesfalse
%    \end{macrocode}
% \subsubsection{Portuguese Options}
%    \begin{macrocode}
\DeclareOption{rascunhos}{\@showdrafttrue}
\DeclareOption{comentarios}{\@showcomentariotrue}
\DeclareOption{anonimizar}{\@beanonymoustrue}
\DeclareOption{naoanonimizar}{\@naoanonimizartrue}
\DeclareOption{sugestoes}{\@showsugestaotrue}
\DeclareOption{assuntos}{\@showsubjectstrue}
\DeclareOption{edicao}{\@modoedicaotrue}
\DeclareOption{submeter}{\@modosubmetertrue}
\DeclareOption{publicar}{\@modopublicartrue}
\DeclareOption{publicaraceitando}{
    \@modopublicartrue
    \@modopublicaraceitandotrue
}
%    \end{macrocode}
% \subsubsection{English Options, inspired on ed package}
%    \begin{macrocode}
\DeclareOption{nopdfbookmarks}{\ednotebookmarksfalse}
%    \end{macrocode}
%
% \subsubsection{Original English Options}
%
%    \begin{macrocode}
\DeclareOption{comments}{\@showcomentariotrue}
\DeclareOption{anonymize}{\@beanonymoustrue}
\DeclareOption{noanonymize}{\@naoanonimizartrue}
\DeclareOption{suggestions}{\@showsugestaotrue}
\DeclareOption{subjects}{\@showsubjectstrue}
\DeclareOption{drafts}{\@showdrafttrue}
\DeclareOption{todos}{\@showtodotrue}
\DeclareOption{editing}{\@modoedicaotrue}
\DeclareOption{submit}{\@modosubmetertrue}
\DeclareOption{publish}{\@modopublicartrue}
\DeclareOption{acceptingpublish}{
    \@modopublicartrue
    \@modopublicaraceitandotrue
}
%    \end{macrocode}
% New option to titles in tocloft
%    \begin{macrocode}
\DeclareOption{toclofttitles}{\@cwtoclofttitlestrue}
\ProcessOptions\relax
%    \end{macrocode}
% \subsubsection{Fixing the Super Options}
%    \begin{macrocode}
\if@modoedicao
\@showsubjectstrue
\@showdrafttrue
\@showcomentariotrue
\@showsugestaotrue
\@beanonymoustrue
\@showtodotrue
\fi
\if@modosubmeter
\@showsubjectsfalse
\@showdraftfalse
\@showcomentariofalse
\@showsugestaofalse
\@beanonymoustrue
\@showtodofalse
\fi
\if@naoanonimizar
\@beanonymousfalse
\fi
\if@modopublicar
\@showsubjectsfalse
\@showsugestaofalse
\@showdraftfalse
\@showcomentariofalse
\@beanonymousfalse
\@showtodofalse
\fi%
\if@showtodo
\@showcomentariotrue
\fi
%    \end{macrocode}
% \subsection{Required Packages}
% Packages that are always required
%\begin{itemize}
%    \item xcolor - used to support colors
%    \item soulutf8 - this is a variation of soul, used for highlighting
% \item ulem - used to support strikethrought\todo{I must complete this explanation list}
% \item tocloft - used to support modifications in lists and tocs
% \item mdframed - used to support boxes for todos and drafts
% \item iflang - used to check if language is loaded and define new words not in Babel
%\end{itemize}
%    \begin{macrocode}
\RequirePackage{xcolor}
\RequirePackage{soulutf8}
\RequirePackage[normalem]{ulem}
\RequirePackage{etoolbox}
\RequirePackage{environ}
\RequirePackage{xstring}
\RequirePackage{csquotes}
\RequirePackage{mdframed}
%    \end{macrocode}
% \subsection{Optional Packages}
% Package that are required only sometimes
%    \begin{macrocode}
\ifshowednotes%
\else%
\RequirePackage{verbatim}%
\fi%
%    \end{macrocode}
% \subsection{CoppeTeX problems}
% tocloft and CoppeTeX have different assumptions whether
% LoF, LoT and etc... appears in ToC. In default Book, they
% do not appear
%    \begin{macrocode}
\@ifclassloaded{coppe}%
{%
\RequirePackage[titles]{tocloft}%
}%
{%
\if@cwtoclofttitles%
\RequirePackage[titles]{tocloft}%
\else%
\RequirePackage{tocloft}%
\fi%
}%
%    \end{macrocode}
% Checking if babel is loaded, use iflang
%    \begin{macrocode}
\@ifpackageloaded{babel}%
{%  \message{Babel Loaded!}%
    \RequirePackage{iflang}%
}{%
    \message{Babel not detected!}%
}%
%    \end{macrocode}
% |hyperref| must always be the last
%    \begin{macrocode}
\ifednotebookmarks\RequirePackage{hyperref}\fi
%    \end{macrocode}
%
% \subsection{Solving problems with other packages}
%
% \subsubsection{Problems with \texttt{abntex2} and \texttt{memoir}}
%
% |abntex2| causes error in |\newlistof|, you
% can't refer to |chapter|, |section| or other counter
% as optional argument
%
% This error is actually |memoir| fault\pleasecite[memoir package], since it emulates
% |tocloft| (and other packages). I can´t imagine why...
%
% Therefore, we will avoid using the command with option
% when the class is present
%
%    \begin{macrocode}
\@ifclassloaded{memoir}%
{% TRUE
\newif\if@cwmemoirdefense\@cwmemoirdefensetrue%
}%
{% FALSE
\newif\if@cwmemoirdefense\@cwmemoirdefensefalse%
}%
%
%    \end{macrocode}
%
% \subsection{Color related variables}
%    \begin{macrocode}
\newcommand{\cor@prof}{red}%
\newcommand{\cor@cand}{blue}%
\newcommand{\cor@subject}{green}%
\newcommand{\cor@main}{yellow}%
\newcommand{\cor@citar}{purple}%
\newcommand{\cor@hldraft}{yellow}%
\newcommand{\cw@cftnumwidth}{20pt}
%    \end{macrocode}
%
% \subsection{I18N Almost Using Babel}
% We can detect if babel is enable and allow for some languages.
% If you want to use another language, you must set new values
% for the command |\cwdrafttitle|.
% I really thought that it was possible to do something smarter with babel, for example using |\setlocalecaption|, but no attempt worked out as I wanted.
%
% There are some packages, as |translator| that can be useful
% but up to now this seems to be the easiest way of doing it.
%
% The advantage of this way is that any user can |\renewcommand{\cwdrafttitle}{some text}|.
%    \begin{macrocode}
\def\cwdrafttitle{Standard Draft}%
\def\cwcommentstitle{Standard List of Comments}%
\def\cwsubjtitle{Standard List of Subjects}%
\def\cwcitationstitle{Standard List of Citation Needs}%
\def\cwpleasecitetext{Plese cite}%
\def\cwpleasecitemessage{something to support this information}%
\def\cwpleasecitemarginnote{Cite}%
%
\@ifpackageloaded{babel}%
{%
    \IfLanguageName{brazil}%
    {%
    \def\cwdrafttitle{Rascunho}%
    \def\cwcommentstitle{Lista de Comentários}%
    \def\cwsubjtitle{Lista de Assuntos}%
    \def\cwcitationstitle{Necessidades de Citação}%
    \def\cwpleasecitetext{Favor citar}%
    \def\cwpleasecitemessage{alguma coisa que suporte este texto}%
    \def\cwpleasecitemarginnote{Citar}%
    }{}%
    \IfLanguageName{brazilian}%
    {%
        \def\cwdrafttitle{Rascunho}%
        \def\cwcommentstitle{Lista de Comentários}%
        \def\cwsubjtitle{Lista de Assuntos}%
        \def\cwcitationstitle{Necessidades de Citação}%
        \def\cwpleasecitetext{Favor citar}%
        \def\cwpleasecitemessage{alguma coisa que suporte este texto}%
        \def\cwpleasecitemarginnote{Citar}%
    }{}%
%
    \IfLanguageName{portuguese}%
    {%
        \def\cwdrafttitle{Rascunho}%
        \def\cwcommentstitle{Lista de Comentários}%
        \def\cwsubjtitle{Lista de Assuntos}%
        \def\cwcitationstitle{Necessidades de Citação}%
        \def\cwpleasecitetext{Favor citar}%
        \def\cwpleasecitemessage{alguma coisa que suporte este texto}%
        \def\cwpleasecitemarginnote{Citar}%
    }{}%
%
    \IfLanguageName{english}%
    {%
        \def\cwdrafttitle{Draft}%
        \def\cwcommentstitle{List of Comments}%
        \def\cwsubjtitle{List of Subjects}%
        \def\cwcitationstitle{List of Citation Needs}%
        \def\cwpleasecitetext{Plese cite}%
        \def\cwpleasecitemessage{something to support this information}%
        \def\cwpleasecitemarginnote{Cite}%
    }{}%
}%
{}%
%    \end{macrocode}
% \subsection{ed inspired code}
% This code, inspired in the |ed| package\favorcitar[ed package], makes the basic mechanism for
% inserting comments as footnotes with an observation in the margin.
% As an adition to |ed|, it support colors and some text
% before the superscript number in the text
% \begin{macro}{cwnotecounter}
% Setting up the counter that gives the number of the footnote
%    \begin{macrocode}
\newcounter{cwnotecounter}%
%    \end{macrocode}
% \end{macro}
% \subsubsection{The footnote}
% Format for the text
%    \begin{macrocode}
\newcommand\cw@noteshape{\sffamily}%
%    \end{macrocode}
% Defining the variable that holds the color to be printed.
% |soul| made it quite complex, global variable is not the best programming technique, but it works.
%    \begin{macrocode}
\def\cw@currentcolor{black}%
%    \end{macrocode}
%% footnote indicador e rótulo
% \begin{macro}{\cw@foot}
%
% This macro write the text in the footnote using with standard \LaTeX\ |\footnotetext|
%
% It uses counter |cwnotecounter| in arabic.
% It prints the footnote using the currently defined color (That is a global variable, setted up elsewehre. This is not good programming practice,
% but it turned out to be the easiest way of doing it in \LaTeX without more and more arguments.)
%
% Syntax: |\cw@foot|\marg{footnote-text}\marg{author-name}\marg{label}
%
%
% If this is a labeled note, it will create a \LaTeX label on the format
%
% |cw:|\meta{label}
%
% That can be used in a |\ref| command.
%
%    \begin{macrocode}
\newcommand\cw@foot[3]%
{%
\def\@test{#3}% @test just checks if argument #3 exists
\footnotetext[\arabic{cwnotecounter}]%
{%
{\scshape{\textcolor{\cw@currentcolor}{#2}}%
\if\@test%
\@empty%
\else%
\label{cw:#3}%
\textcolor{\cw@currentcolor}{[#3]}% if \meta{label} is not empty
\fi%
\textcolor{\cw@currentcolor}{:}}%
\cw@noteshape\textcolor{\cw@currentcolor}{#1}}%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\cw@mark}
% This macro generates the footnote mark with standard \LaTeX\
% |\footnotemark|
%    \begin{macrocode}
\def\cw@mark@style#1{#1}%
\newcommand\cw@mark[1]{\cw@mark@style{\footnotemark[#1]}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\cw@beforemarksymbol}
% \begin{macro}{\cwsetcommwarn}
%
%  These macros control the symbol (or any text) that can
%  appear before the footnotemark
%
%  |\cwsetcommwarn|\marg{symbol}
%
%  \meta{symbol} can be of any length, but we suggest only one
% character. It can be empty, what is the default option,
% and will print nothing at that point.
%
%    \begin{macrocode}
\newcommand{\cw@beforemarksymbol}{}%
\newcommand{\cwsetcommwarn}[1]{\def\cw@beforemarksymbol{#1}}%
%    \end{macrocode}
%
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cw@footnote}
%
% This macro actually makes the footnote symbol, mark and text
%
% Syntax is:
%
% |\cw@footnote|\marg{text}\marg{name}\marg{label}
%
% \meta{label} can be empty, but must be present
%
% It is in this macro that symbol, number and footnote mark
% end up in the document.
%
% This command also changes the color of footnote mark
% WARNING: it does that by redefining |\@makefnmark|,
% however this interferes with normal
% \LaTeX\ operation. Therefore we save and
% restore the original value.
%
% Whe change the |\@makefnmark| to a slighter
% different version that includes color, that
% is controled by a ``global'' is a variable of
% coop-writing, even if is not global in the
% |\gdef| sense.
%
% It is possible that this cause, in a style that
% changes the footnote, some difference between
% coop-writing footnotes and normal (style) footnotes.
% This is not bad necessarily, it can even be good.
%
%
%    \begin{macrocode}
\newcommand\cw@footnote[3]{%
\let\@temp@makefnmark\@makefnmark%
\def\@makefnmark{\hbox{\@textsuperscript{\normalfont\color{\cw@currentcolor}\@thefnmark}}}%
\textcolor{\cw@currentcolor}{\cw@beforemarksymbol\cw@mark{\arabic{cwnotecounter}}}%
\cw@foot{#1}{#2}{#3}%
\let\@makefnmark\@temp@makefnmark%
}%
%    \end{macrocode}
% \end{macro}
% \subsubsection{The margin note}
%
% This macro builds the margin note.
%
%    \begin{macrocode}
\newcommand\cw@margin[1]{%
\ifmargins%
\marginpar{\textcolor{\cw@currentcolor}{#1}}%
\fi%
}%
%    \end{macrocode}
% \begin{macro}{\Cw@note}
% Basic function to build the comment
%
% |\Cw@note|\marg{text}\marg{name}\marg{label}
%
% If not label, it must be empty
%
%
%    \begin{macrocode}
\newcommand\Cw@note[3]% text, name, label
{%
\addtocounter{cwnotecounter}{1}%
\ifshowednotes%
\cw@footnote{#1}{#2}{#3}%
\ifednotebookmarks%
\belowpdfbookmark{#2: #1}{cwnotepdfbm.\thecwnotecounter}%
\fi%
\fi}%
%    \end{macrocode}
% \end{macro}
% More functions for doing the editorial note
%    \begin{macrocode}
\newcommand\cw@note[4]% text, type, label, margin
{\Cw@note{#1}{#2}{#3}%
\ifshowednotes%
\cw@margin{#4:\arabic{cwnotecounter}}%
\fi}%
\newcommand\cwnote@label{Editor}%
\newcommand\cwnote@margin{Ed}%
\newcommand\cwnotelabel[1]{\def\cwnote@label{#1}}%
\newcommand\cwnotemargin[1]{\def\cwnote@margin{#1}}%
\newcommand{\Cwnote}[2][]{\Cw@note{#2}\cwnote@label{#1}}%
%    \end{macrocode}
%
%
% \begin{macro}{\cwnote}
%
%  It writes the footnote, the symbol and the
% margin.
%
%  To avoid problems we keep |\cw@currentcolor|
%
% WARNING: will this use a lot of memory? Every
% creation will keep the old value alive?
%
%    \begin{macrocode}
\newcommand{\cwnote}[3][]{%
\let\@temp@color\cw@currentcolor%
\def\cw@currentcolor{#3}%
\cw@note{#2}%
\cwnote@label{#1}%
\cwnote@margin%
\let\cw@currentcolor\@temp@color%
}%
%    \end{macrocode}
%\end{macro}
%%%https://tex.stackexchange.com/questions/30483/how-can-i-check-in-latex-or-plain-tex-whether-a-command-exists-by-name
%% as opções comentario, assuntos e anonimizar
%% CORES
% \begin{macro}{\corleve}
% Make a color lighter for later use in highlightings
% This code is more complex than it shuould be because o |soulutf8|'s package |\hl| behavior. Solution found in:
% \url{https://tex.stackexchange.com/questions/410295/soul-color-transparency}
%    \begin{macrocode}
\newcommand{\cor@suavizacao}{40}%
\newcommand{\corleve}[1]{#1!\cor@suavizacao!white}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\cw@hll}
% Light highlight makes a |\hl| that is lighter
%    \begin{macrocode}
\newcommand{\cw@hll}[2]% % Depedendo do soulutf8
{\colorlet{x@coraqui}{\corleve{#1}}%
\sethlcolor{x@coraqui}%
\hl{#2}%
}%
%    \end{macrocode}
% \end{macro}
% Isolating cwnote
%    \begin{macrocode}
%% rótulo texto cor indicador
\newcommand{\cw@cwnote}[4][]{%
\cwnotelabel{#4}%
\cwnotemargin{#4}%
\cwnote[#1]{#2}{#3}%
}%
%    \end{macrocode}
% \subsection{Anonymization}
% Will write anonymous or cite anonymous.
% The user has a way to configure the citation as he or she wants.
% \begin{macro}{\cw@anontext}
% \begin{macro}{\cw@anoncitetext}
% \begin{macro}{\cw@anonciteptext}
% \begin{macro}{\cw@anoncitettext}
%
% Default values for anonymous citation.
%
%    \begin{macrocode}
%
\newcommand{\cw@anontext}{Anonymous}
\newcommand{\cw@anoncitetext}{(Anonymous, Year)}%
\newcommand{\cw@anonciteptext}{(Anonymous, Year)}%
\newcommand{\cw@anoncitettext}{Anonymous (Year)}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\cwdefanontext}
% \begin{macro}{\cwdefanoncitetext}
% \begin{macro}{\cwdefanonciteptext}
% \begin{macro}{\cwdefanoncitettext}
% These macros allow to define how anonymous citations will appear is
% anonymous mode is activated. For exemplo, one can change all the
% citation formats to |[0]|.
%    \begin{macrocode}
\newcommand{\cwdefanontext}[1]{\renewcommand{\cw@anontext}{#1}}%
\newcommand{\cwdefanoncitetext}[1]{\renewcommand{\cw@anoncitetext}{#1}}%
\newcommand{\cwdefanonciteptext}[1]{\renewcommand{\cw@anonciteptext}{#1}}
\newcommand{\cwdefanoncitettext}[1]{\renewcommand{\cw@anoncitettext}{#1}}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%    \begin{macrocode}
\if@beanonymous
\newcommand{\cwanon}[1]{\cw@anontext}%
\newcommand{\cwanoncite}[2][]{\cw@anoncitetext}%
\newcommand{\cwanoncitep}[2][]{\cw@anonciteptext}%
\newcommand{\cwanoncitet}[2][]{\cw@anoncitettext}%
\else
\newcommand{\cwanon}[1]{#1}%
\newcommand{\cwanoncite}[2][]{\cite[#1]{#2}}%
\ifdef{\citep}{\newcommand{\cwanoncitep}[2][]{\citep[#1]{#2}}}{\newcommand{\cwanoncitep}[2][]{\citep[#1]{#2}}}%
\ifdef{\citet}{\newcommand{\cwanoncitet}[2][]{\citet[#1]{#2}}}{\newcommand{\cwanoncitet}[2][]{\citet[#1]{#2}}}%
\fi%|
%    \end{macrocode}
% \subsection{Subjects}
% The idea of subjects is to have one subject for each paragraph.
%
% There are two commands to support it:
%|\cwsubject|\oarg{highlight-color}\marg{subject}
%and
%|\cwmain|\oarg{highlight-color}\marg{line-inside-a-paragraph}
%
% Both are listed with |\listofsubject|.
%
%
% \begin{macro}{\cwsetsubjectcolor}
% \begin{macro}{\cwsetmaincolor}
% Sets color for all cwsubject and cwcolor
%    \begin{macrocode}
\newcommand{\cwsetsubjectcolor}[1]{\def\cor@subject{#1}}%
\newcommand{\cwsetmaincolor}[1]{\def\cor@main{#1}}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\cwsubject}
% Currently is just a list of subjects and and a highlight
%
%  \cwsubject{This is an use for cwsubject}
%   it is a header for a paragraph.
%
%
%    \begin{macrocode}
\if@showsubjects
\newcommand{\listsubject}{\cwsubjtitle}%
%% cria a lista, depende do pacoto tcloft
%    \end{macrocode}
% Memoir class needs 2 commands to really define a list
% It also changes the  |\newlistof| arguments' meaning
%    \begin{macrocode}
\if@cwmemoirdefense%
\@ifundefined{chapter}%
{\newlistentry[section]{subject}{aaa}{0}}
{\newlistentry[chapter]{subject}{aaa}{0}}
\newlistof{listofsubject}{aaa}{\listsubject}
\else%
\@ifundefined{chapter}%
{\newlistof[section]{subject}{aaa}{\listsubject}}%
{\newlistof[chapter]{subject}{aaa}{\listsubject}}%
\fi%
%
%
\newcommand{\cwsubject}[2][\cor@subject]{%
\refstepcounter{subject}%
\sethlcolor{#1}%
\hl{#2}%
\par%
% I really can´t say why we need to
% avoid curly braces in the next command
\if@cwmemoirdefense%
\addcontentsline{aaa}{subject}{\protect\numberline{\thesubject}#2}%
\else%
\addcontentsline{aaa}{subject}{\protect\numberline{\thesubject}{#2}}%
\fi%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\cwmain}
% This is another way to control the main idea for a paragraph, but using
% an sentence inside it.
%
%  \cwmain{This is a use for cwmain.} In the first sentence of a paragraph.
%
% Trying to configure it:
%
% \renewcommand{\cwmainemphasis}[1]{\hl{\textbf{#1}}}
% \cwsetmaincolor{pink}
%
% \cwmain{This is a use for cwmain.} In the first sentence of a paragraph.
%
%    \begin{macrocode}
\newcommand{\cwmainemphasis}[1]{\hl{#1}}
%
\newcommand{\cwmain}[2][\cor@main]{%
    \refstepcounter{subject}%
    \sethlcolor{#1}%
    \cwmainemphasis{#2}%
    \if@cwmemoirdefense%
    \addcontentsline{aaa}{subject}{\protect\numberline{\thesubject}#2}%
    \else%
    \addcontentsline{aaa}{subject}{\protect\numberline{\thesubject}{#2}}%
    \fi%
}%
%
\if@cwmemoirdefense%
\else%
\setlength{\cftsubjectnumwidth}{\cw@cftnumwidth}%
\fi%
\else%
\newcommand{\listofsubject}{}%
\newcommand{\cwsubject}[2][]{}%
\newcommand{\cwmain}[2][]{#2}
\fi%
%    \end{macrocode}
%
% \end{macro}
% \subsection{Editorial Comments}
% The main subject of this package
%    \begin{macrocode}
\if@showcomentario
%% Resolve a lista de comentários
\newcommand{\listcomentario}{\cwcommentstitle}%
%% cria a lista
\if@cwmemoirdefense%
\@ifundefined{chapter}%
{\newlistentry[section]{comentario}{ccc}{0}}
{\newlistentry[chapter]{comentario}{ccc}{0}}
\newlistof{listofcomentario}{ccc}{\listcomentario}%
\else%
\@ifundefined{chapter}
{\newlistof[section]{comentario}{ccc}{\listcomentario}}
{\newlistof[chapter]{comentario}{ccc}{\listcomentario}}%%
\fi%
%%
%% Comentador genérico - parte I
%% faz o cwnote e soma na lista
%% [rótulo], texto , cor, indicador
\newcommand{\cw@comentar}[4][]{%
\ifstrempty{#4}{%
% rótulo texto cor indicador
\cw@cwnote[#1]{#2}{#3}{Comentário}% faz a nota de rodapé do ed
\if@cwmemoirdefense%
\addcontentsline{ccc}{comentario}{\protect\numberline{\thecomentario}#2}%
\else%
\addcontentsline{ccc}{comentario}{\protect\numberline{\thecomentario}{#2}}%
\fi%
}%
{%
\cw@cwnote[#1]{#2}{#3}{#4}%
\if@cwmemoirdefense%
\addcontentsline{ccc}{comentario}{\protect\numberline{\thecomentario}#4: #2}%
\else%
\addcontentsline{ccc}{comentario}{\protect\numberline{\thecomentario}{#4: #2}}%
\fi%
}%
}%
%% comentador genérico, parte II
%% faz o highlight , soma o step e comenta
%% [texto hl] footnote cor indicator
\newcommand{\cw@comment}[4][]{%
\refstepcounter{comentario}% soma um ao contador
\cw@hll{#3}{#1}% ver subfunção de impressão com hl
\cw@comentar{#2}{#3}{#4}%
}%
%%
%%
\newcommand{\cw@xcomment}[4][]{%
\refstepcounter{comentario}% soma um ao contador
\cw@hll{#3}{#1}% ver subfunção de impressão com hl
\cw@comentar{\sout{#2}}{#3}{#4}%
}%
%%
%%
%% comentador genérico com rótulo
%% [texto hl] footnote cor  indicator rótulo
\newcommand{\cw@commentLabeled}[5][]{%
\refstepcounter{comentario}%
\cw@hll{#3}{#1}%
\cw@comentar[#5]{#2}{#3}{#4}%
}%
%%
%% [texto hl] footnote cor  indicator rótulo
\newcommand{\cw@xcommentLabeled}[5][]{%
\refstepcounter{comentario}%
\cw@hll{#3}{#1}%
\cw@comentar[#5]{\sout{#2}}{#3}{#4}%
}%
%%
\if@cwmemoirdefense%
\else%
\setlength{\cftcomentarionumwidth}{\cw@cftnumwidth}%
\fi%
\else
\newcommand{\cw@comentar}[4][]{}%
\newcommand{\listofcomentario}{}%
%% não pode perder o texto comentado
\newcommand{\cw@comment}[4][]{#1}%
\newcommand{\cw@commentLabeled}[5][]{#1}%
\newcommand{\cw@xcomment}[4][]{#1}
\newcommand{\cw@xcommentLabeled}[5][]{#1}%
\fi%|
%    \end{macrocode}
% \subsection{Suggestions, Removes and Changes}
%    \begin{macrocode}
%% comentário, cor, indicador, textovelho, cor velho, textonovo, cor novo
%% Em modo publicar coloca o textovelho
\if@showsugestao
\newcommand{\cw@gensug}[7][Uma proposta]{%
\textcolor{#5}{\sout{#4}}% CORRIGINDO AQUI
\textcolor{#7}{#6}%
\if@showcomentario%
\ifstrempty{#1}{}%
{\refstepcounter{comentario}%
\cw@comentar{#1}{#2}{#3}%% [rótulo], cor , footnote , indicador
}%
\fi%
}%% [rótulo], cor , footnote , indicador
\else%
\if@modopublicaraceitando
\newcommand{\cw@gensug}[7][]{#6}%
\else%
\newcommand{\cw@gensug}[7][]{#4}%
\fi%
\fi%
%    \end{macrocode}
% \subsection{Citations Needed}
% One common error of students is not to cite correctly.
% Citation errors are so common that I decided to provide the option to have an optional list just for them.
% They are enable together with commentaries, users can use them or not.
%    \begin{macrocode}
\if@showcomentario%
\newcommand{\listcomentarioref}{\cwcitationstitle}%
\if@cwmemoirdefense%
\@ifundefined{chapter}%
{\newlistentry[section]{comentarioref}{ccr}{0}}
{\newlistentry[chapter]{comentarioref}{ccr}{0}}
\newlistof{listofcomentarioref}{ccr}{\listcomentarioref}
\else%
\@ifundefined{chapter}%
{\newlistof[section]{comentarioref}{ccr}{\listcomentarioref}}
{\newlistof[chapter]{comentarioref}{ccr}{\listcomentarioref}}%
\fi%
\else%
\newcommand{\listofcomentarioref}{}%
\fi%
\if@showcomentario%
\newcommand{\cw@commentref}[3][]{%
\refstepcounter{comentarioref}%
\cw@hll{#3}{#1}%
\cw@cwnote{#2}{#3}{\cwpleasecitemarginnote}%
\if@cwmemoirdefense%
\addcontentsline{ccr}{comentarioref}{\protect\numberline{\thecomentarioref}#2}%
\else%
\addcontentsline{ccr}{comentarioref}{\protect\numberline{\thecomentarioref}{#2}}%
\fi%
}%
\if@cwmemoirdefense%
\else%
\setlength{\cftcomentariorefnumwidth}{\cw@cftnumwidth}%
\fi%
\else%
\newcommand{\cw@commentref}[3]{}%
\fi%
\if@showcomentario
%    \end{macrocode}
% \begin{macro}{\pleasecite}
% |\pleasecite|\oarg{footnote-text}
%    \begin{macrocode}

\newcommand{\pleasecite}[1][\cwpleasecitemessage]{%
\cw@commentref{\cwpleasecitetext\  #1}{\cor@citar}}%
\else%
\newcommand{\pleasecite}[1][]{}%
\fi%
%    \end{macrocode}
% \end{macro}
% \subsection{Draft}
% \begin{environment}{cwdraft}
% This enviroment creates a boxed text, with title used as a first parameter
% It uses package |mdframed| to create the frame.
% If draft is turned off as an option, it supress everything inside the body.
% Due to problems with soul accepting |\cwdrafttitle| we use
% |\colorbox| to support multiple languages if default title is
% used
%    \begin{macrocode}
\if@showdraft%
\NewEnviron{cwdraft}[1][]{%
\ifstrempty{#1}%
{\colorbox{\corleve{\cor@hldraft}}{\textbf{\cwdrafttitle}}}%
{\cw@hll{\cor@hldraft}{\textbf{#1}}}%
\newline%
\BODY%
}%
{}%
\surroundwithmdframed{cwdraft}%
\else%
\NewEnviron{cwdraft}[1][]{}{}%
\fi%
%    \end{macrocode}
% \begin{macro}{\cwsetdraftcolor}
% Sets the color that highlights the draft title
%
%    \begin{macrocode}
%
\newcommand{\cwsetdraftcolor}[1]{\def\cor@hldraft{#1}}
%
%    \end{macrocode}
% \end{macro}
% \end{environment}
% \subsection{Powerful command to create editors and authors}
% This allows for many types of comments. This was the reason I started
% using a front-end to |ed|, and later decided to use colors, that |ed| dones not support.
% If I had known of |color-edits|, maybe this package was never done. I actually implemented the same functionalities without knowing about that package. One day, looking for other editorial packages that used editorial symbols, I found |color-edits|, but it was too late, I was already hooked on \LaTeX\  programming addiction.
%% nome do autor, cor, identificador
% \begin{macro}{\cwnamedef}
%    \begin{macrocode}
\newcommand{\cwnamedef}[3]{%
%% cwcomment - texto a hl, cor, comentário, indicador de pessoa
\expandafter\newcommand\csname#1\endcsname[2][]%
{%
\cw@comment[##1]{##2}{#2}{#3}}%
% [texto a marcar], cor , comentário, palavra, rótulo
\expandafter\newcommand\csname#1r\endcsname[3][]%
{\cw@commentLabeled[##1]{##2}{#2}{#3}{##3}}%
%% cortados
\expandafter\newcommand\csname#1x\endcsname[2][]%
{%
%% Comentários
\cw@xcomment[##1]{##2}{#2}{#3}}%
%% [texto a marcar], cor , comentário, palavra, rótulo
\expandafter\newcommand\csname#1rx\endcsname[3][]%
{\cw@xcommentLabeled[##1]{##2}{#2}{#3}{##3}}%
%% sugestões
\expandafter\newcommand\csname#1sug\endcsname[2][]%
{\cw@gensug[##1]{#2}{#3}{}{#2}{##2}{#2}}%
\expandafter\newcommand\csname#1rem\endcsname[2][]%
{\cw@gensug[##1]{#2}{#3}{##2}{#2}{}{#2}}
\expandafter\newcommand\csname#1troca\endcsname[3][]%
{\cw@gensug[##1]{#2}{#3}{##2}{#2}{##3}{#2}}%
\expandafter\newcommand\csname#1swap\endcsname[3][]%
{\cw@gensug[##1]{#2}{#3}{##2}{#2}{##3}{#2}}%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\cwauthor}
% \begin{macro}{\cweditor}
% These are the two standard users.
%    \begin{macrocode}
\cwnamedef{cwauthor}{red}{Author}
\cwnamedef{cweditor}{blue}{Editor}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \subsection{To do notes}
% This was developed because some of my students started a text using |todonotes|, before being aware of my package, therefore I need to have some compatibility to make de change. With time it became useful and I will try to make something better in the future.
% \begin{macro}{\todo}
% If option inline is not used, it is only a front-end to
% an editorial comment for a user called ``To do''. If it is used, it tries to simulate
% the simplest behavior of |todonotes| package.
% In the future this can be enhanced, since package |mdframe| is very powerful.
% If the non-inline version is used, the to do note will not appear in the List of Commentaries.\xexeo{It would be nice to check if todonotes is load and just use it}
%    \begin{macrocode}
\newcommand{\cw@todobackgroundcolor}{orange}%
\cwnamedef{cw@todoauthor}{orange}{To do}%
\if@showtodo%
\newcommand{\todo}[2][comentar]{%
\IfEq{inline}{#1}%
{%
\begin{mdframed}[backgroundcolor=\cw@todobackgroundcolor]
#2%
\end{mdframed}%
}%
{%
\cw@todoauthor{#2}%
}%
}%
\else%
\newcommand{\todo}[2]{}%
\fi%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\cwdefinetodocolor}
% Allows the definition of a background color for todo notes.
%    \begin{macrocode}
\newcommand{\cwdefinetodocolor}[1]{\renewcommand{\cw@todobackgroundcolor}{#1}}%
%    \end{macrocode}
% \end{macro}
%  \subsection{Portuguese/English, or inverse translation table}
% These next lines of code made easy to convert this package to English, because it was written in Portuguese, for Brazilian researchers.
% Some commands were rewritten in English with time, such as |rascunho|, but the Portuguese version will always be maintained, while other were translated using only his mechanism.
%    \begin{macrocode}
\let\rascunho=\cwdraft%
\let\cwassunto=\cwsubject%
\let\favorcitar=\pleasecite%
\let\cwautor=\cwnamedef%
\let\listofcomments=\listofcomentario%
\let\listofcitationneeds=\listofcomentarioref%
\let\listofassunto=\listofsubject%
\let\listofsubjects=\listofsubject%
%
%    \end{macrocode}
% \Finale
%
% \endinput
% Local Variables:
% mode: doctex
% TeX-master: t
% End: