Debian Codegraph @

texmf-dist/doc/latex/packdoc/packdoc-change-history-example.tex

raw
1 %! Author = Jander Moreira ([email protected])
2 %! Date = 15/01/2025
3
4 \documentclass[a4paper, 11pt]{article}
5 \usepackage[T1]{fontenc}
6 \usepackage[utf8]{inputenc}
7 \usepackage[brazilian]{babel}
8
9 \usepackage[presets]{packdoc}
10
11 \title{The \textit{change history} support in the \PackageName{packdoc} package}
12 \author{Jander Moreira}
13 \date{}
14
15 \begin{document}
16 \maketitle
17
18 \begin{abstract}
19 This document aims to demonstrate how versions and their changes can be managed within a document using the \PackageName{packdoc} package.
20 \end{abstract}
21
22 \noindent This shows the history change using \Macro{PDPrintChanges}.
23
24 \PDPrintChanges
25
26
27 \section{The Initial Version and the Placement of the Change Log}
28
29 This document includes the \PackageName{packdoc} package in its preamble\footnote{Actually, the \Option{presets} option is used, since some example uses macros, options, and environments.}.
30
31 \begin{PDListing}
32 \usepackage{packdoc}
33 \end{PDListing}
34
35 As with any document that tracks versioning, it must at least define an initial version. This can be achieved using the following commands.
36
37 \PDNewVersion{0.1}{2025/01/15}
38 \PDAddChange{0.1}{
39 description = {Initial version.},
40 no page, % no page number
41 no box, % no box in margin
42 }%
43 \begin{PDListing}
44 \PDNewVersion{0.1}{2020/01/01}
45 \PDAddChange{0.1}{
46 description = {Initial version.},
47 no page, % no page number
48 no box, % no box in margin
49 }%
50 \end{PDListing}
51
52 With these instructions, the initial version 0.1 will be created, and its description will be added to the change log. The \Option{no page} option omits the page number indication in the list of changes, while \Option{no box} prevents the highlight box from being displayed in the margin.
53
54 The \Macro{PDPrintChanges} command generates list of changes by compiling all recorded modifications, descriptions, and version details. In this example document, the macro is positioned immediately after the abstract section. This strategic placement ensures that the revision history is displayed at the beginning of the document. Alternatively, the macro can be placed at the end of the document, providing a summary of changes for readers who prefer to review the revision history after exploring the main content.
55
56 \begin{PDExample}
57 \PDPrintChanges[version prefix = {\textit{v}~}, header style = \footnotesize\slshape]
58 \end{PDExample}
59
60
61 \section{Working with Multiple Versions}\label{sec:working-with-multiple-versions}
62
63 As new versions are introduced, the \Macro{PDNewVersion} macro should be used to define each one. While it is recommended to define the various versions at the beginning of the document, there is no strict requirement for this.
64
65 \PDNewVersion{0.2}{2020/01/01}
66 \PDNewVersion{0.2a}{2021/01/01}
67 \PDNewVersion{0.2b}{2021/06/01}
68 \PDNewVersion{0.3}{2023/01/01}
69 \begin{PDListing}
70 \PDNewVersion{0.2}{2020/01/01}
71 \PDNewVersion{0.2a}{2021/01/01}
72 \PDNewVersion{0.2b}{2021/06/01}
73 \PDNewVersion{0.3}{2020/01/01}
74 \end{PDListing}
75
76 The order in which each version is defined in the source code dictates how they are displayed in the change log. Versions created earlier will appear first, while those defined later will follow sequentially, ensuring a clear and chronological representation of the document's revision history.
77
78 To demonstrate the introduction of new versions, this document will define a set of fictional macros. The macros from the initial version will not appear in the change log, whereas those introduced in subsequent versions will be highlighted indicating when they were added.
79
80 The macros in the first version do not necessitate any version indicators. As a result, they are defined directly without the need for specifying a particular version.
81
82 \begin{PDExample}
83 \begin{Macro*}{ExampleCommand}{\MArg{text}}{}
84 This macro was created in the initial version and serves as the foundation for subsequent versions.
85 \end{Macro*}
86
87 \begin{Macro*}{InitSetup}{}{}
88 This macro was created in the initial version and serves as the foundation for subsequent versions.
89 \end{Macro*}
90 \end{PDExample}
91
92 On the other hand, macros introduced in versions subsequent to the initial release may include an indication of the version in which they were first introduced.
93
94 \begin{PDExample}
95 \begin{Macro*}{InsertReference}{}{}
96 \PDAddChange{0.2}{description = {\Macro{InsertReference} is a new feature.}}%
97 This macro was introduced in a subsequent version, following the initial release of the document. It represents a new feature.
98 \end{Macro*}
99
100 \begin{Macro*}{VersionTracker}{\OArg{options}\MArg{version}}{}
101 \PDAddChange{0.3}{description = {\Macro{VersionTracker} is a new feature.}}%
102 This macro was introduced in a subsequent version, following the initial release of the document. It represents a new feature.
103 \end{Macro*}
104 \end{PDExample}
105
106 Some macros, while maintaining their functionality or backward compatibility, may have been modified in some way. Therefore, it is also possible to specify the version in which such changes occurred, providing a clearer understanding of when and how the macro's behavior was altered.
107
108 \begin{PDExample}
109 \begin{Macro*}{UpdateDatabase}{}{}
110 \PDAddChange{0.2}{description = {\Macro{UpdateDatabase} is a new feature.}}%
111 \PDAddChange{0.2a}{update, description = {\Macro{UpdateDatabase} was fixed in some way.}}%
112 \PDAddChange{0.3}{update, description = {\Macro{UpdateDatabase} macro has been improved.}}%
113 This macro was introduced in a subsequent version, following the initial release of the document. It represents a new feature. Some fixes and improvements also took place.
114 \end{Macro*}
115 \end{PDExample}
116
117 In many cases, changes have been made, but there is no need to specifically highlight them within the text itself. Instead, these changes should simply be documented in the change log, providing a record of the updates without requiring modifications to the main content.
118
119 \begin{PDExample}
120 \PDAddChange{0.2b}{change, no box, no page, description = {This package no longer depends on the \PackageName{OldPackage} package.}}%
121 The initial version depended on the \PackageName{OldPackage} package, which has been discontinued, with the last available release dating back to 1960. To address this, a custom solution was created to meet the original needs, ensuring ongoing functionality and compatibility without relying on obsolete or unsupported packages.
122 \end{PDExample}
123
124 To prevent the change log from becoming overcrowded with too many entries, a summary of the modification can be included directly in the text. Additionally, individual markings can be inserted for the modified items, but these specific changes are not included in the change log itself.
125
126 \begin{PDExample}
127 \PDAddChange{0.2b}{update, no box, description = {\Macro{ExampleOne}, \Macro{ExampleTwo}, and \Macro{ExampleThree} were rewritten with \LaTeX 3.}}%
128 Several macros have been reimplemented using the \LaTeX 3 syntax to improve consistency. These rewritten macros include \Macro{ExampleOne}, \Macro{ExampleTwo}, and \Macro{ExampleThree}, which have now better performance.
129
130 \begin{Macro*}{ExampleOne}{}{}
131 \PDAddChange{0.2b}{update, no listing}%
132 This macro was created in the initial version and serves as the foundation for subsequent versions.
133
134 The code has been restructured to maintain the same functionality, while enhancing performance.
135 \end{Macro*}
136
137 \begin{Macro*}{ExampleTwo}{}{}
138 \PDAddChange{0.2b}{update, no listing}%
139 This macro was created in the initial version and serves as the foundation for subsequent versions.
140
141 The code has been restructured to maintain the same functionality, while enhancing performance.
142 \end{Macro*}
143
144 \begin{Macro*}{ExampleThree}{}{}
145 \PDAddChange{0.2b}{update, no listing}%
146 This macro was created in the initial version and serves as the foundation for subsequent versions.
147
148 The code has been restructured to maintain the same functionality, while enhancing performance.
149 \end{Macro*}
150 \end{PDExample}
151
152 When changes are presented closely together in the main body of text, it can be difficult to determine which version box corresponds to each modification. Optionally, additional title text can be included to provide clarification.
153
154 \begin{PDExample}
155 In addition to the \Macro{True} and \Macro{False} macros, which are commonly used for logical operations, the \Macro{Undefined}\PDAddChange{0.2a}{title = \Macro{Undefined}, description = New macro: \Macro{Undefined}.} and \Macro{Fuzzy}\PDAddChange{0.3}{title = \Macro{Fuzzy}, description = New macro: \Macro{Fuzzy}.} macros have also been introduced. These provide more specialized functionality. To make this available, use the \Option{bool}\PDAddChange{0.2a}{title = \Option{bool}, description = New option: \Option{bool}.} option.
156 \end{PDExample}
157
158 In certain situations, it may be necessary to log a reference other than the page in the change log. To do so, the \Option{page} option can be used to specify any other text. In the following example, a (fictional) reference to another package has been added.
159
160 \begin{PDExample}
161 \PDAddChange{0.2}{update, title = {Regarding \Environment{otherpackage}}, description = {\Environment{otherpackage} error fixed.}, page = {\textit{see} \PackageName {otherpackage} documentation, p.4.}}%
162 The behavior of the functions in this package has changed due to recent modifications in \PackageName{otherpackage}.
163 \end{PDExample}
164
165 \section{The end}
166 That's all.
167
168 \end{document}