Debian Codegraph @

texmf-dist/doc/latex/ezedits/ezedits_docs.tex

raw
1 \documentclass{article}
2
3 \usepackage[arrows]{ezedits}
4
5 \usepackage{xcolor}
6 \usepackage{hyperref}
7
8 \newcommand{\macroexample}[1]{\begin{center}
9 \fcolorbox{black}{black!6}{\parbox{.9\linewidth}{\ttfamily #1}}
10 \end{center}}
11
12
13 \title{\texttt{ezedits.sty} documentation}
14 \author{Joseph A. Smiga $\langle$\href{mailto:[email protected]?subject=[ezedits]\%20}{[email protected]}$\rangle$}
15 \date{Package: November 13, 2024 (v1.1)\\
16 Documentation: November 13, 2024
17 }
18
19 \defineEdit{ABC}{\color{red}}{\color{blue}}
20 \defineEdit{XYZ}{\color{gray}\textit}{\textbf}
21
22
23 \begin{document}
24
25 \maketitle
26
27 \tableofcontents
28
29 \section{Introduction}
30
31 The \texttt{ezedits} package is designed to make it easier to edit \LaTeX{} documents with multiple people, while keeping track of what changed.
32
33 Changes signified with this package with raise warnings. This makes it easier to keep track of changes and keep the document clean.
34
35 Note that, in this document, the package is included as:
36 \macroexample{\textbackslash{}usepackage[arrows]\{ezedits\}}
37 with the \texttt{xcolor} package included.
38
39 \section{Dependencies}
40 The following packages may be required:
41 \begin{itemize}
42 \item \href{https://ctan.org/pkg/ulem}{\texttt{ulem}}: used for strikethrough (\texttt{\textbackslash{sout}}). This is required by default, unless the \hyperlink{opt_nosout}{\texttt{nosout}} option is used.
43
44 \item \href{https://ctan.org/pkg/xcolor}{\texttt{xcolor}}: used for coloring text. If included (i.e., \texttt{\textbackslash{textcolor}} is defined), \hyperlink{cmd_draftnote}{\texttt{\textbackslash{draftnote}}} is colored red by default.
45
46 \item \href{https://ctan.org/pkg/pdfcomment}{\texttt{pdfcomment}}: needed when \hyperlink{opt_pdfcomment}{\texttt{pdfcomment}} option is used.
47 \end{itemize}
48
49
50 \section{Package options}
51 The following options can be used with \verb+\usepackage[...]{ezedits}+:
52 \begin{itemize}
53 \item \hypertarget{opt_arrows}{\texttt{arrows}} add arrows ``$\Longleftarrow$'' pointing to edits in margins (in captions, a pair of arrows are added, instead; $\Longrightarrow$Like this$\Longleftarrow$). These arrows are styled based on the edit.
54
55 \item \hypertarget{opt_accept}{\texttt{accept}} accept all edits (arrows still appear if \texttt{arrows} option is used).
56
57 \item \hypertarget{opt_pdfcomment}{\texttt{pdfcomment}} write edits as pdf annotations (arrows still appear if \texttt{arrows} option is used).
58
59 \item \hypertarget{opt_nosout}{\texttt{nosout}} do not strikeout delete text (by default). If this option is set, the \texttt{ulem} package is not required.
60 \end{itemize}
61
62
63 \section{Commands}
64
65 \noindent\hypertarget{cmd_draftnote}{\texttt{\textbackslash{draftnote}\{...\}}}
66
67 This will generate a note in the text. Text is placed in square brackets and stylized to make it distinct from the rest of the text.
68
69 \draftnote{Here is an example note}
70
71 \vspace{5mm}\hrule\vspace{2mm}
72
73 \noindent\hypertarget{cmd_defineEdit}{\texttt{\textbackslash{defineEdit}\{ABC\}\{$\langle$styleA$\rangle$\}\{$\langle$styleB$\rangle$\}}}
74
75 This will generate a set of commands with the prefix \texttt{ABC} for editing where \texttt{$\langle$styleA$\rangle$} is used for omitted text and \texttt{$\langle$styleB$\rangle$} is used for added text.
76
77 The following commands are generated:
78 \begin{itemize}
79 \item \verb+\ABCEdit{del}{ins}+ Used to replace \verb+del+ with \verb+ins+.
80
81 For example: \ABCEdit{old}{new}.
82
83 \item \verb+\ABCIns{ins}+ Used to insert \verb+ins+.
84
85 For example: \ABCIns{new}.
86
87 \item \verb+\ABCDel{del}+ Used to delete \verb+del+.
88
89 For example: \ABCDel{old}.
90 \end{itemize}
91
92
93 \vspace{5mm}\hrule\vspace{2mm}
94
95 \noindent\hypertarget{cmd_setnotestyle}{\texttt{\textbackslash{setnotestyle}}\{$\langle$style$\rangle$\}}
96
97 Redefine how \hyperlink{cmd_draftnote}{\texttt{\textbackslash{draftnote}}} appears. Here, $\langle$style$\rangle$ is a macro that takes one argument and returns a styled version of that text.
98
99
100 \vspace{5mm}\hrule\vspace{2mm}
101
102 \noindent\hypertarget{cmd_makeeditreport}{\texttt{\textbackslash{makeeditreport}}}
103
104 Creates a summary of which page edits appear on (at the point that the command is called). The output is a \texttt{tabular} environment.
105
106
107 \section{Examples}
108 Here, we use the following command to define the edit commands:
109
110 \macroexample{\textbackslash{}defineEdit\{ABC\}\{\textbackslash{}color\{red\}\}\{\textbackslash{}color\{blue\}\}}
111
112 Here, the first argument \verb+{ABC}+ is the prefix for the edit commands. The second argument \verb+{\color{red}}+ describes how to style deleted text (the text is always crossed-out). Finally, the third argument \verb+{\color{blue}}+ describes what to do with added text. Note that, if the \hyperlink{opt_arrows}{\texttt{arrows}} option is used, it will be styled according to the latter argument.
113
114 A simple example of editing a sentence:
115 \macroexample{This \textbackslash{}ABCIns\{sentence\} contains some \textbackslash{}ABCDel\{major\} errors, but that is \textbackslash{}ABCEdit\{ok\}\{not a big deal\}. \textbackslash{}draftnote\{Remember to clean up the document\}}
116
117 \begin{center}
118 \fbox{\parbox{.9\linewidth}{This \ABCIns{sentence} contains some \ABCDel{major} errors, but that is \ABCEdit{ok}{not a big deal}. \draftnote{Remember to clean up the document}}}
119 \end{center}
120
121
122 \vspace{5mm}\hrule\vspace{2mm}
123
124 The styling options are fairly flexible. For example, one can define their own macro \verb+\style{...}+ that takes one argument and stylizes it.
125 For example, an alternative styling:
126 \macroexample{\textbackslash{}defineEdit\{XYZ\}\{\textbackslash{}color\{gray\}\textbackslash{}textit\}\}\{\textbackslash{}textbf\}}
127 So deleted text \XYZDel{will look like this} while added text \XYZIns{will look like this}.
128
129
130 \vspace{5mm}\hrule\vspace{2mm}
131
132 One can also include edits in (floating) figures. However, if \hyperlink{opt_arrows}{\texttt{arrows}} package option is used, the arrows will appear around the edit, instead of in the margin.
133
134 \begin{figure}[ht]
135 \centering
136 {\rule{1cm}{1cm}}
137 \caption{This is just a \ABCIns{black} box. \draftnote{This is a placeholder figure}}
138 \label{fig:blackbox}
139 \end{figure}
140
141
142 \vspace{5mm}\hrule\vspace{2mm}
143
144 After making edits, one can generate a summary of edits using \verb+\makeeditreport+ (only includes edits/notes from before this command is called):
145
146 \macroexample{
147 \textbackslash{}begin\{table\}[h]\par
148 ~~~~\textbackslash{}centering\par
149 ~~~~\textbackslash{}makeeditreport\par
150 \textbackslash{}end\{table\}
151 }
152
153 \begin{table}[h]
154 \centering
155 \makeeditreport
156 \end{table}
157
158 Note that warnings will also be raised for each edit/note at their location.
159
160 \section{Possible issues}
161 \begin{itemize}
162 \item There are times where the page number used in \hyperlink{cmd_makeeditreport}{\texttt{\textbackslash{makeeditreport}}} may not be exactly correct, especially when in floating environments whose location can be difficult for \LaTeX{} to locate.
163
164 \item In some cases, the edit warnings can appear doubled in captions. This will also appear as ``?'' pages in \hyperlink{cmd_makeeditreport}{\texttt{\textbackslash{makeeditreport}}}.
165
166 \emph{Technical explanation:} Under typical implementation (e.g., in the \texttt{article} class), the caption will ``run'' its entries once or twice depending on the length of the caption. First, the caption is generated in a \verb+\sbox+. If the text can fit in a single line, it is displayed centered, otherwise, the text is ``run'' again (displayed across multiple lines). See \verb+\@makecaption+ in the respective class file for the exact implementation.
167
168 \item There are certain cases in which the ``strikeout'' styling does not play nicely. For example, there may be issues when crossing-out citations (c.f., \href{https://tex.stackexchange.com/q/98222}{this Stack Exchange}). To resolve this, \texttt{ezedits} modifies the \verb+\sout+ command to put \verb+\cite{...}+ within an \verb+\mbox+. This results in the minor inconvenience of not letting citations cross multiple lines.
169
170 \item Also, issues can arise when command covers many paragraphs --- the simple resolution to this would be to repeat the command per paragraph.
171 \end{itemize}
172
173
174 \section{Acknowledgements}
175 JAS would like to thank Abhay Hegde for suggesting the \hyperlink{cmd_makeeditreport}{\texttt{\textbackslash{makeeditreport}}} macro.
176
177
178 \end{document}