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

support angstrom #64

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

zezhong-zhang
Copy link

A minor PR as Å is commonly used in microscopy, would be useful to support it.

Copy link
Owner

@ppinard ppinard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure how to include Angstrom, but it definitely does not belong to the _PREFIXES_FACTORS. Maybe you need a new _Dimension class with Angstrom supported inside. Maybe something like LengthDimension

@@ -25,6 +25,7 @@
"\u00b5": 1e-6,
"u": 1e-6,
"n": 1e-9,
"A": 1e-10,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Angstroms is not a prefix. It should not appear in this list.

latexrepr = "Å" # Directly add "Å" without appending "m"
self.add_units(prefix, factor, latexrepr)
else:
self.add_units(prefix + "m", factor, latexrepr)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think Angstroms should be part of the default SILengthDimension. Angstrom is not an SI unit. Most users will not want to see Angstrom as a unit when drawing a scale bar.

@@ -111,7 +112,11 @@ def __init__(self):
latexrepr = None
if prefix == "\u00b5" or prefix == "u":
latexrepr = _LATEX_MU + "m"
self.add_units(prefix + "m", factor, latexrepr)
if prefix == "Å" or prefix == "A" or prefix == "angstrom":
latexrepr = "Å" # Directly add "Å" without appending "m"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The correct LaTeX expression would be \AA

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 this pull request may close these issues.

2 participants