Open lucumon opened 1 week ago
Explain what you mean by "last version" -- is it the most recently defined version as the document is being compiled, or the latest version...?
By "headers" I assume you mean page headers?
Anyways, try this:
\ExplSyntaxOn
\changelog__display_version
\ExplSyntaxOff
You may need the \ExplSyntaxOn
/Off
commands outside of wherever you're using it, like
\ExplSyntaxOn
\setTopRightHeader{\changelog__display_version~\pagenumber}
\ExplSyntaxOff
(In \ExplSyntaxOn
you'll need to manually escape all space characters with ~
.)
What's the difference between latest version and the most recently defined version as the document is being compiled? For me it's the same. I'm willing to use it inside \chead{}, from fancyhdr package. The command you gave me outputs nothing for me.
Here's an screenshot of the header I'm looking to do:
"Version XXX" is what I want to populate with one simple command that queries the latest version defined on the changelog.
Thanks.
Searching a little more, I found that vhistory does this by using \vhCurrentVersion command. They even have an example document that shows current version on title and footer.
I think that how your package builds the changelog is a lot more professional looking, so I'm looking forward to get this feature from you.
Again, thanks a lot for your contribution.
I'm willing to use it inside
\chead{}
, fromfancyhdr
package. The command you gave me outputs nothing for me.
I see. I wonder if the headers are evaluated before the changelog entry that would define the version, or if there's some other issue. I'll have to see how vhistory
does this. It would be helpful if you could include a minimal reproducer of your issue as a comment here. If you write your code between triple backticks (```
) it'll show up as a nicely-formatted block of code, e.g. this:
```latex
\documentclass{article}
\begin{document}
Hello!
\end{document}
```
Will render like this:
\documentclass{article}
\begin{document}
Hello!
\end{document}
Yes, header is defined before \begin{document}
.
In my case, I'm using Technical Document Template from Overleaf, which defines \documentclass{ol-softwaremanual}
and some other commands that are used on the following snippet.
\documentclass{ol-softwaremanual}
\usepackage[a4paper,top=4.2cm,bottom=4.2cm,left=2.5cm,right=2.5cm,headsep=24pt,headheight=2cm]{geometry} % for setting page size and margins
\usepackage{fancyhdr}
\usepackage{multirow,tabularx}
\usepackage{lastpage}
\usepackage{adjustbox}
\usepackage[useregional]{datetime2}
\usepackage{changelog}
% Frontmatter data; appears on title page
\title{TITLE}
\version{01}
\author{}
\softwarelogo{\includegraphics[width=10cm]{logo.png}}
% Header
\pagestyle{fancy}
\fancyhf{}
\chead{
\begin{tabular*}{\linewidth}{c c c}
\adjincludegraphics[width=3.5cm,valign=M]{logo.png} & \begin{tabular}{c}
\large{\textbf{DOCUMENT TITLE}} \\
SUBTITLE
\end{tabular} & \begin{tabular}{c}
\small{pág. \thepage\ de \pageref*{LastPage}} \\
\small{Versión} XXX \\
\small{\today}
\end{tabular}\\
\end{tabular*}
}
\begin{document}
\maketitle
\begin{changelog}[title=Historial de versiones, label=sec:changelog, simple,
sectioncmd=\section*]
\begin{version}[v=02,
date=2018-12-28]
\item Cool features
\item Bug fixes
\end{version}
\shortversion{v=01,
date=01/10/2024, author=anon,
changes=Edición inicial}
\end{changelog}
\newpage
\section{Introduction}
bla bla bla
%Only for testing purposes
\ExplSyntaxOn
\changelog__display_version
\ExplSyntaxOff
\end{document}
I tried using \changelog__display_version
inside the document, as seen on the previous snippet, and also doesn't work for me.
Please include a minimal reproducer. For one, your document doesn't compile: the ol-softwaremanual
class isn't available publicly on CTAN (I suspect it will work the same with the standard article
class), I don't have access to the logo.png
you include, I doubt the table in your headers is necessary, and I doubt any of these packages are important for reproducing the issue, with the exception of fancyhdr
:
\usepackage[a4paper,top=4.2cm,bottom=4.2cm,left=2.5cm,right=2.5cm,headsep=24pt,headheight=2cm]{geometry} % for setting page size and margins
\usepackage{fancyhdr}
\usepackage{multirow,tabularx}
\usepackage{lastpage}
\usepackage{adjustbox}
\usepackage[useregional]{datetime2}
Hi! Maybe this is already a thing but I didn't found it. Is there any command that queries from the changelog the last version. This would be ideal for showing version number on headers.