tex, string, and separator options for units#1447
Open
Alex-Jordan wants to merge 1 commit into
Open
Conversation
edd0da7 to
9b88415
Compare
9b88415 to
940409b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This implements one of the suggestions from @dpvc in #1437, and replaces that pull request.
Units.pmcan havestring,tex,string_separator, andtex_separatorproperties.micronto be a named unit instead of an alias.stringproperty is used when the unit or its aliases are printed as a string.stringproperty needs to use a string that can actually be printed in hardcopy. There is a comment about this in the file above where the big units hash is defined.Compute(), make sure that any allstringproperties are also unit names.texproperty is used when the unit or its aliases are printed as tex.tex_separatorproperty are only used when the unit is not part of a larger fractional unit, and the unit is the first unit following a number. Otherwise a space is used, as has been the case. For example,180°and180° s, but180 s °(except as tex).string_separatorproperty is similar, except it is also used even when there is a larger fractional unit. For example,180°/s.degis usingtex_separatorandstring_separator, with each set to the empty string. I considered doing this withdegFanddegC, but Google tells me there should be a space for those units for scientific publications.contextUnits.plwas adding aliases forL(liter,liters,litre, andlitres). It was cleaner to move those over toUnits.pm. If there was a reason they were not already inUnits.pm, I could move them back.One thing that could still be improved, is that for string production, the spaces that are used in between numbers and units (when
string_separatoris not set), or between units and units should be nonbreaking spaces. I tried things that I though should work, but did not work for one reason or another. So that can be addressed in some future PR.Try the problem from #1437 for some basic testing. Although you may want to also try with some more complicated units that have unit products and quotients.