texlive[72849] Master/texmf-dist: ezedits (14nov24)

commits+karl at tug.org commits+karl at tug.org
Thu Nov 14 21:41:52 CET 2024


Revision: 72849
          https://tug.org/svn/texlive?view=revision&revision=72849
Author:   karl
Date:     2024-11-14 21:41:52 +0100 (Thu, 14 Nov 2024)
Log Message:
-----------
ezedits (14nov24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/ezedits/README.md
    trunk/Master/texmf-dist/doc/latex/ezedits/ezedits_docs.pdf
    trunk/Master/texmf-dist/doc/latex/ezedits/ezedits_docs.tex
    trunk/Master/texmf-dist/tex/latex/ezedits/ezedits.sty

Modified: trunk/Master/texmf-dist/doc/latex/ezedits/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/ezedits/README.md	2024-11-14 15:14:04 UTC (rev 72848)
+++ trunk/Master/texmf-dist/doc/latex/ezedits/README.md	2024-11-14 20:41:52 UTC (rev 72849)
@@ -1,6 +1,6 @@
 # Package `ezedits` by Joey Smiga
 
-Version 2024-09-12 v1.0
+Version 2024-11-13 v1.1
 
 Maintained by Joseph "Joey" A. Smiga \<joseph.smiga at rochester.edu\>
 
@@ -37,7 +37,7 @@
 
 ## Possible issues
 
-- Exact page numbers for `\makeeditreport` may be slightly off due to how LaTeX updates `\thepage`.
+- Exact page numbers for `\makeeditreport` may be slightly off due to how LaTeX updates pages.
 - Problems can arise when editing across several paragraphs. It is recommended to use new commands between paragraphs.
 - `pdfcomment` option can be a bit rough at times, though it generally works.
 

Modified: trunk/Master/texmf-dist/doc/latex/ezedits/ezedits_docs.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/ezedits/ezedits_docs.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/ezedits/ezedits_docs.tex	2024-11-14 15:14:04 UTC (rev 72848)
+++ trunk/Master/texmf-dist/doc/latex/ezedits/ezedits_docs.tex	2024-11-14 20:41:52 UTC (rev 72849)
@@ -12,8 +12,8 @@
 
 \title{\texttt{ezedits.sty} documentation}
 \author{Joseph A. Smiga $\langle$\href{mailto:joseph.smiga at rochester.edu?subject=[ezedits]\%20}{joseph.smiga at rochester.edu}$\rangle$}
-\date{Package: September 12, 2024 (v1.0)\\
-Documentation: September 12, 2024
+\date{Package: November 13, 2024 (v1.1)\\
+Documentation: November 13, 2024
 }
 
 \defineEdit{ABC}{\color{red}}{\color{blue}}
@@ -112,7 +112,7 @@
 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. 
 
 A simple example of editing a sentence:
-\macroexample{This \textbackslash{}ABCIns\{sentence\} contains some \textbackslash{}ABCDel\{major\} errors, but that is \textbackslash{}ABCEdit\{ok\}\{not a big deal\}. \textbackslash{}drafNote\{Remember to clean up the document\}}
+\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\}}
 
 \begin{center}
     \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}}}
@@ -130,10 +130,11 @@
 \vspace{5mm}\hrule\vspace{2mm}
 
 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.
-\begin{figure}[h]
+
+\begin{figure}[ht]
     \centering
     {\rule{1cm}{1cm}}
-    \caption{This is just a \ABCIns{black} box.}
+    \caption{This is just a \ABCIns{black} box. \draftnote{This is a placeholder figure}}
     \label{fig:blackbox}
 \end{figure}
 
@@ -157,15 +158,21 @@
 Note that warnings will also be raised for each edit/note at their location. 
 
 \section{Possible issues}
-There are times where the page number used in \hyperlink{cmd_makeeditreport}{\texttt{\textbackslash{makeeditreport}}} may not be exactly correct. This has to do with how \LaTeX{} updates \verb+\thepage+. Namely, it tends to wait until new paragraphs. Also, floating environments can be pushed to a different page.
+\begin{itemize}
+\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.
 
-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. 
+\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}}}.
 
-Also, issues can arise when command covers many paragraphs --- the simple resolution to this would be to repeat the command per paragraph.
+\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. 
 
+\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. 
 
+\item Also, issues can arise when command covers many paragraphs --- the simple resolution to this would be to repeat the command per paragraph.
+\end{itemize}
+
+
 \section{Acknowledgements}
 JAS would like to thank Abhay Hegde for suggesting the \hyperlink{cmd_makeeditreport}{\texttt{\textbackslash{makeeditreport}}} macro.
 
 
-\end{document}
\ No newline at end of file
+\end{document}

Modified: trunk/Master/texmf-dist/tex/latex/ezedits/ezedits.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ezedits/ezedits.sty	2024-11-14 15:14:04 UTC (rev 72848)
+++ trunk/Master/texmf-dist/tex/latex/ezedits/ezedits.sty	2024-11-14 20:41:52 UTC (rev 72849)
@@ -35,7 +35,7 @@
 
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{ezedits}[2024/09/12]
+\ProvidesPackage{ezedits}[2024/11/13]
 
 % \RequirePackage{xcolor}
 
@@ -70,49 +70,77 @@
 \else
     \def\new at sout{}% do nothing
 \fi
-    
-%% edit record
-\newcounter{ez at editcount}
+
+%% counters
 \newcounter{ez at totalcount}
-\gdef\ez at editrecord{}
-\newcommand{\ez at addeditpage}{%
-    \ifx\ez at lastpage\undefined% first edit
-        \xdef\ez at lastpage{\thepage}% initialize "last page" variable
-        % counter starts at 0, so it does not need to be updated
-    \else% 2nd+ edit
-        \if\ez at lastpage\thepage% same page as last edit
-            \relax% handled after if
-        \else% new page
-            % add record
-            \xdef\ez at editrecord{\ez at editrecord \ez at lastpage & \arabic{ez at editcount} \\}%
-            % reset counter/page number
-            \setcounter{ez at editcount}{0}%
-            \xdef\ez at lastpage{\thepage}%
-        \fi%
+\newcounter{ez at tempcounter}
+
+% get page number for label (defined in .aux with \newlabel)
+%     The \newlabel command defines ~\r at label to give a set of tokens. The second of which is the page number
+% Defining this avoids the issue of \pageref being overwritten (e.g., by hyperref)
+% This macro was adapted from lines in hyperref
+\def\ez at pageref#1{%
+    \expandafter\ifx\csname r@#1\endcsname\relax%
+        ?% ref not defined
+    \else%
+        \expandafter\expandafter\expandafter% evaluate "car..."
+        \expandafter\expandafter\expandafter% evaluate "gobble<...>"
+        \expandafter\@car% exapndafter holds "car" -> "\@car\@gobble<...>"
+        \expandafter\expandafter\expandafter% expand "csname...", put after "gobble"
+        \@gobble\csname r@#1\endcsname\@nil%
     \fi%
+}
+
+%% Commands for recording edit counts
+\gdef\ez at pagelist{}
+\def\ez at geteditcount#1{%
+    \expandafter\ifx\csname ez at count@page#1\endcsname\relax%
+        % no edits on page
+        0%
+    \else%
+        \csname ez at count@page#1\endcsname%
+    \fi%
+}
+\def\ez at addeditcount#1{%
+    \expandafter\ifx\csname ez at count@page#1\endcsname\relax%
+        % Initialize
+        \expandafter\gdef\csname ez at count@page#1\endcsname{0}%
+        % Add to (comma-separated) list
+        \xdef\ez at pagelist{\ez at pagelist\ifx\ez at pagelist\empty\else,\fi#1}
+%        \xdef\ez at pagelist{\ez at pagelist#1,}
+    \fi%
+    % Add to count
     % Note stepping needs to be "protected" (counters do not always like being changed, since this can mess up, e.g., TOC)
-    \protect\stepcounter{ez at editcount}% update counter
-    \protect\stepcounter{ez at totalcount}%
+    \protect\setcounter{ez at tempcounter}{\ez at geteditcount{#1}}%
+    \protect\stepcounter{ez at tempcounter}%
+    \expandafter\xdef\csname ez at count@page#1\endcsname{\number\value{ez at tempcounter}}%
 }
-%TODO there is an issue with \thepage not always being accurate
-%   Possible solution: use \label{} (with generated unique labels) and \pageref{} instead of \thepage.
-%   -> This solution may cause out-of-order problems with floating images.
 
+%% edit record
+\def\ez at addeditpage{%
+	\def\ez at label{ezedit\theez at totalcount}% name of label
+	\label{\ez at label}% insert label
+	\ez at addeditcount{\ez at pageref{\ez at label}}% add to record for crnt page
+    % Note stepping needs to be "protected" (counters do not always like being changed, since this can mess up, e.g., TOC)
+    \protect\stepcounter{ez at totalcount}% update counter
+}
+
 \newcommand{\makeeditreport}{%
+    \def\@run##1{\expandafter\@process##1,\@nil,}%
+    \def\@process##1,{%
+        \ifx##1\@nil% terminate
+        \else%
+            ##1 & \csname ez at count@page##1\endcsname \\
+        \expandafter\@process\fi% end if, then process next token
+    }%
+    %
     \begin{tabular}{l|r}
-        %\hline\hline
         Page & \# edits/notes \\
         \hline
-        \ifx\ez at lastpage\undefined
-            \relax% no edits
-        \else%
-            \ez at editrecord
-            \ez at lastpage & \arabic{ez at editcount}% current state
-        \fi \\
-        \hline
-        Total & \arabic{ez at totalcount}
-        %\hline\hline
-    \end{tabular}
+	    \@run\ez at pagelist
+	    \hline
+	    Total & \arabic{ez at totalcount}
+	 \end{tabular}
 }
 
 % Style of \draftnote (may be a better way to write this)



More information about the tex-live-commits mailing list.