hackl / TikZ-StructuralAnalysis

TikZ Library for Structural Analysis
Other
123 stars 29 forks source link

stanli.sty: Validate type option passed to 2D and 3D library elements. #30

Closed agmartin2 closed 2 years ago

agmartin2 commented 2 years ago

Hi again, Jürgen

One problem I am having with stanli.sty is that when wrong type is passed to a library element this element is silently ignored without any warning. It is just not shown, and in complex drawings this may even get unnoticed.

I have been thinking about this and want to propose a type error handling mechanism to trigger errors in these cases. It deals only with 'major type'.

In this implementation, a single boolean is used, it is reset at command start and trued if a valid option is passed. At command end, its value is checked and an error triggered for no valid option passed, together with some info, like in this example

`! stanli::support: Bad type: 1bad.

...ge {stanli::support: Bad type: 1bad} \errorstopmode l.43 \support{1bad}{f}; ?` An alternative would be to nest definitions and trigger an error if no tests matches, but I think this would make code way harder to read in long definitions. Regards,
hackl commented 2 years ago

Thank you very much! I like the idea to give the user feedback if some wrong arguments were entered.

agmartin2 commented 2 years ago

Happy to see this useful.

I think these were the most important since for them wrong input caused no failure at all. Looked in other options like axes but in those I looked, when wrong value is passed an error is indirectly triggered.

What has been the biggest problem for me is when I compile files in a different box and I forget to add last stanli.sty from github. When done in a hurry this resulted in missing elements due to use of old stanli.sty from TeXLive. This leads to another problem, stanli.sty in CTAN (and thus in TeXLive and friends) is rather old, ¿time for an upgrade?

Regards,

hackl commented 2 years ago

Hi, I will test all the changes made and update the documentation, then I will release the new version.