Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve cleveref support #229

Merged
merged 9 commits into from
Oct 25, 2022
Merged

Improve cleveref support #229

merged 9 commits into from
Oct 25, 2022

Conversation

torik42
Copy link
Owner

@torik42 torik42 commented Aug 15, 2022

This is the continuation of #199 after the transfer. Old discussion:

@torik42:

This PR adds macros \crefalias, \cpageref, \Cpageref, \cpagerefrange, \Cpagerefrange, \lcnamecref, \lcnamecrefs, \namecref, \nameCref, \namecrefs and \nameCrefs from cleveref package. To properly read the sed file, the macros \MakeLowercase and \MakeUppercase are added to yalafi/parameters.py.

To simplify testing, a latex document tests/test_packages/cleveref.tex is added. It is used to create the sed file tests/test_packages/cleveref.sed. The latter is then loaded to test the above commands in tests/test_packages/test_cleveref.py.

The comment about \crefrange and \Crefrange in list_of_macros.md is removed, because the problem is not due to incorrect creation of the sed file, but rather, because the \crefrange command does not work at all (at least for me).

I already added entries to HISTORY.md similar to the existing ones. Feel free to change anything also in this branch.

@matze-dd:

Thank you sincerely for the input(s)! Unfortunately, I cannot contribute at the moment. It will take at least one more week to come back.

@JulianGoeltz:

Hi @torik42 and @matze-dd, I've discovered this (and the other) PRs when using YaLafi and encountering issues with the cleverref and glossaries packages. Do you have an estimate if/when you find the time to merge the open PRs, they seem to solve some of the issues? Anyway, thanks for this package, it's an enormous help!

@torik42:

I have a tiny change locally that I can submit in the next days, which seems needed for multi file projects. Other than that, the PR is pretty much complete from my side. It would be great, if @matze-dd could have a look. In the meantime, there are no conflicts with the base branch, and you could merge the PR, build locally and try it out. If you then encounter any problems (other than the hyperref thing), I would love to hear your feedback. Are there problems from using cleveref together with glossaries?

@torik42:

Okay, my local changes were for multi-language projects. Then cleveref produces a sed file, which includes restrictions on line numbers for replacing the correct names, i.e., replacing \cref@equation@name with either equation or Gleichung depending on the language used in these lines. The line numbers seem to be correct only if using a single-file document. For that reason and for simplicity, I decided to only parse the first replacements from the sed file which seem to correspond to the documents main language.

The tests work well locally (up to test_shell and test_as_server which depend on LanguageTool installation), the CI has problems to set up python.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
- Add macro \crefalias
- Add macros \cpageref, \Cpageref, \cpagerefrange, \Cpagerefrange, \lcnamecref, \lcnamecrefs, \namecref, \nameCref, \namecrefs, \nameCrefs
- Add cleveref.tex and cleveref.sed used for more tests in test_cleveref.py in tests/test_packages
Replace all references in multi-language documents with those from the 
main language
@torik42 torik42 added the type: LaTeX Issues concerning supported or new LaTeX command or packages label Aug 21, 2022
@torik42 torik42 merged commit 36c2cb6 into master Oct 25, 2022
@torik42 torik42 deleted the improve-cleveref-support branch October 25, 2022 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: LaTeX Issues concerning supported or new LaTeX command or packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant