[LyX/master] Improve LaTeX version checking
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Sun Jan 8 18:49:06 UTC 2023
Le 19/12/2022 à 14:20, Juergen Spitzmueller a écrit :
> commit 029adfa28cedf921ee7ee4709422441705d93520
> Author: Juergen Spitzmueller <spitz at lyx.org>
> Date: Mon Dec 19 15:15:41 2022 +0100
>
> Improve LaTeX version checking
>
> Instead of having to add and individually test the versions to check
> for, we store the current version and test on that with a specific
> function isAvailableAtLeastFrom(package, year, month, day)
>
> Currently only used for the LaTeX version, but could also be extended
> for package versions.
This causes issues for me, where LyX tells me that enumitem.sty is not
present (see ticket https://www.lyx.org/trac/ticket/12617).
After spending a long time looking at what is wrong with enumitem.sty, I
figured out that every other package was missing.
The reason is there:
> @@ -55,8 +58,13 @@ void LaTeXPackages::getAvailable()
> case Lexer::LEX_FEOF:
> finished = true;
> break;
> - default:
> - packages_.insert(lex.getString());
> + default: {
> + string const p = lex.getString();
> + // Parse optional version info
> + lex.eatLine();
> + string const v = lex.getString();
> + packages_.insert(make_pair(p, v));
For some reason (maybe because I am in C++11 mode) the eatLine() does
not grab the potential second part of the line, but the package name in
the next line.
I guess we can get the full line and split it ourselves.
Jürgen, unless you have a better idea, I can do that.
Since I am on this commit, I remember that back then in December when I
was numbed down by flu, I saw that below:
> +bool LaTeXPackages::isAvailableAtLeastFrom(string const & name,
> + int const y, int const m, int const d)
> +{
Is there a reason why we need that instead of comparing dates as string?
Something like
if (package_date >= "2015/09/01") {
[...]
JMarc
More information about the lyx-devel
mailing list