menukeys icon indicating copy to clipboard operation
menukeys copied to clipboard

Use pgfkeys instead of kvoptions

Open wget opened this issue 9 years ago • 17 comments

Hi there,

Since your package makes high use of Tikz and the latter is using pgfkeys internally, I was wondering why not use that keyvalue implementation instead of kvoptions you are currently using. This would require to remove that package from the requirement list (I checked pfdkeys is actually loaded when compiling your package :( ) and I think pgfkeys is easier to use and more featureful than kvoptions.

What do you think of this? Personally I have learned pgfkeys in a few hours using the pgfkeys manual included in the one from the TIKZ.

In LaTeX, there are several keyvalues implementations. If you want to have a good overview of the available implementation, this (small, only 13 pages) article is a must read.

Regards,

wget avatar Aug 09 '16 14:08 wget

Hi William,

actually I can’t tell why I decided to use kvoptions when implementing menukeys. I also considered switching to pgfkeys but it won’t bring much advantages for the current implementation, so never touch a running system is why I don’t want to switch. I really want to reimplement menukeys completly from scratch with LaTeX3 and without catoptions because the latter brings many disadvantages (but is necessary at the moment …). Unfortunately I don’t have the time for that at the moment :-(

Regarding this I’d close your request, okay?

Regards, Tobi

tweh avatar Aug 10 '16 09:08 tweh

Hi Tobias,

I think that catoptions doesn't work anymore in combination with the hook management mechanism of the latest LaTeX 2020-10-01. (Now published.) As an example, this simple mwe fails to compile:

\documentclass{article}

\usepackage{menukeys}

\begin{document}
hello
\end{document}

The error message is clearly related to catoptions:

ERROR: Extra \endgroup.

--- TeX said ---
\document ->\endgroup 
                      \let \BeforeStartOfDocument \@firstofone \cpt@beforest...

Thanks,

Robert

ralessi avatar Oct 04 '20 10:10 ralessi

Yes. I know, but unfortunately I have no spare time to fix this issue at the moment …

tweh avatar Oct 04 '20 10:10 tweh

Yes. I know, but unfortunately I have no spare time to fix this issue at the moment …

I understand, thank you for your answer. Meanwhile, I noticed that compiling with --nonstopmode gives the expected ouput—I can live with this! Besides, catoptions may be the culprit.

ralessi avatar Oct 04 '20 13:10 ralessi

Yes. catoptions is a huge problem in the new LaTeX version.

However --nonstopmode doesn’t solves this it just hides the error in a log file ;-)

tweh avatar Oct 04 '20 13:10 tweh

Yes. catoptions is a huge problem in the new LaTeX version.

However --nonstopmode doesn’t solves this it just hides the error in a log file ;-)

Yes, I know, I just wanted to recompile part I. of a book which compiled a couple of days ago, and unfortunately this had to be done before Monday....

What has to be done for part II. remains to be seen!

ralessi avatar Oct 04 '20 15:10 ralessi

For what it's worth, commenting out line 4342 of catoptions.sty seems to solve this issue, like so:—

--- /usr/local/texlive/2020/texmf-dist/tex/latex/catoptions/catoptions.sty	2014-08-30 23:38:44.000000000 +0200
+++ catoptions.sty	2020-10-05 08:31:58.703138854 +0200
@@ -4342,7 +4342,7 @@
 \robust@def*\BeforeStartOfDocument{\grightaddtocs\cpt@beforestartdoc}
 \new@def*\cpt@beforestartdoc{}
 \gleftaddtocs\document{%
-  \endgroup
+  %\endgroup
   \let\BeforeStartOfDocument\@firstofone
   \cpt@beforestartdoc
   \let\BeforeStartOfDocument\@notprerr

ralessi avatar Oct 05 '20 07:10 ralessi

Good to know. Thanks!

tweh avatar Oct 05 '20 08:10 tweh

@ralessi two things (and I hope this doesn't sound unfriendly; it isn't meant unfriendly, I promise):

  1. In case you haven't noticed yet, the catoptions requirement was removed and menukeys should now work with new LaTeX versions (if you find anything not working please open a new issue).

  2. Which brings me to the second point: The incompatibility of menukeys with LaTeX versions starting from 2020-10-01 was really a separate issue and shouldn't have been reported in this but in a new thread (which it eventually was on October 8th). Reporting back issues is much appreciated, but managing the list of issues is easier if the issues stay as separate as possible, I hope you understand this. Thank you for reporting back.

Skillmon avatar Nov 05 '20 22:11 Skillmon

@Skillmon Yes, I confirm the issue is gone, thank you for your help. Regarding your second point, I may have mistakenly inserted a comment here instead of opening a new issue. I did that because @tweh mentioned the many problems he encountered with catoptions earlier. And since this package was obvioulsy the culprit of menukeys not working anymore, I thought this was a good place to mention one more reason to drop it. I had no idea this might lead to confusion. Sorry.

ralessi avatar Nov 06 '20 05:11 ralessi

@ralessi no harm done. I just have to ignore the parts in this thread not about pgfkeys vs. kvoptions :)

Skillmon avatar Nov 06 '20 08:11 Skillmon

@Skillmon Thank you. And by the way (even though off topic), I am a great admirer of expkv-* which I used exclusively in ekdosis. Switching to expkv is planned for my other packages too. So thanks twice!

ralessi avatar Nov 06 '20 09:11 ralessi

Since some parts of menukeys have now been ported to LaTeX3 (to drop catoptions) it might be a good idea to use l3keys for options rather than pgf

tweh avatar Nov 06 '20 15:11 tweh

@tweh Before making a final decision about the used key=value frontend, I'd like to port more things to LaTeX3 (you mentioned in some other thread that you intended to do so). I'd say that then the decision isn't that pressing, but we have to have at least parts of it in pgfkeys for the TikZ based output.

But we could have coding options and parsing options through l3keys and only the output-related things through pgfkeys (since, if we switch to expl3 for internal programming, all the variable names will be expl3 conform, so then using l3keys feels more naturally).

Skillmon avatar Nov 06 '20 15:11 Skillmon

I’m fine with any solution ;-) as a first thought I’d say that using only one frontend would be better but since pgf/TikZ and expl3 in some cases need some special treatment (since expl3 ignores spaces and breaks : for TikZ), it might be a good idea to use pgf for some options an expl3 for others.

tweh avatar Nov 06 '20 15:11 tweh

I'll have to make myself more familiar with the code, and certainly have to port more things to LaTeX3 (if that's an end-goal for upcoming releases) before I can make an educated decision here. I hope to find a bit of time this weekend to start tackling this.

Skillmon avatar Nov 06 '20 16:11 Skillmon

I wanted to port the whole package to L3 for a long time but didn’t had the time. However I was thinking about a more or less complete reimplementation with a new frontend for styles etc., since the current interface isn’t pretty well …

tweh avatar Nov 06 '20 16:11 tweh