| 1 |
\documentclass{ltxguidex} |
| 2 |
% for demonstrating translations |
| 3 |
\usepackage[german, american]{babel} |
| 4 |
%\usepackage{translations} |
| 5 |
|
| 6 |
\usepackage{fontspec} |
| 7 |
\errorcontextlines=10 |
| 8 |
\usepackage{changelog} |
| 9 |
\usepackage{changepage} |
| 10 |
\newcommand{\cl}{\ctan{changelog}} |
| 11 |
\newcommand{\keepachangelog}{\https{keepachangelog.com}} |
| 12 |
|
| 13 |
\makeatletter |
| 14 |
\renewcommand{\SX@explpreset}{ |
| 15 |
language=[LaTeX]TeX, |
| 16 |
numbers=none, |
| 17 |
} |
| 18 |
\makeatother |
| 19 |
|
| 20 |
\setmainfont{Charter} |
| 21 |
\usepackage{FiraSans} |
| 22 |
\usepackage{FiraMono} |
| 23 |
\lstset{basewidth=0.6em} |
| 24 |
|
| 25 |
|
| 26 |
\NewDocumentEnvironment{ctandescription}{} |
| 27 |
{\NewDocumentCommand{\pkg}{m}{\item[\ctan{##1}]} |
| 28 |
\begin{description}} |
| 29 |
{\end{description}} |
| 30 |
|
| 31 |
\author{Rebecca Turner\thanks{\email{[email protected]}}} |
| 32 |
\title{The \cl\ Package} |
| 33 |
\date{2.6.1 (2025/08/06)} |
| 34 |
\begin{document} |
| 35 |
\maketitle |
| 36 |
|
| 37 |
\begin{abstract} |
| 38 |
Changelogs are important. \cl\ defines a |changelog| |
| 39 |
environment to make writing changelogs declarative and easy. |
| 40 |
|
| 41 |
For rationale, read \keepachangelog. |
| 42 |
\end{abstract} |
| 43 |
|
| 44 |
\begin{note} |
| 45 |
Browse the sources, contribute, or complain at \\ |
| 46 |
\https{github.com/9999years/latex-changelog} |
| 47 |
\end{note} |
| 48 |
|
| 49 |
\tableofcontents |
| 50 |
\vfill |
| 51 |
\pagebreak |
| 52 |
|
| 53 |
\section{I don't want to read this documentation} |
| 54 |
|
| 55 |
Perfectly understandable. \cl\ comes in a ``simple'' flavor: |
| 56 |
|
| 57 |
\begin{LTXexample} |
| 58 |
\begin{changelog}[author=Rebecca Turner, simple, sectioncmd=\section*] |
| 59 |
\begin{version}[v=1.0.0, date=2018-12-28] |
| 60 |
\item Cool features |
| 61 |
\item Bug fixes |
| 62 |
\end{version} |
| 63 |
\shortversion{v=0.1.0, date=2018-10-25, changes=Initial beta} |
| 64 |
\end{changelog} |
| 65 |
\end{LTXexample} |
| 66 |
|
| 67 |
And a more organized variant based on \keepachangelog: |
| 68 |
|
| 69 |
\begin{LTXexample} |
| 70 |
\begin{changelog}[author=Rebecca Turner, sectioncmd=\section*] |
| 71 |
\begin{version}[v=1.0.0, date=2018-12-28] |
| 72 |
\added |
| 73 |
\item Cool features |
| 74 |
\fixed |
| 75 |
\item Bug fixes |
| 76 |
\end{version} |
| 77 |
\shortversion{v=0.1.0, date=2018-10-25, changes=Initial beta} |
| 78 |
\end{changelog} |
| 79 |
\end{LTXexample} |
| 80 |
|
| 81 |
\section{Intro} |
| 82 |
|
| 83 |
\subsection{Why?} |
| 84 |
|
| 85 |
Read \href{https://olivierlacan.com/}{Olivier Lacan}'s lovely site |
| 86 |
\keepachangelog. To excerpt: |
| 87 |
|
| 88 |
\begin{adjustwidth}{1in}{1in} |
| 89 |
\subsubsection{What is a changelog?} |
| 90 |
A changelog is a file which contains a curated, chronologically |
| 91 |
ordered list of notable changes for each version of a project. |
| 92 |
|
| 93 |
\subsubsection{Why keep a changelog?} |
| 94 |
To make it easier for users and contributors to see precisely what |
| 95 |
notable changes have been made between each release (or version) of |
| 96 |
the project. |
| 97 |
|
| 98 |
\subsubsection{Who needs a changelog?} |
| 99 |
People do. Whether consumers or developers, the end users of |
| 100 |
software are human beings who care about what's in the software. |
| 101 |
When the software changes, people want to know why and how. |
| 102 |
\end{adjustwidth} |
| 103 |
|
| 104 |
\subsection{The competition} |
| 105 |
|
| 106 |
It's always good to know the competition. Unfortunately, there isn't much |
| 107 |
here. Know of another package with similar functionality? Drop me a line or |
| 108 |
open a pull request! |
| 109 |
|
| 110 |
\begin{ctandescription} |
| 111 |
\pkg{vhistory} provides a decent-looking changelog. However, it's |
| 112 |
designed for short changes and provides a less-than-elegant |
| 113 |
interface. Additionally, it's based on the \ctan{ltxtable} |
| 114 |
package, meaning it makes restrictions on the contents of |
| 115 |
version information and writes the table to a file. |
| 116 |
|
| 117 |
\pkg{holtxdoc} has a decent changelog feature (via |
| 118 |
Oberdiek's |History| and |Version| environments), |
| 119 |
but \ctan{holtxdoc} ``contains some private macros and setup |
| 120 |
for my needs. Thus do not use it.'' In addition, Oberdiek's |
| 121 |
changelogs don't support multiple authors. |
| 122 |
|
| 123 |
\pkg{gitlog} is an interesting idea, but \ctan{gitlog} ``is a |
| 124 |
proof-of-concept release to allow users an early |
| 125 |
evaluation\dots'' |
| 126 |
|
| 127 |
Also, |
| 128 |
\href{https://keepachangelog.com/en/1.0.0/}{friends don't |
| 129 |
let friends dump git logs into changelogs}. |
| 130 |
\end{ctandescription} |
| 131 |
|
| 132 |
\section{The \texttt{changelog} environment} |
| 133 |
|
| 134 |
\begin{desc} |
| 135 |
|\begin{changelog}[<options>]...\end{changelog}| |
| 136 |
\end{desc} |
| 137 |
Wraps |description| while providing the |version| environment and the |
| 138 |
\cs{shortversion} command. In addition to the options shown below, |
| 139 |
\meta{options} may contain any of the options for |version| as a form of |
| 140 |
``partial application''; this may be useful if, for example, most of your |
| 141 |
versions have the same author. |
| 142 |
|
| 143 |
\begin{keys} |
| 144 |
\key{section}[\bool][true] |
| 145 |
Insert a \cs{section} before the changelog? |
| 146 |
If |section=false|, no \cs{label} will be generated. |
| 147 |
\key{sectioncmd}[\m{command}][\cs{section}] |
| 148 |
Which sectioning command to use? |
| 149 |
\key{title}[\m{txt}][Changelog] |
| 150 |
What to title the changelog section? |
| 151 |
\key{label}[\m{label}][sec:changelog] |
| 152 |
What to \cs{label} the section? |
| 153 |
If the \option{label} option is empty (|label=|), no label will be |
| 154 |
inserted. |
| 155 |
\end{keys} |
| 156 |
|
| 157 |
\pagebreak |
| 158 |
\begin{desc} |
| 159 |
|\begin{version}[<options>]...\end{version}| |
| 160 |
\end{desc} |
| 161 |
Gives a single version; wraps |itemize|. |
| 162 |
|
| 163 |
If the \option{date} option is absent, the date isn't printed. |
| 164 |
|
| 165 |
If the \option{v}/\option{version} option is absent, the date is used in its |
| 166 |
place. |
| 167 |
|
| 168 |
If both \option{version} and \option{date} are absent, the version is shown |
| 169 |
as \texttt{Unreleased} and \cs{today} is used for the date. \cs{today} isn't |
| 170 |
ideal (which is to say, not |
| 171 |
\href{https://en.wikipedia.org/wiki/ISO_8601}{\textsc{iso} 8601} compliant) |
| 172 |
but it's well-known and easy to redefine.\footnote{Try the \ctan{datetime2} |
| 173 |
package or |
| 174 |
\href{https://tex.stackexchange.com/questions/152392/date-format-yyyy-mm-dd}{any |
| 175 |
of the other solutions here.}} |
| 176 |
|
| 177 |
\m{options} may include: |
| 178 |
|
| 179 |
\begin{keys} |
| 180 |
\key{version}[\m{version string}] |
| 181 |
The version string for this version |
| 182 |
\key{v}[\m{version string}] |
| 183 |
An alias for \option{version} |
| 184 |
\key{author}[\m{author(s)}] |
| 185 |
The author(s) of this version |
| 186 |
\key{date}[\m{date string}] |
| 187 |
The date of this version's release |
| 188 |
\key{yanked}[\bool][false] |
| 189 |
Indicates that the release was revoked due to a ``serious bug or |
| 190 |
security issue''; prints a visible notice next to the version number |
| 191 |
\key{remark}[\m{remark}] |
| 192 |
Adds a remark in the style of the |yanked| key. |
| 193 |
\key{remarks}[\m{comma-separated list of remarks}] |
| 194 |
Adds multiple remarks in the style of the |yanked| key. |
| 195 |
\key{simple}[\bool][false] |
| 196 |
Indicates this version isn't split up into \cs{added}, \cs{changed}, |
| 197 |
etc.\ categories; if this option is given, a |version| environment acts |
| 198 |
like a plain |itemize| |
| 199 |
\key{short}[\bool][false] |
| 200 |
Renders a short version, like |\shortversion|'s \option{changes} option; |
| 201 |
useful if you need to put verbatim material in the changes which would |
| 202 |
otherwise cause an error due to being used in an argument. |
| 203 |
\end{keys} |
| 204 |
|
| 205 |
\begin{desc} |
| 206 |
|\shortversion{<options>}| |
| 207 |
\end{desc} |
| 208 |
A short, one-line version. In addition to |version|'s options, the following |
| 209 |
options are available for \cs{shortversion}: |
| 210 |
|
| 211 |
\begin{keys} |
| 212 |
\key{changes}[\m{change text}] The changes to display for this version |
| 213 |
\end{keys} |
| 214 |
|
| 215 |
\subsection{Helper commands} |
| 216 |
|
| 217 |
The \cl\ package defines several ``helper commands.'' These commands |
| 218 |
introduce a \textit{set} of changes within the version. There must be at |
| 219 |
least one \cs{item} between one of these commands and the end of the |
| 220 |
|version| environment. |
| 221 |
|
| 222 |
Note that these commands are \emph{only} available when not using |
| 223 |
the \option{simple} option! |
| 224 |
|
| 225 |
\begin{desc}|\added|\end{desc}Introduces a list of \cs{item}s that represent added |
| 226 |
features |
| 227 |
\begin{desc}|\changed|\end{desc}Introduces a list of \cs{item}s that represent |
| 228 |
changed features |
| 229 |
\begin{desc}|\deprecated|\end{desc}Introduces a list of \cs{item}s that represent |
| 230 |
deprecated features |
| 231 |
\begin{desc}|\removed|\end{desc}Introduces a list of \cs{item}s that represent |
| 232 |
features which have been removed |
| 233 |
\begin{desc}|\fixed|\end{desc}Introduces a list of \cs{item}s that represent bug |
| 234 |
fixes |
| 235 |
\begin{desc}|\security|\end{desc}Introduces a list of \cs{item}s that represent |
| 236 |
security-fixes and closed security holes |
| 237 |
|
| 238 |
\begin{desc}|\newchangelogsection{<command>}{<description>}|\end{desc} |
| 239 |
Creates a new command like \cs{added}, \cs{changed}, etc., that can be |
| 240 |
used in the |version| environment. |
| 241 |
|
| 242 |
\begin{LTXexample} |
| 243 |
\newchangelogsection |
| 244 |
{\critical}{Critical} |
| 245 |
\begin{changelog}[section=false] |
| 246 |
\begin{version}[v=1.0.0, date=2023-02-16] |
| 247 |
\critical |
| 248 |
\item Features! |
| 249 |
\end{version} |
| 250 |
\end{changelog} |
| 251 |
\end{LTXexample} |
| 252 |
|
| 253 |
\subsection{Customization} |
| 254 |
|
| 255 |
The |changelog| environment wraps |changelogdescription| (which is |
| 256 |
defined by default to be just the |description| environment), and the |
| 257 |
|version| environment wraps |changelogitemize|. One could customize |
| 258 |
these in depth with \ctan{enumitem}, as in: |
| 259 |
|
| 260 |
\begin{latexcode} |
| 261 |
\usepackage{enumitem} |
| 262 |
\renewenvironment{changelogitemize} |
| 263 |
{\begin{itemize}[label=---]} |
| 264 |
{\end{itemize}} |
| 265 |
\end{latexcode} |
| 266 |
|
| 267 |
\begin{desc} |
| 268 |
|\changelogyanked| |
| 269 |
\end{desc} |
| 270 |
Prints the ``revoked release'' notice: |
| 271 |
\changelogyanked. See: |
| 272 |
\href{https://keepachangelog.com/en/1.0.0/#yanked}{yanked releases on |
| 273 |
\texttt{keepachangelog.com}}. |
| 274 |
|
| 275 |
\begin{desc} |
| 276 |
|\changelogremark{<remark>}| |
| 277 |
\end{desc} |
| 278 |
Prints a ``remark.'' This is used to implement |\changelogyanked| and the |
| 279 |
|remark| and |remarks| keys of the |version| environment. |
| 280 |
|
| 281 |
\section{Translations} |
| 282 |
|
| 283 |
Want to use \cl\ in a non-English document? Great! \cl\ comes with |
| 284 |
translations for English, German, Spanish, French, and Japanese, as well as |
| 285 |
support for adding new translations (see section~\ref{s:contrib} below for |
| 286 |
translation credits). To use built-in translations, simply load \ctan{babel} |
| 287 |
with the desired language: |
| 288 |
\begin{otherlanguage}{german} |
| 289 |
\begin{LTXexample} |
| 290 |
% In the preamble: |
| 291 |
% \usepackage[german]{babel} |
| 292 |
|
| 293 |
\begin{changelog}[section=false, author=Holger Schieferdecker] |
| 294 |
\begin{version}[v=1.0.0] |
| 295 |
\added |
| 296 |
\item Features! |
| 297 |
\end{version} |
| 298 |
\end{changelog} |
| 299 |
\end{LTXexample} |
| 300 |
\end{otherlanguage} |
| 301 |
|
| 302 |
\subsection{Creating new translations} |
| 303 |
|
| 304 |
\cl\ uses the \ctan{translations} package to provide translations, and a |
| 305 |
complete translation looks like this: |
| 306 |
\begin{latexcode} |
| 307 |
\documentclass{article} |
| 308 |
\usepackage[english]{babel} |
| 309 |
\usepackage{translations} |
| 310 |
\DeclareTranslation{English}{changelog}{Changelog} |
| 311 |
\DeclareTranslation{English}{changelog-Added}{Added} |
| 312 |
\DeclareTranslation{English}{changelog-Changed}{Changed} |
| 313 |
\DeclareTranslation{English}{changelog-Deprecated}{Deprecated} |
| 314 |
\DeclareTranslation{English}{changelog-Removed}{Removed} |
| 315 |
\DeclareTranslation{English}{changelog-Fixed}{Fixed} |
| 316 |
\DeclareTranslation{English}{changelog-Security}{Security} |
| 317 |
\DeclareTranslation{English}{changelog-Miscellaneous}{Miscellaneous} |
| 318 |
\DeclareTranslation{English}{changelog-Unreleased}{Unreleased} |
| 319 |
\DeclareTranslation{English}{changelog-Yanked}{YANKED} |
| 320 |
\begin{document} |
| 321 |
% ... |
| 322 |
\end{document} |
| 323 |
\end{latexcode} |
| 324 |
Refer to the |
| 325 |
\href{http://mirrors.ctan.org/macros/latex/contrib/translations/translations_en.pdf}{\texttt{translations} |
| 326 |
package documentation} and the |
| 327 |
\href{http://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf}{\texttt{babel} |
| 328 |
package documentation} for more information. |
| 329 |
|
| 330 |
If you create a translation, please |
| 331 |
\href{https://github.com/9999years/latex-changelog/pulls}{submit a pull |
| 332 |
request} or \href{mailto:[email protected]}{send me an email} and I'll incorporate |
| 333 |
the translation into \cl's next release! |
| 334 |
|
| 335 |
Please note that the \cl\ package is written in \ctan{expl3}, so translations |
| 336 |
submitted to me should use |~| instead of literal spaces, |
| 337 |
e.g.~|\DeclareTranslation{MyLanguage}{changelog}{Log~of~changes}|. |
| 338 |
|
| 339 |
\section{Contributors}% |
| 340 |
\label{s:contrib} |
| 341 |
|
| 342 |
\begin{description} |
| 343 |
\item[Rebecca Turner] Original implementation. |
| 344 |
\item[Holger Schieferdecker] |
| 345 |
Internationalization support and German translations. |
| 346 |
\item[David Arnold <\email{[email protected]}>] |
| 347 |
Support for translating the changelog's section title and Spanish |
| 348 |
translations. |
| 349 |
\item[Damien Calesse <\https{github.com/kranack}>] French translations. |
| 350 |
\item[cmplstofB <\https{github.com/cmplstofB}>] Japanese translations. |
| 351 |
\end{description} |
| 352 |
|
| 353 |
\section{Changelog} |
| 354 |
|
| 355 |
This is this package's actual changelog --- not an example! |
| 356 |
|
| 357 |
\begin{changelog}[author=Rebecca Turner <\email{[email protected]}>, section=false] |
| 358 |
\begin{version}[v=2.6.0, date=2024-12-18] |
| 359 |
\changed |
| 360 |
\item If the \option{label} option for the |changelog| environment is empty, |
| 361 |
no \cs{label} will be generated for the changelog section. |
| 362 |
|
| 363 |
The documentation has been clarified to explain that if the |
| 364 |
\option{section} option is set to |false|, no label will be generated, as |
| 365 |
labels are meaningless without being attached to a section. |
| 366 |
\end{version} |
| 367 |
|
| 368 |
\begin{version}[v=2.5.1, date=2024-09-17] |
| 369 |
\fixed |
| 370 |
\item Fixed \href{https://github.com/9999years/latex-changelog/issues/13}{a |
| 371 |
bug where a version with a date and no version number would display the |
| 372 |
date twice}, like ``\textbf{2024-09-17} (2024-09-17)''. Now, the date will |
| 373 |
correctly only be shown once. |
| 374 |
|
| 375 |
\item Fixed a bug where a version with a version number but no date or author |
| 376 |
would be indented. |
| 377 |
\end{version} |
| 378 |
|
| 379 |
\begin{version}[v=2.5.0, date=2023-02-16] |
| 380 |
\added |
| 381 |
\item Added the \cs{newchangelogsection} command to support custom |
| 382 |
sections. |
| 383 |
\item Added the |remark| and |remarks| keys to support custom remarks (like |
| 384 |
``YANKED'') on versions. |
| 385 |
\item Added the |\changelogremark| command, which renders the ``YANKED'' |
| 386 |
remark and other custom remarks. |
| 387 |
\end{version} |
| 388 |
|
| 389 |
\begin{version}[v=2.4.1, date=2023-02-14] |
| 390 |
\changed |
| 391 |
\item Converted the |changelog.sty| implementation to use the \ctan{expl3} |
| 392 |
package. \ctan{expl3} provides a reasonable and well-defined programming |
| 393 |
environment. I believe \ctan{expl3} is the future of programming in |
| 394 |
\LaTeX, despite its verbosity. |
| 395 |
\end{version} |
| 396 |
|
| 397 |
\begin{version}[v=2.4.0, date=2020-09-02, |
| 398 |
author={cmplstofB <\https{github.com/cmplstofB}>}] |
| 399 |
\added |
| 400 |
\item Japanese translations. |
| 401 |
\end{version} |
| 402 |
|
| 403 |
\begin{version}[v=2.3.0, date=2020-08-26, |
| 404 |
author={Damien Calesse <\https{github.com/kranack}>}] |
| 405 |
\added |
| 406 |
\item French translations. |
| 407 |
\end{version} |
| 408 |
|
| 409 |
\begin{version}[v=2.2.0, date=2020-04-23, |
| 410 |
author={David Arnold <\email{[email protected]}>}] |
| 411 |
\added |
| 412 |
\item Support for translating the changelog's section title with |
| 413 |
|\DeclareTranslation{Language}{changelog}{...}|. |
| 414 |
\item Spanish translations. |
| 415 |
\end{version} |
| 416 |
|
| 417 |
\begin{version}[v=2.1.0, date=2019-06-29, |
| 418 |
author={Holger Schieferdecker}] |
| 419 |
\added |
| 420 |
\item Internationalization support. |
| 421 |
\item German translations. |
| 422 |
\end{version} |
| 423 |
|
| 424 |
\begin{version}[v=2.0.0, date=2019-04-15] |
| 425 |
\added |
| 426 |
\item Better error handling; more informative messages for empty |
| 427 |
\texttt{version} or \texttt{changelog} environments. |
| 428 |
\item \option{short} option in versions. |
| 429 |
\removed |
| 430 |
\item Removed \texttt{color} package option. |
| 431 |
\fixed |
| 432 |
\item Added dependencies for \ctan{xparse} and \ctan{xkeyval}, which had |
| 433 |
erroneously been excluded from the package. |
| 434 |
\end{version} |
| 435 |
|
| 436 |
\begin{version}[v=1.0.0, date=2018-12-28] |
| 437 |
\added |
| 438 |
\item The ``simple'' option for changelogs which aren't split up |
| 439 |
into sections of added, changed, removed, etc.\ features |
| 440 |
\changed |
| 441 |
\item Instead of commands like \cs{added} introducing an item, they |
| 442 |
introduce a list of items; this is what \keepachangelog\ |
| 443 |
actually intended; previous implementations were incorrect to |
| 444 |
display an ``Added'' (or whatever) marker next to each item. |
| 445 |
\end{version} |
| 446 |
|
| 447 |
\shortversion{v=0.2.1, date=2018-10-26, changes=Documented \option{yanked} |
| 448 |
option} |
| 449 |
\shortversion{v=0.2.0, date=2018-10-26, changes=First stable release} |
| 450 |
\shortversion{v=0.1.0, date=2018-10-25, changes=Initial beta} |
| 451 |
\end{changelog} |
| 452 |
|
| 453 |
\end{document} |