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

Warn if \problemtitle differs from problem.settings.name[language] #326

Closed
thorehusfeldt opened this issue Dec 20, 2023 · 6 comments · Fixed by #329
Closed

Warn if \problemtitle differs from problem.settings.name[language] #326

thorehusfeldt opened this issue Dec 20, 2023 · 6 comments · Fixed by #329

Comments

@thorehusfeldt
Copy link
Collaborator

When problem.en.tex contains

\problemname{Hello Gaia!}

but problem.yaml contains

name:
  en: Hello World!

there currently is no warning. BAPC instead expects the author to write

\problemname{\problemyamlname}

but there can be reasons to avoid that macro, typically due to other tooling. (In particular, it is one of the few details that prevents a BAPC-compatible problem package from being problemtools/verifyproblem-ed.)

There is extensive parsing of TeX-code already being done in bt constraints, but the above check could be done quite easily and catch 99% of cases.

A more aggressive solution would be to actually edit problem.en.tex after bt new_problem and bt rename_problem.

@RagnarGrootKoerkamp
Copy link
Owner

Sounds reasonable to add a warning/log for this indeed.

I think the most common usecase for this is when the latex name includes additional markup that we don't want to expose in the yaml. But it's probably fine to just warn for these cases anyway since accidental mismatches are worse than a few extra warnings.

@mzuenni
Copy link
Collaborator

mzuenni commented Dec 21, 2023

We could also check if the expected string is a substring of the actual string... That would reduce the number of warnings but would also suppress the warning for some types of typos.

@thorehusfeldt
Copy link
Collaborator Author

Can you give an example? I would understand whitespace normalisation (because LaTeX is lenient about that).

@mzuenni
Copy link
Collaborator

mzuenni commented Dec 21, 2023

It would not warn for markup like this: \texttt{IX}th Problem because IXth Problem is still a substring. On the other hand, it would no longer warn for IXth Prooblem or stuff like that...

@thorehusfeldt
Copy link
Collaborator Author

Ah, that kind of substring. Now it makes sense.

@thorehusfeldt
Copy link
Collaborator Author

Minimal solution is now a concrete pull request, please comment there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants